This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes EL function example from Hanumant Deshmukh Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "EL function example from Hanumant Deshmukh" Watch "EL function example from Hanumant Deshmukh" New topic

EL function example from Hanumant Deshmukh

saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
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


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?

SCJP 6.0 (86%) SCWCD 5 (94%)
Ankit Garg

Joined: Aug 03, 2008
Posts: 9466

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)...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
saima kanwal
Ranch Hand

Joined: Oct 05, 2009
Posts: 148
Thanks Ankit. It is working now , after putting these files in a package (as suggested by you).
I agree. Here's the link:
subject: EL function example from Hanumant Deshmukh
It's not a secret anymore!