Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learn Spring Security (video course) this week in the Spring 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic