tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rhino" <>
Subject Basic Question re Servlets
Date Thu, 15 May 2003 21:13:08 GMT
Is it possible for a servlet that is displaying an input form to have another input form as
its action?

I have a dynamically generated form that is essentially a menu. It is presented to the user
via a doGet() in a servlet called MenuServlet. Most of the options on my menu take the user
to another servlet, ReportGeneratorServlet, which handles the input provided on the menu within
a doPost(). All of that works just fine.

I would like one of the options on my menu to take the user to another dynamically generated
input form, displayed via a doGet() in another servlet, RequestForm. The user will complete
this second form and its action will be yet another servlet, RequestHandler, within its own

When I invoke the option that should take me to RequestForm, MenuServlet displays RequestForm
just fine. I fill in the fields on the RequestForm and press its submit button without any
difficulty. However, when RequestHandler tries to read the data on RequestForm, it sees no
parameters at all. I am using request.getParameter() for each of the fields on RequestForm
and every one of them comes back with a null; request.getParameterNames() also fails to find
any parameters, despite the fact that there are 26 different parameters on RequestForm. 

Am I trying to do something that is fundamentally impossible via the existing servlet architecture
or do I simply have a bug in my code? I haven't been able to find any obvious bugs so I just
want to make sure there is nothing wrong with my basic approach.

Assuming that the concept behind what I'm doing is legitimate, is this the correct way for
MenuServlet to invoke RequestForm?
//MenuServlet's doGet() method....

RequestForm myRequest = new RequestForm();
myRequest.doGet(request, response); 

In other words, I simply pass the request and response parameters from MenuServlet's doGet()
to RequestForm's doGet(). This was the only way I could think of to make MenuServlet invoke

I am using Tomcat 4.1.24 in Eclipse 2.1 (RC) using Sysdeo V2.1. I am running Windows XP Pro
as my OS.

rhino1 AT sympatico DOT ca
"If you want the best seat in the house, you'll have to move the cat."
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message