You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bugs_ <bu...@centrum.cz> on 2008/03/17 12:18:01 UTC
[S2] Calling getMethod with parametr
In Struts 1 is this:
In the ActionForm is this method:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
In the jsp page is:
<html:checkbox property="<%=propertyName%>" styleClass="textinput"/>
<%=propertyName%> is for example
"technologyCheckbox(thermal_desorption)"
so as result it render:
<input type="checkbox" name="technologyCheckbox(thermal_desorption)"
value="on"
checked="checked" class="textinput">
It call method getTechnologyCheckbox("thermal_desorption") from
ActionForm, and it works fine.
I need rewrite this in Struts 2.
In Struts 2 action I have methods:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
public boolean isTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
In jsp page i have:
<s:checkbox name="%{#attr.propertyName}" cssClass="textinput" />
so as result it render for example:
<input type="checkbox" name="technologyCheckbox(thermal_desorption)"
value="true"
id="technologies_technologyCheckbox(thermal_desorption)"
class="textinput"/>
But this doesn't work. It never call method
getTechnologyCheckbox("thermal_desorption") or
isTechnologyCheckbox("thermal_desorption").
That's why chech box is never checked.
Please. Can anybody help me?
--
View this message in context: http://www.nabble.com/-S2--Calling-getMethod-with-parametr-tp16092039p16092039.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org