And then I try to use <bean efine> to set the variable and using the jsp code to set the value in <html:text>. <bean efine id="codev" name="countryForm" property="countryview.code" /> <html:text property="code" size="20" maxlength="15" value="<%=codev.toString()%>"/>
It works but when the code is null, it throws an exception.
Have any good method to set the value in <html:text> ?
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
posted
0
The whole point of using an <html:text> tag as opposed to <input type="text"> is so that it will be populated with the value in the form bean. If you just code: <html:text property="countryView.code" maxlength="15" /> Struts will populate the value when the page is renedered. It will also transfer the value from the html parameters to the form bean when the form is submitted.
When using property="countryView.code", will struts render to the text field with name countryView.code ? When I want to retrieve the updated value on the code field in the backend action class, Is it I need to use (DynaActionForm)form).get("countryView.code") rather than (DynaActionForm)form).get("code") ? And do I need to create another validation on field countryView.code ?
Virtually, I want to use <html:text property="code" ....> in the update page same as the insert page so that I retrieve and validate the same "code" field.
Can I use the JSTL to set the value? What tag I can use and how to make my page can use the JSTL tag ? Because the countryForm is the form bean defined in strut-config file, how to access the countryForm attribute from JSTL ? Thanks [ July 15, 2005: Message edited by: Calvin Wong ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to set value in html:text using bean:write