• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

values are not getting transferred from one servlet to another servlet

 
rakhi sinha
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my first servlet is this.....


My second servlet is this


but the value getting printed by underlined line is null...textbox value is not going from first servlet to second servlet

 
Georges Salameh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to assign an ID in addition to the name for the element pass_phrase in your first servlet

"<input type=\"text\" id=\"pass_phrase\" name=\"pass_phrase\" /></center></p>"+
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No you don't. The "id" attribute is only used for JavaScript and CSS. For form submission the "name" attribute is used, not "id".
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice your form is for file upload with enctype="multipart/form-data"...


From the File Upload FAQ :

The Servlet and JSP specs do not make any special provisions for multipart requests (file uploads).

Servlet and JSP developers either have to depend on third party libraries or make their own framework for this. Fabricating own framework is just like re-inventing the wheel. Fortunately, there are several, very good, open source ones out there; with clear instructions and code examples.

The two most popular are Jakarta Commons FileUpload and com.oreilly.servlet

(Note: request.getParameter() would always return null when dealing with multipart/form-data.)

 
Nauman Hasan
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should consider a JSP to output all the HTML. It will make it much easier to both learn and debug. Also, that is how most Servlet / JSP development is done

Good luck!

~Nauman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic