Does anyone know if the following class has been depreciated - import org.apache.jasper.runtime.*;
I was trying to create two servlets just to see if I could create an e-commerce java enabled site. These files would use a session object to keep track of a users selections for an e-commerce based idea. I would make it so that the user would add items selected by using the doGet() method to add items to the session. In the doPost() method , I would add the code to display the contents of the session object. I would have to use Vector rather than String[] so can add previous selections, rather than replace.
Then use a database table using SQL, creating these tables to hold the data.
The point is that when I tried using org.apache.jasper.runtime, and HttpJspBase, I am getting an error message (see below)
line 6: package org.apache.jasper.runtime does not exist import org.apache.jasper.runtime.*; ^ line 9: cannot resolve symbol symbol : class HttpJspBase location: class org.apache.jsp.ShowNames_jsp public class ShowNames_jsp extends HttpJspBase { ^ 2 errors
Process completed.
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import java.util.*;
publicclass ShowNames_jsp extends HttpJspBase {
privatestatic java.util.Vector _jspx_includes;
public java.util.List getIncludes() {
return _jspx_includes;
}
publicvoid _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\r\n");
out.write("<HTML>\r\n");
out.write("<HEAD>\r\n");
out.write("<TITLE>Showing Objects from a Session");
out.write("</TITLE>\r\n");
out.write("</HEAD>\r\n");
out.write("<BODY BGCOLOR=\"#E0FFFF\">\r\n");
out.write("<H1>");
out.write("<CENTER>Showing Objects from a Session");
out.write("</CENTER>");
out.write("</H1>\r\n\r\n");
Vector UserSession = ( Vector ) session.getAttribute( "users" );
Integer xCount = (Integer) session.getAttribute("count");
out.write("\r\n\r\nNumber of names: ");
out.print(xCount.intValue());
out.write("\r\n\r\n");
out.write("<BR>\r\n\r\n");
for ( int i = 0; i < UserSession.size() ; i ++ )
{
out.write("\r\n");
out.print( ( String ) UserSession.elementAt ( i ));
out.write("\r\n");
}
out.write("\r\n\r\n");
out.write("</BODY>\r\n");
out.write("</HTML>");
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
The error "package org.apache.jasper.runtime does not exist" is probably coming from a problem with your tomcat setup. The classpath at runtime is not finding the org.apache.jasper.runtime package.
Suggest reinstalling your tomcat and checking any installation notes for your operating system.
The code you posted looks like the results of a jsp compiled page.
You should post the jsp code.
Try the examples in the default tomcat installation and see if they are working.