File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to getParameter value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to getParameter value" Watch "How to getParameter value" New topic
Author

How to getParameter value

R Sugan
Ranch Hand

Joined: Mar 13, 2009
Posts: 48
Hi,


I want to get the value of text box from Jsp page into Servlet page.How to get the value.
This is my jsp code



This is my Servlet code Sample.java




I run that code successfully.But i can't get any output.Please help to solve this problem.

Regards,
Suganya.
utsav gupta
Ranch Hand

Joined: Mar 19, 2009
Posts: 57
Hi

I am having exactly the same problem. Are functions like getParameter(),getParameterNames() deprecated?

Please help.
Thanks.
utsav gupta
Ranch Hand

Joined: Mar 19, 2009
Posts: 57
Sugan you didnt mention about the imported packages.

I have imported the following packages in my code.


import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
I think you will need the <Form> element in HTML.

<form action="" method="">
.. have your input text box here
</form>


[SCJP2, SCWCD1.3, SCBCD]
R Sugan
Ranch Hand

Joined: Mar 13, 2009
Posts: 48
Hi Leena,


I have put my text box int <form> element in HTML.But i am getting the same error.Please help me.






Regards,
Suganya
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You need to specify the form action that will handle whatever parameters you are submitting.


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
prasad guna
Ranch Hand

Joined: Feb 12, 2009
Posts: 43

hi

if you get daa's from form you must give name attribute to all input types even checkbox also.


servlet


or


you can use

jsp page..


servlet page


All the best..


Prasath.G
SCJP
R Sugan
Ranch Hand

Joined: Mar 13, 2009
Posts: 48
Hi,

I need to specify the form action the same page of my JSP page.(test.jsp)





Regards,
Suganya
prasad guna
Ranch Hand

Joined: Feb 12, 2009
Posts: 43

hi suganya..

first connect one servlet page then again forward to test.jsp through requestDispatcher class

i give example



this code connect again to your previous page..


Mohamed Inayath
Ranch Hand

Joined: Nov 22, 2004
Posts: 124
Try this html and I believe you already have a Servlet where the request should be submitted.
Change action attribute value of form to the actual one with the context prefixed.

R Sugan
Ranch Hand

Joined: Mar 13, 2009
Posts: 48
Hi,

Actually i have click the radio button and i am able to get the value of radio button into text box at same time and am also get the value of another one text box value when click on the transfer button in different forms.I am able to get the value of radio button in different forms but i am not able to get text box value.


The following code is

test.jsp




This is my ajax coding (Ajax.js).This code is used refresh of database value in every five seconds.



New.jsp





The final one is my Servlet code(Sample.java)






Please help me to solve this problem.




Regards,
Suganya.
utsav gupta
Ranch Hand

Joined: Mar 19, 2009
Posts: 57
My problem got solved by putting the input elements inside the form and configuring its action ..thanks Leena

Leena Diwan
Ranch Hand

Joined: Jun 18, 2001
Posts: 351
Utsav, you are welcome. Nice to know I was of help.

Not sure if "R Sugan" has the problem solved.

-Leena
 
 
subject: How to getParameter value