permaculture playing cards
The moose likes Struts and the fly likes create a new servlet in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "create a new servlet in struts" Watch "create a new servlet in struts" New topic

create a new servlet in struts

pingkan paula
Ranch Hand

Joined: Sep 03, 2004
Posts: 117
I'm new to struts and I want to create a new servlet which will print jsp pages into PDF format. My question is, do i have to put the servlet code in /lib directory or can I just place it in the source directory?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
As long as you declare the servlet in your web.xml file, the class files can be anywhere in your class path. That means they could either be in a jar file in the WEB-INF/lib directory, or they could be in WEB-INF/classes along with all your other classes.

Something you might want to consider would be to put this functionality in a Struts Action rather than a servlet. An Action can do pretty much anything a servlet can do, and using Actions rather than Servlets in a Struts application is a more consistent architectural choice.

Consultant, Sima Solutions
I agree. Here's the link:
subject: create a new servlet in struts
It's not a secret anymore!