File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes how to call one textfield to another textfield Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to call one textfield to another textfield" Watch "how to call one textfield to another textfield" New topic
Author

how to call one textfield to another textfield

vaduganathan kumarasamy
Greenhorn

Joined: Oct 26, 2009
Posts: 8
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

Joined: Aug 03, 2008
Posts: 9280
    
  17

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
vaduganathan kumarasamy
Greenhorn

Joined: Oct 26, 2009
Posts: 8
Please send any example code or any link...... I searched but i didn't find any ajax related links..
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

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 )...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call one textfield to another textfield
 
Similar Threads
disable other textfield as one textfield entered
getting NullPointerException
How to convert this into a form?
java code to create a folder and save a text file in it..!!
mutiple record validate