File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Cattle Drive and the fly likes Accessing a jsp through a servlet problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Accessing a jsp through a servlet problem" Watch "Accessing a jsp through a servlet problem" New topic
Author

Accessing a jsp through a servlet problem

Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
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!
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9043
    
  10
Do you have an "action" in your servlet that matches the "action" in the url? Otherwise, the servlet will do the "default" action.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Matt Fry
Ranch Hand

Joined: Mar 06, 2006
Posts: 60
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing a jsp through a servlet problem
 
Similar Threads
Re: Assignment Servlets-4a Videos
doGet() but I don'tGet()
Breaking the path roadblock....
Servlets-4b cookie question
Servlets 4a blocked