This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Reusing Servlet. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Reusing Servlet." Watch "Reusing Servlet." New topic
Author

Reusing Servlet.

ryan bohnert
Greenhorn

Joined: Feb 27, 2008
Posts: 19
I have an index page that uses a servlet called ApplServlet(gets a list of all applications) and forwards to the appl.jsp(displays all application names). Inside the appl.jsp, when I display the application names inside a form I allow the user to select buttons such as New (new applicaiton), View(view application details), Edit(edit details of the application), and Delete (delete application). All the buttons have name=actn. Once a button is selected it calls the same ApplServlet. I can see once the button is selected the value is passed in the url Appl?actn=New. The problem is when i try to read the URL variable using getParameter, it's always null.

First question, why is the parameter null?

Second question, is it okay for a servlet to forward to different JSP's? Ex. If actn=New, then forward to applNew.jsp, Else If actnView, then forward to applView.jsp, and so on.

thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
First question, why is the parameter null?

Second question, is it okay for a servlet to forward to different JSP's? Ex. If actn=New, then forward to applNew.jsp, Else If actnView, then forward to applView.jsp, and so on.


1. most likely explanation - the name is not exactly matching - case? If this was my problem I would use the request method getParameterNames to see what names are being parsed out of the request.

2. OK? If it works, why not - sounds like a typical front controller.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reusing Servlet.
 
Similar Threads
Inserting, Editing, deleting rows in JTable
Swing GUI Interface Question
IBM Exam 157 - Questions and Answers (Sample Exam)
Someone Must Have an Example Like This!
How to find to which row is selected?