Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL function example from Hanumant Deshmukh

 
saima kanwal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I m trying to do the example of EL from SCWCD Hanumant Deshmukh with litt;e modification. I tried it using a simple web app. I am unable to get the response. I am getting this error:

HTTP Status 500

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 13 in the generated java file
StrMethods cannot be resolved to a type

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:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
TestELServlet.doGet(TestELServlet.java:10)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
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.24 logs.

My index.html is :



My servlet code is :



my method java file is:



My .tld file is:



and my result.jsp is :



Can anyone tell me what mistake I am making and why am I getting this error?
 
Ankit Garg
Sheriff
Posts: 9521
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Putting Servlet or Tag or EL function classes in default package is not a very good idea. Add a package statement to your StrMethods class, use the fully qualified name of the class in the tld file and then try again (also put your servlet in a package as it might create problems in the future)...
 
saima kanwal
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ankit. It is working now , after putting these files in a package (as suggested by you).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic