• Post Reply Bookmark Topic Watch Topic
  • New Topic

set req attr in jsp from a text field

 
Sam Venkata
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I wanted to know if it is possible to set a value entered in a text box to be set in a request as a request attribute in the jsp itself while submitting. What I mean is this :
I have user name and password fields that the user enters and there are two links to login and registration. If he clicks registration instead of login I want to be able to populate the user name and the password fields in the registration page instead of the user typing it again.
I wanted to know what is the value that I need to set in the request attribute so that the user name entered in the text field is set in the request attribute.
I wanted to know if it is possible?


Thanks,
Samanth.
 
Scott Duncan
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assuming your text fields are posted in a form and your link is actually submitting the form, then the values are already in the request (as parameters). This is the way you should do it IMO. You can change the action of the form with javascript when the user clicks the link, depending on which link they click on. You can then use javascript to submit the form.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Samanth Marisetty:
set req attr in jsp

Please use real words when posting to the forums. Abbreviations such as "req" in place of "request" and "attr" in place of "attribute" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to know what is the value that I need to set in the request attribute so that the user name entered in the text field is set in the request attribute.
There is no magic value that can make this happen, you need to code it yourself. In the case that you mention, simply put the information on the request before forwarding to the page, and have the JSP on the page populate the value attribute of the text fields.
[ February 25, 2008: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!