Win a copy of Securing DevOps this week in the Security forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Seeting default value in form input tags  RSS feed

 
Ranch Hand
Posts: 78
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have form input tags ...
I want to set a default value such as ${UserName} to it .
Please suggest . i could not find any way out .
 
ranger
Sheriff
Posts: 17314
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

jas preet wrote:I have form input tags ...
I want to set a default value such as ${UserName} to it .
Please suggest . i could not find any way out .



In the request for the form in the first place, the Get add the object to the Model.

Usually you have a Controller with multiple methods. One method is mapped to the GET request and one to the POST request.

In the GET request method add the backing object of the form to the Model and return it.

Then in the jsp web page use ${backingBean.propertyName}, then when the submit button is mapped to the POST method the backingBean passed in as a request parameter you can access the values through that parameter object.

Mark
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!