Hi, I have some problem in compiling
JSP. Basically what i am trying to do is that 1)a
servlet is setting an attribute [attribute name:choice] and then calling a JSP. Which is using that attribute [attribute name:choice]. I am getting an error as shown below.
[code]
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /welcome.jsp at line 24
21: out.println( date );
22: out.println( "<BR>Your machine's address is " );
23: out.println( request.getRemoteHost());
24: ArrayList al =(ArrayList)request.getAttribute("choice");
25: Iterator it = al.iterator();
26: while (it.hasNext()){
27: %>
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.example.Sample.doPost(Sample.java:17)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause
java.lang.ClassCastException: [Ljava.lang.String;
org.apache.jsp.welcome_jsp._jspService(welcome_jsp.java:79)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.example.Sample.doPost(Sample.java:17)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
---------------------------------------------------------------------------
Apache Tomcat/6.0.18
----------------------------------------------------------------------------
IN the servelt (code snippet) :
String[] multiplechoice = request.getParameterValues("toon"); request.setAttribute("choice",multiplechoice); RequestDispatcher view = request.getRequestDispatcher("welcome.jsp");
--------------------------------------------------------------------------- Can someone please help me