This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes Passing parameters between servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Passing parameters between servlets" Watch "Passing parameters between servlets" New topic

Passing parameters between servlets

John Ip
Ranch Hand

Joined: Mar 04, 2004
Posts: 45
Hi guys,

I got a situation here.

I have a chain of servlets each doing a part in a registration process.
servlet1 - request user to input a username and password
servlet2 - request user to input details and resume
servlet3 - create user in the datastore and acknowledge the user

At first I pass the parameter in the URL between servlets. Here is how I did.

function next() {
window.url = "servlet3?details=details&resume=resume";

It all works fine, a new servlet3 got initialized and the parameters got across to servlet3. And for some reason I don't want to post any constraint to the size of the resume. Problem comes when the resume is too long which hit the max length limit of the URL allowed by IE. So I try to use HTTP post request instead. Here is my code

function next() {

<form name="details" method="post" action="servlet3">
<input type="text" />

I dunno why this time a new servlet3 didn't get initializied and the parameters post to the servlet2 instead. Does anyone know what will be the problem and other idea to solve my problem? Say cookies..... cookies has a max limit for 4k as fas as I know...... so I am a bit frustrated........

Thanks for your time!
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

Can you just check action property of details before submit? It seems to have wrong value.

Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
John Ip
Ranch Hand

Joined: Mar 04, 2004
Posts: 45
I found the problem. Thanks a lot!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Passing parameters between servlets
Similar Threads
Form Variables
losing POST data during FORM Authentication
URL rewriting
Progress bar on IE6
Servlet Initialization doubt?