You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by yuping he <ph...@gmail.com> on 2009/02/13 00:53:41 UTC

assign struts to a String object in JSP

Hi all,
I am new to Struts and I was trying to assign struts <nested:text'> to a
String object in JSP

code example:
---------------------------------------------------------------------------------------
<%! String s = new String() %>

<nested:iterate property="bookSearchResults" indexId="index">
     <% s= " %><nested:text name="bookSearchResults" property="bookId" /><%
"; %>
</nested:iterate>
---------------------------------------------------------------------------------------

this code won't work, anyone can tell me what is correct way to assign the
values from <nested:text> to the String object.
Thanks in advance.

hyp

Re: assign struts to a String object in JSP

Posted by Paweł Wielgus <po...@gmail.com>.
Hi,
i don't know what exactly You are trying to achieve,
but i will try to help.
First You can't assign struts tag to script variable, those are
dofferent worlds, so it will never work.
Second, struts tag <nested:text> is just a representation of html
input type text.
And last, maybe You are trying to assing this input value to a
scriptlet variable?
If so, it should look like that:

<nested:define id="definedValue"
property="property_that_represents_text_field_value"/>
< % String s = definedValue % >


Best greetings,
Paweł Wielgus.

2009/2/13 yuping he <ph...@gmail.com>:
> Hi all,
> I am new to Struts and I was trying to assign struts <nested:text'> to a
> String object in JSP
>
> code example:
> ---------------------------------------------------------------------------------------
> <%! String s = new String() %>
>
> <nested:iterate property="bookSearchResults" indexId="index">
>     <% s= " %><nested:text name="bookSearchResults" property="bookId" /><%
> "; %>
> </nested:iterate>
> ---------------------------------------------------------------------------------------
>
> this code won't work, anyone can tell me what is correct way to assign the
> values from <nested:text> to the String object.
> Thanks in advance.
>
> hyp
>

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