Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having problem with JSP 2 custom tag.

 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I use Tomcat 6. I am trying to write a custom tag. When I run this tag I get java.lang.ClassNotFoundException.
I am not sure what I am doing wrong here. Any help is appreciated.
Tag Class::


TLD File::

JSP::

I have not put anthing in the web.xml since in JSP 2 we do not need the entry in web.xml

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that class file is in the right place?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It'd be easier to help if you explicitly stated what class isn't being found.
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


When I give doTag() in the tag class, when I run the jsp I get doStartTag() method is required error.
If I change that to doStartTag() method I get java.lang.ClassNotFoundException: org.apache.jsp.test_jsp
problem finding the compiled jsp.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know there's already date formatting stuff in JSTL, right? Weird name for a date formatting tag.

What DTD are you using in your web.xml?
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.

This is just one of the parameters for the tag. Once I get this working I want to build on it with more parameters and complex logic.



Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The doStartTag method is for classic handlers, not Simple tags.

Let's get back to the correct doTag() method. What happens then?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the TC log files for the compilation error; I don't see anything immediately obvious.
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I give doTag() method, return type void.
When I run the jsp I get a compilation error that the doStartTag() must be implemented.

Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65226
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't, by any chance, place a copy of jsp-api.jar in your WEB-INF/lib, did you?
 
Justin Howard
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way I can get it to compile is when I put jsp-api.jar in WEB-INF/lib.

What else should I use?

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic