aspose file tools*
The moose likes JSP and the fly likes forward from jsp to servlet in a package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "forward from jsp to servlet in a package" Watch "forward from jsp to servlet in a package" New topic
Author

forward from jsp to servlet in a package

Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Hi,
I have just moved all my servlet classes from the default classes folder into their own packages, but now the jsp files cannot find them!
Please can you tell me what I need to change to make this work:
<jsp:forward page="/servlet/myServlet" />
to find myServlet in the 'peter.myPackage' folder.
Many thanks
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You need to edit your web.xml and update the servlet-class elements to point to the new locations.
Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
Thankyou very much Chris, that works well for forwarding posts etc.
The problem now is that simple 'bean' classes (which just hold data in an object) can't be found from inside the JSP. I have put these into packages too. Any idea how I can get hold of these from the jsps?
Peter Straw
Ranch Hand

Joined: Jan 08, 2002
Posts: 79
please ignore my last post! It's all sorted by using the full path to the class.
Thanks.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
You can also declare imports in JSP so that you do not need to fully qualify every classname.
Example:

[ December 20, 2002: Message edited by: Chris Mathews ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: forward from jsp to servlet in a package