Hi you all again!
I've moved to cocoon 2.1.7 and I persist trying to run up a JSP file
that uses the session information. Beginning with the idea that it's
the CINCLUDE TRANSFORMER the one who don't pass the session to the
called JSP file, I've tried to execute the file directly from the JSP
generator. That's the solution to my problems (I thought) because the
session is processed by the JSP... the problem now is that I NEED to
use the CINCLUDE transformer becasuse of the file I'm trying to execute
is "outside the servlet" and I get the exception:
org.apache.cocoon.ProcessingException: You must not reference a file
outside of the servlet context at file:/C:/Archivos de programa/Apache
Software Foundation/Tomcat 5.0/webapps/cocoon/.
Does anybody knows a way of doing that? a walkarround to not to use the
cinclude or something like that?
Tanks a lot!!!
Miguel Angel Marín Moreno escribió:
any ideas?
Thanks again...
Hi all!
I have a problem with essions in cocoon. In my pipeline I execute a
piece of code in JSP using CINCLUDE transformer. In this piece of code
I load some values in the session which ones later I need to get with
executing another JSP. (I can't use cocoon's sessions/context because I
can't get its values from the JSP code)
In other words, I'll try to explain it better with the code (read the
comments please)
this is my pipeline:
<map:match pattern="Almacena.jsp">
<map:generate type="request">
<map:parameter name="generate-attributes" value="true"/>
</map:generate>
<!-- the pipeline starts with an XML which contains the REQUEST
details -->
<!-- peticion.xsl is an XSLT that transform the XML to set the
correct params to apply the CINCLUDE with the params that identify the
URL of the JSP file that I want to execute -->
<map:transform src="">
<map:parameter name="cms-url"
value="http://mmarin:8080/pruebasSesion/Ejemplos"/>
<map:parameter name="url-peticion"
value="AlmacenaSession.jsp"/>
</map:transform>
<!-- I've thought in the posibility of passing the SessionID as a
parameter to the JSP, but don't know how to "set the sessionID" in JSP.
Any idea?-->
<!-- When I apply the Cinclude transformer, the JSP code RUNS WITH A
DIFFERENT SESSION EACH TIME (that's my problem!) -->
<map:transform type="cinclude"/>
<!-- As I am only proving the way of doing this, I'm using a very
simple JSP file which set the values of 2 params (nombre, edad) in the
session and returns an XML file which will be transformed by the XSLT
"Almacena.xsl" -->
<map:transform src=""/>
<map:serialize type="html"/>
</map:match>
This is the piece of JSP code:
<%@ page language="Java"
session="true"%><?xml version="1.0"
encoding="ISO-8859-1"?>
<%@ page import="java.util.*" %>
<%!String nombre;
Integer edad;
String sessionId; %>
<%nombre=request.getParameter("nombre");
edad=Integer.parseInt(request.getParameter("edad"));
sessionId = session.getId();
session.setAttribute("nombre",nombre);
session.setAttribute("edad",edad);%>
<AlmacenaEnSession>
<nombre><%=nombre%></nombre>
<edad><%=edad%></edad>
<sessionID><%=sessionId%></sessionID>
</AlmacenaEnSession>
I get the SessionID so I can prove that it's different of the one I
have in the browser :((
Finally I try to recovery the info I've saved in the JSP session using
another pipeline similar to this one which execute a JSP code too.
As the session in which the JSP runs is different each time I cannot
get the values....
Any idea?
Thanks in advance!!
Miguel Angel Marín
|
- Re: [Fwd: problem withs sessions running JSPs i... Miguel Angel Marín Moreno
-