session.setAttribute("results",l_vecTmp); // l_vecTmp is the vector
ServletConfig sc=getServletConfig();
ServletContext sx=sc.getServletContext();
RequestDispatcher rd=sx.getRequestDispatcher("/results.jsp");
rd.forward(req, res); //the 2 params are the standard httpservlet request
and response objects that were passed to the servlet
In the JSP, I use the following code:
<%! int i;
Vector l_vecTmp;%>
<%! SearchResultBean l_srb;
int l_iSize=l_vecTmp.size(); %>
<% try
{
l_vecTmp=(Vector)request.getAttribute("results");
}
catch(Exception e)
{
e.printStackTrace();
}
%>
The directory structure is as follows-
Location of results.jsp:
<tomcat-root>\webapps\studentsearch
Location of servlet:
<tomcat-root>\webapps\studentsearch\WEB-INF\classes
When I run the application, I get a JasperException in the servlet, at the
requestdispatcher line.
Does it mean the servlet cant find the JSP?
Do i have to add the JSP to the web.xml deployment descriptor?
ANy help appreciated
Rex
"Rex" <thomas.ande...@matrix.net> wrote in message
news:biafbu$78agv$1...@ID-202120.news.uni-berlin.de...
"Rex" <thomas.ande...@matrix.net> wrote in message
news:biahed$78nne$1...@ID-202120.news.uni-berlin.de...
> It says JasperException ...
>
>
See http://edocs.bea.com/wls/docs61/webapp/web_xml.html#1014756
"Rex" <thomas.ande...@matrix.net> wrote in message
news:biahgl$75521$1...@ID-202120.news.uni-berlin.de...
Do you have any imports at the top of your jsp? Based on the fact that you
didn't package your Servlet class, I'm going to guess that you also did not
package your JavaBean.
Like the other people who responded, I'd like to see the *entire* error
message. I doubt that you're getting a JasperException from your Servlet.
Jasper is the engine that converts JSP to Java code and then compiles it.
There's not enough information in your post to be sure, but I suggest you
package your code, and place the .class files underneath 'WEB-INF/classes'
in a structure that matches the package structure. The default package (no
package statement) is only meant for testing and simple examples,
production code, or even moderately complex examples, needs to be packaged.
--
Wendy in Chandler, AZ
org.apache.jasper.JasperException
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
48)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:684)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:432)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:356)
*******************
at
com.rex.studentsearch.SearchServlet.doPost(SearchServlet.java:169)====> This
is where I'm doing 'getRequestDispatcher.forward()'
********************
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java
:458)
at
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:260)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:471)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
eNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:380)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:533)
at java.lang.Thread.run(Thread.java:534)
Perhaps the path to the JSP is wrong? It is placed in the application
folder, in this case webapps/studentsearch.
So i suppose the correct invocation would be ./results.jsp, relative to
studentsearch
Have you tried calling the JSP directly, via a simple request for
http://<site:port>/results.jsp
Does this work ?, you may need to alter the JSP to be defensive coded such
that it will not crash if it's assumptions (i.e. existence of a bean and the
contents of the said bean) are not met.
One common problem I have encountered is mis-spelling, the JSP name is case
sensitive. Is the JSP named results.jsp with a lower case r ?
If this works then the JSP is OK so you'd have to take a look at some other
causes such as logic errors in the JSP.
As to your other question, in another post, /results.jsp is the correct
invocation. The / means from the root of the web application.
"Rex" <thomas.ande...@matrix.net> wrote in message
news:bialqg$76c6n$1...@ID-202120.news.uni-berlin.de...