You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian Trzupek <bt...@mac.com> on 2007/05/31 17:08:27 UTC

OptionTransfer Select - id number formatting

I am using the optionTransferSelect tag all over the place, love this  
control!

Anyways, when the id property of list (which is an int) gets  
displayed in the HTML by the tag the number get formatted with a  
comma when the numbers get into 4+ digits.

Example output:

     <option value="2,451">email@email.com</option>

     <option value="2,452">email2@email.com</option>

When the list is set on my Action class the values come back as  
strings with the comma in it and then when I pass them to my DAO it  
fails to load b/c it is not parsing the number ( new Integer(value) )  
correctly.

My question is, why is the control outputting a 'formatted' number?  
and is there a way to 'turn that off'?

I would prefer a solution that will globally tell the tag to render  
the values without the formatting, rather than have to parse them in  
every action where I have a list coming back in.

Any Ideas?

Thanks Brian-

--- Here is my jsp tag ----

<s:optiontransferselect
                         label="%{getText('item.notifications')}"
                         name="leftsidesystemUsers"
                         rightTitle="Users Notified"
                         leftTitle="System User List"
                         list="%{systemUsers}"
                         listValue="email"
                         listKey="id"
                         allowAddToLeft="true"
                         allowAddAllToLeft="true"
                         allowUpDownOnLeft="true"

                         multiple="true"
                         headerKey="headerKey"
                         headerValue="--- Please Select ---"
                         emptyOption="true"
                         doubleId="id"
                         doubleList="%{notificationUsers}"
                         doubleListValue="email"
                         doubleListKey="id"
                         doubleName="notificationUsers"
                         doubleHeaderKey="doubleHeaderKey"
                         doubleHeaderValue="--- Please Select ---"
                         doubleEmptyOption="true"
                         doubleMultiple="true"
                     />

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: OptionTransfer Select - id number formatting

Posted by Brian Trzupek <bt...@mac.com>.
I figured this out.

All I did was change the method signature on my Action class from:

setNotificationUsers(Collection notificationUsers)

to

setNotificationUsers(Collection<Integer> notificationUsers)

And Struts/XWork took care of the rest.

Brian-


On May 31, 2007, at 10:08 AM, Brian Trzupek wrote:

> I am using the optionTransferSelect tag all over the place, love  
> this control!
>
> Anyways, when the id property of list (which is an int) gets  
> displayed in the HTML by the tag the number get formatted with a  
> comma when the numbers get into 4+ digits.
>
> Example output:
>
>     <option value="2,451">email@email.com</option>
>
>     <option value="2,452">email2@email.com</option>
>
> When the list is set on my Action class the values come back as  
> strings with the comma in it and then when I pass them to my DAO it  
> fails to load b/c it is not parsing the number ( new Integer 
> (value) ) correctly.
>
> My question is, why is the control outputting a 'formatted' number?  
> and is there a way to 'turn that off'?
>
> I would prefer a solution that will globally tell the tag to render  
> the values without the formatting, rather than have to parse them  
> in every action where I have a list coming back in.
>
> Any Ideas?
>
> Thanks Brian-
>
> --- Here is my jsp tag ----
>
> <s:optiontransferselect
>                         label="%{getText('item.notifications')}"
>                         name="leftsidesystemUsers"
>                         rightTitle="Users Notified"
>                         leftTitle="System User List"
>                         list="%{systemUsers}"
>                         listValue="email"
>                         listKey="id"
>                         allowAddToLeft="true"
>                         allowAddAllToLeft="true"
>                         allowUpDownOnLeft="true"
>
>                         multiple="true"
>                         headerKey="headerKey"
>                         headerValue="--- Please Select ---"
>                         emptyOption="true"
>                         doubleId="id"
>                         doubleList="%{notificationUsers}"
>                         doubleListValue="email"
>                         doubleListKey="id"
>                         doubleName="notificationUsers"
>                         doubleHeaderKey="doubleHeaderKey"
>                         doubleHeaderValue="--- Please Select ---"
>                         doubleEmptyOption="true"
>                         doubleMultiple="true"
>                     />
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: OptionTransfer Select - id number formatting

Posted by Al Sutton <al...@al-and-andrea.org.uk>.
Had the same problem recently, the choice I made was to make the parameter
for the second action the same type as the parameter for the first, i.e.;

ActionA has public Integer getValue()
ActionB has public setValue(Integer x)

Worked for me with Longs.

-----Original Message-----
From: Brian Trzupek [mailto:btrzupek43@mac.com] 
Sent: 31 May 2007 16:08
To: Struts Users Mailing List
Subject: OptionTransfer Select - id number formatting

I am using the optionTransferSelect tag all over the place, love this
control!

Anyways, when the id property of list (which is an int) gets displayed in
the HTML by the tag the number get formatted with a comma when the numbers
get into 4+ digits.

Example output:

     <option value="2,451">email@email.com</option>

     <option value="2,452">email2@email.com</option>

When the list is set on my Action class the values come back as strings with
the comma in it and then when I pass them to my DAO it fails to load b/c it
is not parsing the number ( new Integer(value) ) correctly.

My question is, why is the control outputting a 'formatted' number?  
and is there a way to 'turn that off'?

I would prefer a solution that will globally tell the tag to render the
values without the formatting, rather than have to parse them in every
action where I have a list coming back in.

Any Ideas?

Thanks Brian-

--- Here is my jsp tag ----

<s:optiontransferselect
                         label="%{getText('item.notifications')}"
                         name="leftsidesystemUsers"
                         rightTitle="Users Notified"
                         leftTitle="System User List"
                         list="%{systemUsers}"
                         listValue="email"
                         listKey="id"
                         allowAddToLeft="true"
                         allowAddAllToLeft="true"
                         allowUpDownOnLeft="true"

                         multiple="true"
                         headerKey="headerKey"
                         headerValue="--- Please Select ---"
                         emptyOption="true"
                         doubleId="id"
                         doubleList="%{notificationUsers}"
                         doubleListValue="email"
                         doubleListKey="id"
                         doubleName="notificationUsers"
                         doubleHeaderKey="doubleHeaderKey"
                         doubleHeaderValue="--- Please Select ---"
                         doubleEmptyOption="true"
                         doubleMultiple="true"
                     />

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org