You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andriy Kharchuk <an...@gmail.com> on 2008/01/28 22:14:47 UTC

Struts 2: Can not set Action's property which is an array of Strings

Hi guys,

My Action has property which is an array of Strings. I'm rendering html
table using this property. What is correct way to update this property from
jsp?

I tried the following but it doesn't work:

1. JSP
<s:iterator value="entityList" status="rowstatus">
    <s:textfield name="selectedItems[%{#rowstatus.index}]"/>

2. Action
    private String[] selectedItems;

    public String[] getSelectedItems(){
        return selectedItems;
    }

    public void setSelectedItems(String[] selectedItems){
        this.selectedItems = selectedItems;
    }

Exception is
[ERROR] 23:11:16,750 InstantiatingNullHandler | Could not create and/or set
value back on to object |
com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(
InstantiatingNullHandler.java:110)| nullPropertyValue
java.lang.InstantiationException: [Ljava.lang.String;
    at java.lang.Class.newInstance0(Unknown Source)

I will appreciate any help.

Thanks,
Andriy

Re: Struts 2: Can not set Action's property which is an array of Strings

Posted by st...@gmail.com.
Maybe you should consider buying an off-the-shelf web application or slowing
down a little to read the documentation.  Popping in and asking for snippets
of code for this and a sample file to do that only shows that you are
looking for someone else to do your work.  Have you searched *this* mailing
list using nabble.com?  Perhaps this question has been answered already.

On Thu, Oct 23, 2008 at 4:04 PM, MyAshok <ta...@gmail.com> wrote:

>
> Andriy,
>
> Can u give me the sample code snippet to get the array value from jsp.
>
> With Regards,
> MYAshok
>
>
>
> Andriy Kharchuk wrote:
> >
> > It helped. Thank you.
> >
> > 2008/1/28, Hernandez, David <da...@lehman.com>:
> >>
> >>
> >> Andriy,
> >>
> >> Try putting the array in an encapsulating object, i.e. an ArrayList.
> >>
> >> Regards,
> >>
> >> David Hernandez
> >>
> >> -----Original Message-----
> >> From: Andriy Kharchuk [mailto:andriy.kharchuk@gmail.com]
> >> Sent: Monday, January 28, 2008 4:15 PM
> >> To: Struts Users Mailing List
> >> Subject: Struts 2: Can not set Action's property which is an array of
> >> Strings
> >>
> >> Hi guys,
> >>
> >> My Action has property which is an array of Strings. I'm rendering html
> >> table using this property. What is correct way to update this property
> >> from jsp?
> >>
> >> I tried the following but it doesn't work:
> >>
> >> 1. JSP
> >> <s:iterator value="entityList" status="rowstatus">
> >>     <s:textfield name="selectedItems[%{#rowstatus.index}]"/>
> >>
> >> 2. Action
> >>     private String[] selectedItems;
> >>
> >>     public String[] getSelectedItems(){
> >>         return selectedItems;
> >>     }
> >>
> >>     public void setSelectedItems(String[] selectedItems){
> >>         this.selectedItems = selectedItems;
> >>     }
> >>
> >> Exception is
> >> [ERROR] 23:11:16,750 InstantiatingNullHandler | Could not create and/or
> >> set value back on to object |
> >> com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(
> >> InstantiatingNullHandler.java:110)| nullPropertyValue
> >> java.lang.InstantiationException: [Ljava.lang.String;
> >>     at java.lang.Class.newInstance0(Unknown Source)
> >>
> >> I will appreciate any help.
> >>
> >> Thanks,
> >> Andriy
> >> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> -
> >> - - - - - - -
> >>
> >> This message is intended only for the personal and confidential use of
> >> the
> >> designated recipient(s) named above.  If you are not the intended
> >> recipient
> >> of this message you are hereby notified that any review, dissemination,
> >> distribution or copying of this message is strictly prohibited.  This
> >> communication is for information purposes only and should not be
> regarded
> >> as
> >> an offer to sell or as a solicitation of an offer to buy any financial
> >> product, an official confirmation of any transaction, or as an official
> >> statement of Lehman Brothers.  Email transmission cannot be guaranteed
> to
> >> be
> >> secure or error-free.  Therefore, we do not represent that this
> >> information
> >> is complete or accurate and it should not be relied upon as such.  All
> >> information is subject to change without notice.
> >>
> >> --------
> >> IRS Circular 230 Disclosure:
> >> Please be advised that any discussion of U.S. tax matters contained
> >> within
> >> this communication (including any attachments) is not intended or
> written
> >> to
> >> be used and cannot be used for the purpose of (i) avoiding U.S. tax
> >> related penalties or (ii) promoting, marketing or recommending to
> another
> >> party any transaction or matter addressed herein.
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Struts-2%3A-Can-not-set-Action%27s-property-which-is-an-array-of-Strings-tp15145619p20139502.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
>
>

Re: Struts 2: Can not set Action's property which is an array of Strings

Posted by MyAshok <ta...@gmail.com>.
Andriy,

Can u give me the sample code snippet to get the array value from jsp.

With Regards,
MYAshok



Andriy Kharchuk wrote:
> 
> It helped. Thank you.
> 
> 2008/1/28, Hernandez, David <da...@lehman.com>:
>>
>>
>> Andriy,
>>
>> Try putting the array in an encapsulating object, i.e. an ArrayList.
>>
>> Regards,
>>
>> David Hernandez
>>
>> -----Original Message-----
>> From: Andriy Kharchuk [mailto:andriy.kharchuk@gmail.com]
>> Sent: Monday, January 28, 2008 4:15 PM
>> To: Struts Users Mailing List
>> Subject: Struts 2: Can not set Action's property which is an array of
>> Strings
>>
>> Hi guys,
>>
>> My Action has property which is an array of Strings. I'm rendering html
>> table using this property. What is correct way to update this property
>> from jsp?
>>
>> I tried the following but it doesn't work:
>>
>> 1. JSP
>> <s:iterator value="entityList" status="rowstatus">
>>     <s:textfield name="selectedItems[%{#rowstatus.index}]"/>
>>
>> 2. Action
>>     private String[] selectedItems;
>>
>>     public String[] getSelectedItems(){
>>         return selectedItems;
>>     }
>>
>>     public void setSelectedItems(String[] selectedItems){
>>         this.selectedItems = selectedItems;
>>     }
>>
>> Exception is
>> [ERROR] 23:11:16,750 InstantiatingNullHandler | Could not create and/or
>> set value back on to object |
>> com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(
>> InstantiatingNullHandler.java:110)| nullPropertyValue
>> java.lang.InstantiationException: [Ljava.lang.String;
>>     at java.lang.Class.newInstance0(Unknown Source)
>>
>> I will appreciate any help.
>>
>> Thanks,
>> Andriy
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>> - - - - - - -
>>
>> This message is intended only for the personal and confidential use of
>> the
>> designated recipient(s) named above.  If you are not the intended
>> recipient
>> of this message you are hereby notified that any review, dissemination,
>> distribution or copying of this message is strictly prohibited.  This
>> communication is for information purposes only and should not be regarded
>> as
>> an offer to sell or as a solicitation of an offer to buy any financial
>> product, an official confirmation of any transaction, or as an official
>> statement of Lehman Brothers.  Email transmission cannot be guaranteed to
>> be
>> secure or error-free.  Therefore, we do not represent that this
>> information
>> is complete or accurate and it should not be relied upon as such.  All
>> information is subject to change without notice.
>>
>> --------
>> IRS Circular 230 Disclosure:
>> Please be advised that any discussion of U.S. tax matters contained
>> within
>> this communication (including any attachments) is not intended or written
>> to
>> be used and cannot be used for the purpose of (i) avoiding U.S. tax
>> related penalties or (ii) promoting, marketing or recommending to another
>> party any transaction or matter addressed herein.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Struts-2%3A-Can-not-set-Action%27s-property-which-is-an-array-of-Strings-tp15145619p20139502.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


Re: Struts 2: Can not set Action's property which is an array of Strings

Posted by Andriy Kharchuk <an...@gmail.com>.
It helped. Thank you.

2008/1/28, Hernandez, David <da...@lehman.com>:
>
>
> Andriy,
>
> Try putting the array in an encapsulating object, i.e. an ArrayList.
>
> Regards,
>
> David Hernandez
>
> -----Original Message-----
> From: Andriy Kharchuk [mailto:andriy.kharchuk@gmail.com]
> Sent: Monday, January 28, 2008 4:15 PM
> To: Struts Users Mailing List
> Subject: Struts 2: Can not set Action's property which is an array of
> Strings
>
> Hi guys,
>
> My Action has property which is an array of Strings. I'm rendering html
> table using this property. What is correct way to update this property
> from jsp?
>
> I tried the following but it doesn't work:
>
> 1. JSP
> <s:iterator value="entityList" status="rowstatus">
>     <s:textfield name="selectedItems[%{#rowstatus.index}]"/>
>
> 2. Action
>     private String[] selectedItems;
>
>     public String[] getSelectedItems(){
>         return selectedItems;
>     }
>
>     public void setSelectedItems(String[] selectedItems){
>         this.selectedItems = selectedItems;
>     }
>
> Exception is
> [ERROR] 23:11:16,750 InstantiatingNullHandler | Could not create and/or
> set value back on to object |
> com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(
> InstantiatingNullHandler.java:110)| nullPropertyValue
> java.lang.InstantiationException: [Ljava.lang.String;
>     at java.lang.Class.newInstance0(Unknown Source)
>
> I will appreciate any help.
>
> Thanks,
> Andriy
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> - - - - - - -
>
> This message is intended only for the personal and confidential use of the
> designated recipient(s) named above.  If you are not the intended recipient
> of this message you are hereby notified that any review, dissemination,
> distribution or copying of this message is strictly prohibited.  This
> communication is for information purposes only and should not be regarded as
> an offer to sell or as a solicitation of an offer to buy any financial
> product, an official confirmation of any transaction, or as an official
> statement of Lehman Brothers.  Email transmission cannot be guaranteed to be
> secure or error-free.  Therefore, we do not represent that this information
> is complete or accurate and it should not be relied upon as such.  All
> information is subject to change without notice.
>
> --------
> IRS Circular 230 Disclosure:
> Please be advised that any discussion of U.S. tax matters contained within
> this communication (including any attachments) is not intended or written to
> be used and cannot be used for the purpose of (i) avoiding U.S. tax
> related penalties or (ii) promoting, marketing or recommending to another
> party any transaction or matter addressed herein.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Struts 2: Can not set Action's property which is an array of Strings

Posted by "Hernandez, David" <da...@lehman.com>.
Andriy,

Try putting the array in an encapsulating object, i.e. an ArrayList.

Regards,

David Hernandez

-----Original Message-----
From: Andriy Kharchuk [mailto:andriy.kharchuk@gmail.com] 
Sent: Monday, January 28, 2008 4:15 PM
To: Struts Users Mailing List
Subject: Struts 2: Can not set Action's property which is an array of
Strings

Hi guys,

My Action has property which is an array of Strings. I'm rendering html
table using this property. What is correct way to update this property
from jsp?

I tried the following but it doesn't work:

1. JSP
<s:iterator value="entityList" status="rowstatus">
    <s:textfield name="selectedItems[%{#rowstatus.index}]"/>

2. Action
    private String[] selectedItems;

    public String[] getSelectedItems(){
        return selectedItems;
    }

    public void setSelectedItems(String[] selectedItems){
        this.selectedItems = selectedItems;
    }

Exception is
[ERROR] 23:11:16,750 InstantiatingNullHandler | Could not create and/or
set value back on to object |
com.opensymphony.xwork2.util.InstantiatingNullHandler.nullPropertyValue(
InstantiatingNullHandler.java:110)| nullPropertyValue
java.lang.InstantiationException: [Ljava.lang.String;
    at java.lang.Class.newInstance0(Unknown Source)

I will appreciate any help.

Thanks,
Andriy
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.

--------
IRS Circular 230 Disclosure:
Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein.



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