struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felipe Lorenz" <>
Subject Re: [S2] Checkbox problem
Date Wed, 20 Aug 2008 23:31:52 GMT
Hi... you can do tag in another tag... cause its a recursive, and ....
well.. Dave can explain better why!! ehehheh sorry.. my english is not

But you can try create a new boolean attribute in you action class and
"tranform" the bd type ("Y"/"N") to a boolean type (true/false)..


<s:if test="ticket.ccUpdateFlag='Y'">
  <s:checkbox theme="simple" name="ticket.ccUpdateFlag"
id="ticket.ccUpdateFlag" value="true" />
  <s:checkbox theme="simple" name="ticket.ccUpdateFlag"
id="ticket.ccUpdateFlag" value="false" />

Good luke.

On Wed, Aug 20, 2008 at 5:02 PM, Struts Two <> wrote:
> I have a checkbox as follows in a jsp:
> <s:checkbox theme="simple" name="ticket.ccUpdateFlag" id="ticket.ccUpdateFlag" />
> Once a user selects the checkbox and submits the form,  ccUpdateFlag is set to true.
However, on the database side the value is stored as 'Y' or 'N' . So my getCcUpdateFlag returns
'Y' or 'N' depending on the fact ccUpdateFlag is set to true or false.
> Now on a different page (say update/vie page), I have the same exact check box. I have
been trying to map 'Y' to "fieldValue=true" unsuccessfully so far. I have tried the followings:
> <s:checkbox theme="simple" name="ticket.ccUpdateFlag" id="ticket.ccUpdateFlag" <s:if
test="ticket.ccUpdateFlag='Y'">filedValue="true"</s:if>  />
> This breaks the page and the page does not even compile, I get  invalid jsp exception..
> I then went to my bean and added the following method:
>  public boolean isCCUpate(){
>   return "Y".equals(getCcUpdateFlag());
>  }
> I then tried to use the following:
> <s:checkbox theme="simple" name="ticket.ccUpdateFlag" id="ticket.ccUpdateFlag" fieldValue="<s:property
value='ticket.CCUpate'/>" />
> This would also fail, looking at generated html, here is what is generated:
> <input type="checkbox" name="ticket.ccUpdateFlag" value="&lt;s:property value='ticket.CCUpate'/&gt;"
> <input type="hidden" name="__checkbox_ticket.ccUpdateFlag" value="&lt;s:property
value='ticket.CCUpate'/&gt;" />
> Is there a way that I can have checkbox fieldValue="true" if  "ticket.ccUpdateflag ==
>      __________________________________________________________________
> Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message