aspose file tools*
The moose likes JSP and the fly likes Having problem with JSP 2 custom tag. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Having problem with JSP 2 custom tag." Watch "Having problem with JSP 2 custom tag." New topic
Author

Having problem with JSP 2 custom tag.

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
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

Joined: Jan 10, 2002
Posts: 61216
    
  66

I assume that class file is in the right place?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It'd be easier to help if you explicitly stated what class isn't being found.
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162


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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Feb 19, 2009
Posts: 162
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

Joined: Jan 10, 2002
Posts: 61216
    
  66

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

Joined: Sep 29, 2008
Posts: 12617

Check the TC log files for the compilation error; I don't see anything immediately obvious.
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
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

Joined: Jan 10, 2002
Posts: 61216
    
  66

You didn't, by any chance, place a copy of jsp-api.jar in your WEB-INF/lib, did you?
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Posts: 162
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Having problem with JSP 2 custom tag.