It's not a secret anymore!*
The moose likes Struts and the fly likes how to combine html:text and bean:write Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to combine html:text and bean:write" Watch "how to combine html:text and bean:write" New topic

how to combine html:text and bean:write

surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
My view is a jsp page which has a table whose fields are text boxes. each cell in the table is a text box. now i want present them with an initial value that i have retrieved from data base.

can i have

<html:text property="author" value= <bean:write id="" property="">

the bean tag is populated by a collection that is available in my actionform.

my code is working with
<input type=text value="<bean:write name='bookForm' property='author' />">

please tell me can i have the same with <html:text>

SCJP 1.4
Shilpa Tendulkar
Ranch Hand

Joined: Jul 29, 2001
Posts: 75
Hi , if your form elements are associate with bean, then value of those elements will be populated directly. you dont have to specify the value.
You just have to use:
<html:form action="someaction" name="formbean">
<html:text property="propname"/>
[ August 18, 2006: Message edited by: Shilpa Tendulkar ]

Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
In this situation, you would want to use "indexed properties". Here is a link explaining how indexed properties work. Also see this thread.

Consultant, Sima Solutions
surendar prabu
Ranch Hand

Joined: Jul 24, 2006
Posts: 102
Thanks Shilpa and merill.

But, in this

<html:form action="someaction" name="formbean">
<html:text property="propname"/>

the <html:form> tag does not have "name" attribute.
this is resolved by the <logic:iterate name="formbean">
It is sorta covered in the JavaRanch Style Guide.
subject: how to combine html:text and bean:write
Similar Threads
how to track?
Problem in bean:write inside the html:text value
help:bean:write value from bean
Struts: No getter method for property name problem
Cookies and Struts