Author
Having problem with JSP 2 custom tag.
Justin Howard
Ranch Hand
Joined: Feb 19, 2009
Messages: 132
posted Jul 02, 2009 08:38:45
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
posted Jul 02, 2009 08:40:38
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
posted Jul 02, 2009 08:52:45
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
posted Jul 02, 2009 09:07:51
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
posted Jul 02, 2009 09:53:38
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
posted Jul 02, 2009 10:00:31
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
posted Jul 02, 2009 10:04:38
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 Jul 02, 2009 10:13:27 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
posted Jul 02, 2009 10:06:14
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
posted Jul 02, 2009 10:30:54
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
posted Jul 02, 2009 10:34:52
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
posted Jul 06, 2009 08:56:03
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 Jul 06, 2009 09:14:01 by Justin Howard