getting objects from the session [message #145077] |
Fri, 17 March 2006 09:47  |
Eclipse User |
|
|
|
Hi. I'm trying to access objects from the session.
resultVo = (DisplayVo)
reportContext.getHttpServletRequest().getAttribute('myDis'); //myDis is
DisplayVo object that is in the session
this.valueExpr=resultVo.getFirstString();
/*getFristString is a method that returns a string*/
the errors:
Error0 : Error.ScriptEvaluationError ( 1 time(s) )
detail : org.eclipse.birt.report.engine.api.EngineException: There are
errors evaluating script "var resultVo=new Packages.DisplayVo();". at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:508)
at
org.eclipse.birt.report.engine.executor.ExecutionContext.eva luate(ExecutionContext.java:471)
at
org.eclipse.birt.report.engine.data.dte.DteDataEngine.evalua te(DteDataEngine.java:321)
anyone can help me please? the report and the class file DisplayVo are in
the same project and I have copied the DisplayVo.class in C:\Program
Files\MyEclipse\eclipse\plugins\org.eclipse.birt.report.view er_2.0.1\birt\WEB-INF\classes
Thank you and have a Happy Saint Patrick's Day!
Cristian
|
|
|
|
|
|
|
|
|
Re: getting objects from the session [message #145516 is a reply to message #145405] |
Fri, 17 March 2006 13:22   |
Eclipse User |
|
|
|
I've tryed several scenarios:
1. I start with a servlet that stores an object into session, then I
continue with a report that tryies to get that object from the session.
From the report I go to a JSP file that tryies also to get that object
from the session. Results: the report doesn't see the object stored in the
session, but the JSP file executes successfuly.
2. I start with a report R1 that stores an object into session, then I
continue with a JSP file that tryies also to get that object from the
session. From the JSP file I go to a second repot R2 that tryies to
retrieve the session object stored by the first report. Results: the JSP
file fails to retrieve any object from the session (doesn't see any), but
the second report executes successfuly.
Are the session created by BIRT and servlet different? (I have provided in
previous messages the code for the servlet and BIRT reports). Can I do
anything so that the BIRT reports to see the session variables stored by
the servlet and the other way (the JSP to see the session variables stored
by the BIRT repor)?
Thank you,
Cristian
---------------------------
Servlet:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.xxxxx.vo.DisplayVo;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DisplayVo myDisplay = new DisplayVo();
myDisplay.setFirstString("first 111 from servlet");
HttpSession mySession = request.getSession();
mySession.setAttribute("myDis", myDisplay);
}
}
---------------------------------
Report R1:
var frame=new Packages.DisplayVo();
frame.setFirstString("aaaa");
this.valueExpr=frame.getFirstString();
reportContext.getHttpServletRequest().getSession().setAttrib ute( "myDis",
frame);
----------------------------------
Report R2:
var
frame2=reportContext.getHttpServletRequest().getSession().ge tAttribute(
'myDis');
this.valueExpr+="\n---frame2--- "+ frame2+" -----";
this.valueExpr+="\n---frame2-First element--- "+ frame2.getFirstString()+"
-----";
-----------------------------------
JSP File:
.....
Enumeration sessionNames= session.getAttributeNames();
if(sessionNames.hasMoreElements()){
out.println("********" + sessionNames.nextElement());
}
if(resultVo==null){
out.println("<H4>there is no DisplayVo instance in session!</H4>");
}else {
...
}
......
-------------------------------------
|
|
|
HELP!!!!!! Re: getting objects from the session [message #145529 is a reply to message #145405] |
Fri, 17 March 2006 13:22   |
Eclipse User |
|
|
|
I've tryed several scenarios:
1. I start with a servlet that stores an object into session, then I
continue with a report that tryies to get that object from the session.
From the report I go to a JSP file that tryies also to get that object
from the session. Results: the report doesn't see the object stored in the
session, but the JSP file executes successfuly.
2. I start with a report R1 that stores an object into session, then I
continue with a JSP file that tryies also to get that object from the
session. From the JSP file I go to a second repot R2 that tryies to
retrieve the session object stored by the first report. Results: the JSP
file fails to retrieve any object from the session (doesn't see any), but
the second report executes successfuly.
Are the session created by BIRT and servlet different? (I have provided in
previous messages the code for the servlet and BIRT reports). Can I do
anything so that the BIRT reports to see the session variables stored by
the servlet and the other way (the JSP to see the session variables stored
by the BIRT repor)?
Thank you,
Cristian
---------------------------
Servlet:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.xxxxx.vo.DisplayVo;
public class TestingServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
DisplayVo myDisplay = new DisplayVo();
myDisplay.setFirstString("first 111 from servlet");
HttpSession mySession = request.getSession();
mySession.setAttribute("myDis", myDisplay);
}
}
---------------------------------
Report R1:
var frame=new Packages.DisplayVo();
frame.setFirstString("aaaa");
this.valueExpr=frame.getFirstString();
reportContext.getHttpServletRequest().getSession().setAttrib ute( "myDis",
frame);
----------------------------------
Report R2:
var
frame2=reportContext.getHttpServletRequest().getSession().ge tAttribute(
'myDis');
this.valueExpr+="\n---frame2--- "+ frame2+" -----";
this.valueExpr+="\n---frame2-First element--- "+ frame2.getFirstString()+"
-----";
-----------------------------------
JSP File:
.....
Enumeration sessionNames= session.getAttributeNames();
if(sessionNames.hasMoreElements()){
out.println("********" + sessionNames.nextElement());
}
if(resultVo==null){
out.println("<H4>there is no DisplayVo instance in session!</H4>");
}else {
...
}
......
-------------------------------------
|
|
|
|
|
Re: HELP!!!!!! Re: getting objects from the session [message #145600 is a reply to message #145529] |
Fri, 17 March 2006 14:01   |
Eclipse User |
|
|
|
Cristian,
What app server do you have this deployed to?
If you are using Tomcat, just try what I put in my earlier post.
Jason
"Cristian" <ceol.gael@gmail.com> wrote in message
news:00508422ae8c80123c99b362efc43dc3$1@www.eclipse.org...
> I've tryed several scenarios:
>
> 1. I start with a servlet that stores an object into session, then I
> continue with a report that tryies to get that object from the session.
> From the report I go to a JSP file that tryies also to get that object
> from the session. Results: the report doesn't see the object stored in the
> session, but the JSP file executes successfuly.
>
> 2. I start with a report R1 that stores an object into session, then I
> continue with a JSP file that tryies also to get that object from the
> session. From the JSP file I go to a second repot R2 that tryies to
> retrieve the session object stored by the first report. Results: the JSP
> file fails to retrieve any object from the session (doesn't see any), but
> the second report executes successfuly.
>
> Are the session created by BIRT and servlet different? (I have provided in
> previous messages the code for the servlet and BIRT reports). Can I do
> anything so that the BIRT reports to see the session variables stored by
> the servlet and the other way (the JSP to see the session variables stored
> by the BIRT repor)?
>
> Thank you,
> Cristian
>
> ---------------------------
> Servlet:
>
> import java.io.IOException;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
> import javax.servlet.http.HttpSession;
> import org.xxxxx.vo.DisplayVo;
>
> public class TestingServlet extends HttpServlet {
> public void doGet(HttpServletRequest request, HttpServletResponse
> response)
> throws ServletException, IOException {
>
> DisplayVo myDisplay = new DisplayVo();
> myDisplay.setFirstString("first 111 from servlet");
> HttpSession mySession = request.getSession();
> mySession.setAttribute("myDis", myDisplay);
> }
> }
> ---------------------------------
> Report R1:
>
> var frame=new Packages.DisplayVo();
>
> frame.setFirstString("aaaa");
> this.valueExpr=frame.getFirstString();
> reportContext.getHttpServletRequest().getSession().setAttrib ute( "myDis",
> frame);
>
> ----------------------------------
> Report R2:
>
> var
> frame2=reportContext.getHttpServletRequest().getSession().ge tAttribute(
> 'myDis');
> this.valueExpr+="\n---frame2--- "+ frame2+" -----";
> this.valueExpr+="\n---frame2-First element--- "+
> frame2.getFirstString()+" -----";
>
> -----------------------------------
> JSP File:
> ....
> Enumeration sessionNames= session.getAttributeNames();
> if(sessionNames.hasMoreElements()){
> out.println("********" + sessionNames.nextElement()); }
> if(resultVo==null){
> out.println("<H4>there is no DisplayVo instance in
> session!</H4>"); }else {
> ..
> }
> .....
>
> -------------------------------------
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06190 seconds