Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Management using URL rewriting in Struts

 
Satheesh Kumar G
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic