R
Rex
Im running Tomcat 4.1 with JDK 1.4.2 on Win XP SP1
I have made a simple database search page (using MSAccess) that fetches
records using jdbc odbc drivers.
A servlet does the database processing, puts the finished search results
into a vector (each result is represented by a javabean) and i use the
following code in doPost():
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
I have made a simple database search page (using MSAccess) that fetches
records using jdbc odbc drivers.
A servlet does the database processing, puts the finished search results
into a vector (each result is represented by a javabean) and i use the
following code in doPost():
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