• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call one textfield to another textfield

 
vaduganathan kumarasamy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i need one clarification in strut 2.

I have 2 fields , RollNumber and Name. I inserted 2 fields values to table directly. In jsp page i have a two textbox

rollnumber and name. if i will give input rollnumber that matched for table RollNumber field means corresponding name displayed

for Name textfield, the name textfield fill when focus comes not submitting the submit button.

 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay so as I understand it, you have a table which has roll number and name fields. Now in your JSP, you want that when a roll number is entered, then the corresponding name should be automatically filled without submitting the page. This can be done using AJAX, you just need to make an AJAX call to an action which will search the database for the roll number and return the name found...
 
vaduganathan kumarasamy
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please send any example code or any link...... I searched but i didn't find any ajax related links..
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You won't find an example exactly for what you want, look at a tutorial like this or this on how to make an ajax call. The server side code of the Action would be just like a normal Action, you'll have to send a very small response that will contain the name for the corresponding roll number. For this you can directly get the ServletResponse object into your action and send this response (or you can use a servlet for this too )...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic