File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to getParameter value

 
R Sugan
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

Please help.
Thanks.
 
utsav gupta
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 351
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you will need the <Form> element in HTML.

<form action="" method="">
.. have your input text box here
</form>
 
R Sugan
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to specify the form action that will handle whatever parameters you are submitting.
 
prasad guna
Ranch Hand
Posts: 46
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
R Sugan
Ranch Hand
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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





Regards,
Suganya
 
prasad guna
Ranch Hand
Posts: 46
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 124
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem got solved by putting the input elements inside the form and configuring its action ..thanks Leena

 
Leena Diwan
Ranch Hand
Posts: 351
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Utsav, you are welcome. Nice to know I was of help.

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

-Leena
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic