| Author |
values are not getting transferred from one servlet to another servlet
|
rakhi sinha
Ranch Hand
Joined: Mar 26, 2012
Posts: 147
|
|
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
Joined: Jun 15, 2011
Posts: 4
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
No you don't. The "id" attribute is only used for JavaScript and CSS. For form submission the "name" attribute is used, not "id".
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
|
|
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
Joined: Jul 27, 2005
Posts: 34
|
|
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
|
 |
 |
|
|
subject: values are not getting transferred from one servlet to another servlet
|
|
|