• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to getParameter value

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.*;
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to specify the form action that will handle whatever parameters you are submitting.
 
Ranch Hand
Posts: 46
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..


 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Eliminate 95% of the weeds in your lawn by mowing 3 inches or higher. Then plant tiny ads:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic