fernando
fernando

Reputation: 31

Struts2 - See real destination url in browser on action result

In Struts2, when returning from a successful action, I want the user browser to show to the user the real url he is navigating into, and not the original call to action. As far as I understand, I cannot use a type="redirect" action because I need to pull the action results from the value stack.

Let's say, for example, if I define an action to save a new element in my db, and then I want to take the user to see the whole list of elements...:

     <action name="doSavePage" class="FbPageAdmin" method="doSavePage" >
        <result name="input">/pageadmin.jsp</result>
        <result name="error">/pageadmin.jsp</result>
        <result name="success">/pageList.jsp</result>
     </action>

If the action finishes successfully, I want the user to see mysite.com/pageList.jsp, and not mysite.com/doSavePage.action

Is that possible?

Thanks everybody in advance!

Upvotes: 2

Views: 877

Answers (1)

Dave Newton
Dave Newton

Reputation: 160271

Why would you want to have the JSP file name shown?

In any case, I'm not sure I understand; if you want to show a listing of objects after adding one, redirect to the "list" action (and/or method). You should do a redirect after a POST anyway (the post-redirect-get pattern) to avoid resubmitting the same form data on a refresh.

Also, ideally, JSPs should live under /WEB-INF to disallow direct aclient access.

Upvotes: 1

Related Questions