| Author |
Reusing Servlet.
|
ryan bohnert
Greenhorn
Joined: Feb 27, 2008
Posts: 15
|
|
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: 12327
|
|
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
|
Java Resources at www.wbrogden.com
|
 |
 |
|
|
subject: Reusing Servlet.
|
|
|