Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
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: 19656
    
  18

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
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://aspose.com/file-tools
 
subject: values are not getting transferred from one servlet to another servlet
 
Similar Threads
How to execute a java program in a html/jsp page?
Where I am going wrong in the example of JEE6 using @WebServlet
Session tracking with URL rewriting
regarding servlet mapping
call Jboss rule from jsp or java servlet