Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

create a new servlet in struts

 
pingkan paula
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic