Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

values are not getting transferred from one servlet to another servlet

 
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

 
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>"+
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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".
 
drifter
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.)


 
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
    Bookmark Topic Watch Topic
  • New Topic