• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Accessing a jsp through a servlet problem

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy all. I got this nitpick back a few days ago:

Rather than going directly to the jsp, you should make all your access to jsp pages pass through the servlet. Your URL should look something like this:

/videos/servlet/VideoServlet?action=addvideo



OK. I've tried this and can't get it to work. Perhaps because I don't fully understand what it's doing, maybe (I don't remember reading much about it in Head First Servlets & JSP). But anyway, all it does when I write the URL like that is to reload the listvideos.jsp page (which is where this link is written). I can't seem to get it to load the addvideo.jsp page no matter how I write the URL (I've tried .../VideoServlet?action=addvideo.jsp, .../VideoServlet?action=addvideo, .../VideoServlet?forward=addvideo.jsp, etc.).

Any suggestions, help, advise, etc would be greatly appreciated. Thanks!
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have an "action" in your servlet that matches the "action" in the url? Otherwise, the servlet will do the "default" action.
 
Matt Fry
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Man, that was a tough one (for me anyways). Had to dig a little bit but learned several things I didn't know and had just taken for granted. Thanks!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic