You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Luís Góis <lu...@netc.pt> on 2001/06/19 11:13:27 UTC

[EXPLAINED] Sharing session objects between servlets and XSP pages

I found this at a Tomcat mailing list and since I've seen here some posts questioning about it and even less concrete 
replies, here it is (simple but works ! I once get it to work like this, but I've also forgot it later and lost almost a day trying 
to solve this situation) : 

"I noticed some posts about people having problems loosing the session
information when using JSPs with servlets.  For examples if I did the
following in a JSP:   <FORM ACTION="/servlet/com.mycom.MyServlet" ... > when MyServlet got control, the Session 
was empty. I found out that if I did this the "right way" and defined the servlet in
my web.xml, e.g.,       <servlet>
         <servlet-name>theServlet</servlet-name>
         <servlet-class>com.mycom.MyServlet</servlet-class>
       </servlet>
       <servlet-mapping>
          <servlet-name>theServlet</servlet-name>
          <url-pattern>someServlet</url-pattern>
       </servlet-mapping> and in the JSP said:   <FORM ACTION="someServlet" ... > then all worked fine. You may 
have to adjust the path a bit depending upon where your
JSP is, etc.  The Tomcat mapping trace can help you debug
mapping problems. This seems like it is a Tomcat bug, but the above is not only a
workaround, but a more maintainable way of doing things.

Frank Lawlor
Athens Group, Inc.
(512) 345-0600 x151
Athens Group, an employee-owned consulting firm integrating technology
strategy and software solutions."

I hope Mr. Frank Lawlor doesn't mind about "posting" to cocoon-users!;) Hey, thanks a lot Frank!!!!


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>