• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

how to get the text box value

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i having problem with pass the jsp text box value to java file.....
for example...i have one text box name is CountryName.....how i want to pass the value keyin in the text box to java file....i only can pass the value from i only can pass the value from add.jsp to add1.jsp.....

This is add.jsp
----------------------------------------------------------


-----------------------------------------------------
Problem
1. i want to know how to pass the value in the text box to java file/method.


------------------------------
add1.jsp
---------------------------------
when in add1.jsp...i click on save, i need to pass in the text box value into the java file...
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
using scriplet for example...
this is code of small page which receives & prints posted data


by the way...

Originally posted by Mag Yeoh:



your form will submit data regardles of pressed button...
try this way:


Natasza
[ October 30, 2006: Message edited by: Natasza Biecek ]
 
Mag Yeoh
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
now i having problem is i cannot pass the text box value to the java method...
when i click save that time i having error.....can you help me lot of my code....

----------------
add.jsp
----------------


--------------------------
add2.jsp
-------------------------


--------------------------
Country.java
---------------------------

--------------------------------------------

when i click on save button in add2.jsp that time i cannot run the method in Country.java file....actually after i click save button in add2.jsp, i need to run the setData method in the java file....but how can i pass the countryName and countryPopulation to run inside the setData method....

Thanks....
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the parameters are only submitted from add1.jsp to add2.jsp.
They are not present when you submit add2.jsp (you have no inputs on the form on add2.jsp)

Solutions
1 - Make country a Session scoped bean. That means it will retain values between requests
2 - Put hidden fields on add2.jsp so that the parameters will resubmit themselves

ie
 
Mag Yeoh
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it is possible that i only use 2 page of jsp file???when i click on the save button it will display the successful save data in the second page......

base on my coding it is possible to do that....
sorry for late reply....
Thanks a lot...
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you need is a good book or a nice tutorial of Servet and JSP.
 
reply
    Bookmark Topic Watch Topic
  • New Topic