Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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!