This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes values are not getting transferred from one servlet to another servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "values are not getting transferred from one servlet to another servlet" Watch "values are not getting transferred from one servlet to another servlet" New topic
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: values are not getting transferred from one servlet to another servlet
 
Similar Threads
Where I am going wrong in the example of JEE6 using @WebServlet
How to execute a java program in a html/jsp page?
regarding servlet mapping
Session tracking with URL rewriting
call Jboss rule from jsp or java servlet