Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reusing Servlet.

 
ryan bohnert
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic