You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Tercero <dt...@gmail.com> on 2008/01/29 12:32:11 UTC

Problem setting id property of texfield tag

Hi all,

   I'm  having troubles setting the id property in a textfield tag. I use
the version 2.0.11

   The case is I'm not able to introduce a variable value into the id
property, I mean:

<s:textfield>
    <s:param name="id">stockTotal_${house.id}</s:param>
    <s:param name="name">stockList[${house.id}].number</s:param>
    <s:param name="value">${house.number}</s:param>
</s:textfield>

   I generate several textfields like this one and I need to reference it in
javascript (that's because i need to set the id property). Using the param
tag doesn't work for the id, but goes right for the name and value
propertys.

   I tried several ways but none of them seems to work.

Any help would be appreciated.
-- 
View this message in context: http://www.nabble.com/Problem-setting-id-property-of-texfield-tag-tp15157521p15157521.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: Problem setting id property of texfield tag

Posted by David Tercero <dt...@gmail.com>.
Hi, thanks for the anwer.

   It is a bit complicated, because house.id is not in the value stack but
in the page context. I use JSTL tag to complement the struts ones, so
sometimes the property is in the page context.

   With the version 2.0.9 you could use the ${} expressions (Expression
Language), but not in the 2.0.11. Recently I updated my application from
2.0.9 to 2.0.11, and realized s: tags with EL expressions caused an
exception.

   I can't reference house.id as an OGNL expression because house is not in
the stack value. The main problem seems to be I can't give the id property a
value using the s:param tag, what it's not exposed in the struts2
documentation.

   I've tested something simillar

<s:set name="tmpId"><s:param
name="value">stockTotal_${house.id}</s:param></s:set>
<s:textfield id="stockTotal_%{#tmpId}" value=.../>

   but this generate a dump of the value stack (like toString method):

id="stockTotal_{..... valueStack dump .....}


Thanks in advance.





Julien RICHARD-2 wrote:
> 
> Do you tried :
> 
> <s:textfield id="stockTotal_%{house.id}" value="%{house.number}"/>
> 
> On Jan 29, 2008 12:32 PM, David Tercero <dt...@gmail.com> wrote:
> 
>>
>> Hi all,
>>
>>   I'm  having troubles setting the id property in a textfield tag. I use
>> the version 2.0.11
>>
>>   The case is I'm not able to introduce a variable value into the id
>> property, I mean:
>>
>> <s:textfield>
>>    <s:param name="id">stockTotal_${house.id}</s:param>
>>    <s:param name="name">stockList[${house.id}].number</s:param>
>>    <s:param name="value">${house.number}</s:param>
>> </s:textfield>
>>
>>   I generate several textfields like this one and I need to reference it
>> in
>> javascript (that's because i need to set the id property). Using the
>> param
>> tag doesn't work for the id, but goes right for the name and value
>> propertys.
>>
>>   I tried several ways but none of them seems to work.
>>
>> Any help would be appreciated.
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-setting-id-property-of-texfield-tag-tp15157521p15157521.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
>>
>>
> 
> 
> -- 
> RICHARD Julien,
> UNILOG
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-setting-id-property-of-texfield-tag-tp15157521p15161516.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: Problem setting id property of texfield tag

Posted by Julien RICHARD <ri...@gmail.com>.
Do you tried :

<s:textfield id="stockTotal_%{house.id}" value="%{house.number}"/>

On Jan 29, 2008 12:32 PM, David Tercero <dt...@gmail.com> wrote:

>
> Hi all,
>
>   I'm  having troubles setting the id property in a textfield tag. I use
> the version 2.0.11
>
>   The case is I'm not able to introduce a variable value into the id
> property, I mean:
>
> <s:textfield>
>    <s:param name="id">stockTotal_${house.id}</s:param>
>    <s:param name="name">stockList[${house.id}].number</s:param>
>    <s:param name="value">${house.number}</s:param>
> </s:textfield>
>
>   I generate several textfields like this one and I need to reference it
> in
> javascript (that's because i need to set the id property). Using the param
> tag doesn't work for the id, but goes right for the name and value
> propertys.
>
>   I tried several ways but none of them seems to work.
>
> Any help would be appreciated.
> --
> View this message in context:
> http://www.nabble.com/Problem-setting-id-property-of-texfield-tag-tp15157521p15157521.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
>
>


-- 
RICHARD Julien,
UNILOG

Re: Problem setting id property of texfield tag

Posted by David Tercero <dt...@gmail.com>.
Hi, it works fine :clap:, Dave you are a crack ;-)

Thank you very much =)


newton.dave wrote:
> 
> From: David Tercero <dt...@gmail.com>
>> It is a bit complicated, because house.id is not in the value
>> stack but in the request.
> 
> 
> ...
> 
> 
> #attr will also search the request scope.
> 
> 
> Dave
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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/Problem-setting-id-property-of-texfield-tag-tp15157521p15162594.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