File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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!
I agree. Here's the link:
subject: Passing parameters between servlets
It's not a secret anymore!