Hi,
we've encountered a strange problem using Struts (nightly build) under
Tomcat 3.2.1.
The situation (test case):
we do have three Actions: A1, A2 and A3.
A1 inserts an object in the session-context under a wellknown key and
forwards to A2.
A2 reads the object from the session-context and forwards to A3.
A3 reads the object again and forwards to a JSP.
Simple enough.
The strange part occurs, when Tomcat is started up and this chain is
executed for the first
time.
What happens is: A1 and A2 works as expected but when executing A3 the
session id has changed.
(This happens most of the time under the described circumstances.
A few times it works as expected).
The same scenario works perfectly well under Tomact 4.0 b1.
It seems to be rather a Tomcat 3.2.1 then a Struts problem ?
I'm placing the major parts of he test case at the end of this mail.
Any help is appreciate,
Best regards, fm
-------------------------------
Configuration file:
<action path="/a1"
type="prototype.action.A1Action">
<forward name="go_for_a2" path="/a2.do" />
</action>
<action path="/a2"
type="prototype.action.A2Action">
<forward name="go_for_a3" path="/a3.do" />
</action>
<action path="/a3"
type=".prototype.action.A3Action">
<forward name="go_for_ui" path="/demo.jsp" />
</action>
---------------------------
Source A1:
public final class A1Action extends Action {
public static final String TEST = "session.test.me";
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
HttpSession session = request.getSession();
String s = "Still alive";
session.setAttribute(A1Action.TEST, s);
System.out.println("A1Action (" + session.getId() + ")=" + s);
return (mapping.findForward("go_for_a2"));
}
---------------------------------------------
Source A2:
public final class A2Action extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
HttpSession session = request.getSession();
String s = (String)session.getAttribute(A1Action.TEST);
System.out.println("A2Action (" + session.getId() + ")=" + s);
return (mapping.findForward("go_for_a3"));
}
}
---------------------------------------------
Source A3
public final class A3Action extends Action {
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
HttpSession session = request.getSession();
String s = (String)session.getAttribute(A1Action.TEST);
System.out.println("A3Action (" + session.getId() + ")=" + s);
return (mapping.findForward("go_for_ui"));
}
}