Forums Register Login

class compilation error

+Pie Number of slices to send: Send
using bean i am running following jsp file

but it is giving following error


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: Unable to compile class for JSP:

An error occurred at line: 7 in the jsp file: /jsp/beandata.jsp
R_DESC cannot be resolved
4: <select Description="R_DESC">
5: <option value="Select">Select</option>
6: <%Iterator itr;%><% List data= (List)request.getAttribute("R_DESC");
7: for (itr=R_DESC.iterator(); itr.hasNext(); ){
8: %>
9: <option value="<%=itr.next()%>"></option>
10: <%}%>


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
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)
BeanInServlet.doPost(BeanInServlet.java:18)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:402)
org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:170)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
InfonetFilter.doFilter(InfonetFilter.java:43)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.18

 
+Pie Number of slices to send: Send
the above program is running i have done following changes


but my problem is it is not print anything the dropdown.dropdown is blank
+Pie Number of slices to send: Send
1) You're calling itr.next() twice inside the loop. You shouldn't do that. It moves the iterator forward to the next element. Best case you now get options with every even element (0, 2, 4, ...) as the option values and every odd element as the option labels. Worst case you will get a NoSuchelementException.

2) You should use a <c:forEach> tag for iterating through the List:
But I've already showed you how to do that in your other thread.
+Pie Number of slices to send: Send
 

Rob Spoor wrote:1) You're calling itr.next() twice inside the loop. You shouldn't do that. It moves the iterator forward to the next element. Best case you now get options with every even element (0, 2, 4, ...) as the option values and every odd element as the option labels. Worst case you will get a NoSuchelementException.

2) You should use a <c:forEach> tag for iterating through the List:
But I've already showed you how to do that in your other thread.



but now it is showing "${item}" in the dropdown.
i have used followin code in servlet

and also replace item in following code


+Pie Number of slices to send: Send
Then EL is disabled. Are you perhaps using servlet specification 2.3 inside your web.xml? If so, I suggest you consider switching to at least 2.4, but preferably 2.5 or even 3.0.
today's feeble attempt to support the empire
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1695 times.
Similar Threads
problem calling servlet to build a list of data from a database and display a jsp page
http error?
Suddenly stopped working
I got http-500 error in servlet and jsp.how to find error?
Unable to compile class for JSP
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:16:16.