File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Session Management using URL rewriting in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session Management using URL rewriting in Struts" Watch "Session Management using URL rewriting in Struts" New topic
Author

Session Management using URL rewriting in Struts

Satheesh Kumar G
Greenhorn

Joined: Feb 08, 2003
Posts: 21
hi,
In our application being developed using struts, we need to handle session using URL rewriting(client requirement). I tried to put the following in struts-config.xml
<action path="/SearchConditionList"
type="com.jp.nissan.nshop.WRN.action.SearchCriteriaAction"
name="SearchCriteriaActionForm"
validate="true"
input="/searchanddownload/IntroductionSearchFailureError.jsp"
scope="session">
<forward contextRelative="true" redirect="true" name="SearchListOffice" path="../searchanddownload/SearchFrame.jsp"/>
</action>
in forward tag i mentioned redirect="true" so that response.sendRedirect gets invoked and URL rewriting happens, but session is not retained still.
Thanks in advance.
Best Regards,
Satheesh
Suresh Gopi
Ranch Hand

Joined: Mar 08, 2007
Posts: 49
Hello All,


Iam also facing similar kind of problem while testing my application.( I disabled my browser cookies settings so that browser relies only url rewriting)


(Everthing works fine when i enable cookies in th browser)


<action path="/sourceAction"
type="com.test.action.SourceAction"
name="someForm"
validate="true"
>

<forward name="success" path="/targetAction.do?parameter=init"/>

</action>


<action path="/targetAction"
type="com.test.action.TargetDispatchAction"
name="someForm2"
validate="true"
parameter="parameter"
>


From SourceAction's execute method iam doing the following before forwarding to targetAction.

-----------
-----------

ActionForward forward = mapping.findForward("success");

ActionForward urlEncodedForward = new ActionForward(response.encodeURL(forward.getPath()));

return urlEncodedForward;

-------------


Even after doing this the TargetAction is not part of my session.
session is lost.

session.isNew() returns true in TargetAction's init() method.

Please provide your valuable suggestions. Thanks a lot for your time.


Regards<br />Suresh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Management using URL rewriting in Struts