VOTG
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of Flex 4 in Action this week in the Flex forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
Author

Having problem with JSP 2 custom tag.

Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Messages: 132

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 opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36550

I assume that class file is in the right place?

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
David Newton
Author
Bartender

Joined: Sep 29, 2008
Messages: 6783

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

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Messages: 132



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
Bartender

Joined: Sep 29, 2008
Messages: 6783

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 <tt>web.xml</tt>?

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Messages: 132

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 opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36550

The doStartTag method is for classic handlers, not Simple tags.

Let's get back to the correct doTag() method. What happens then?

This message was edited 1 time. Last update was at by Bear Bibeault


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
David Newton
Author
Bartender

Joined: Sep 29, 2008
Messages: 6783

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

Consultant/Trainer | Polyglottal Developer | Struts Committer/PMC | Struts 2 Web Application Development
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Messages: 132

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 opinionated walrus
Sheriff

Joined: Jan 10, 2002
Messages: 36550

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

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Justin Howard
Ranch Hand

Joined: Feb 19, 2009
Messages: 132

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

This message was edited 1 time. Last update was at by Justin Howard

 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » JSP
 
RSS feed
 
New topic
replay challenge

.