Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

problem with html:text prpperty value=bean:write

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to show values in the text box for editing purpose. I'm able to get & show the value using <bean:write> tag. But i can't assign the value to text box. If i use like below code it's showing the full <bean:write> tag as String. <html:text property="userName" value='<bean:write name= "user" property="userName"/>'/>
pls help me regarding this.

Thanks
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The whole point of using an html:text tag as opposed to <input type="text"> is so that the input element will be populated with the value of the corresponding property of the ActionForm bean. If you provide no value attribute, struts does this automatically.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Had the same problem as above. Tried various combinations of double and single quotes...but same error persisted. As Merrill suggested, removed the value attribute in the html:text tag and voila....the value the ActionForm already holding was displayed as default text in the html:text. Gr8.
And if we dont want to have any default text value to be displayed in the jsp, jus set the text property in the ActionForm to null, using the setter method.
Eg. user.setUserName(null); Or, can set the text property to null in the reset method.

Cheers!
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic