You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by EoneZhang <ev...@163.com> on 2008/11/24 03:14:01 UTC

[HELP]: struts tag and OGNL

Hi, everyone.

I have something wrong about the usage of struts tag and OGNL.

Here is my problem:

I want to generate the following html with <s:textfiled/> tag:

    
<input name="mylist[0].dstn" value="CNS" type="text"><br/>
<input name="mylist[1].dstn" value="CNS" type="text"><br/>
<input name="mylist[2].dstn" value="CNS" type="text"><br/>


I use the tag like following:

    
  <s:iterator status="sts" value="mylist">
   <s:textfield name="mylist[#sts.index].dstn"/>
  </s:iterator>
  

But it generate the below html:


<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>
<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>
<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>


Is there anyone who can give some help,thanks a lot:handshake:





-- 
View this message in context: http://www.nabble.com/-HELP-%3A-struts-tag-and-OGNL-tp20653798p20653798.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: [HELP]: struts tag and OGNL

Posted by Nishna <Na...@iflexsolutions.com>.
 Try the below logic:

 Use s:set for generating index

  
  <s:set name="index" value="0"/>
  <s:iterator status="sts" value="mylist"> 
      <s:textfield name="mylist[${index}].dstn"/> 
      <s:set name="index" value="${index+1}"/>      
  </s:iterator> 

  

-Nishi.






EoneZhang wrote:
> 
> Hi, everyone.
> 
> I have something wrong about the usage of struts tag and OGNL.
> 
> Here is my problem:
> 
> I want to generate the following html with <s:textfiled/> tag:
> 
>     
> <input name="mylist[0].dstn" value="CNS" type="text"><br/>
> <input name="mylist[1].dstn" value="CNS" type="text"><br/>
> <input name="mylist[2].dstn" value="CNS" type="text"><br/>
> 
> 
> I use the tag like following:
> 
>     
>   <s:iterator status="sts" value="mylist">
>    <s:textfield name="mylist[#sts.index].dstn"/>
>   </s:iterator>
>   
> 
> But it generate the below html:
> 
> 
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
> <input type="text" name="mylist[#sts.index].dstn" value="CNS"
> id="list_mylist__sts_index__dstn"/>
> 
> 
> Is there anyone who can give some help,thanks a lot:handshake:
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-HELP-%3A-struts-tag-and-OGNL-tp20653798p20677591.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: [HELP]: struts tag and OGNL

Posted by ManiKanta G <go...@gmail.com>.
try this

<s:iterator status="sts" value="mylist">
  <s:textfield name='%{"mylist[" + #sts.index + "].dstn"}' />
 </s:iterator>

ManiKanta

RE: [HELP]: struts tag and OGNL

Posted by nikunj <nm...@appliedcommerce.com>.
U Kan use like following way,

	<s:iterator value="v" var="id" status="stat">
		<s:textfield name="v[%{#stat.index}].key"  />
		<s:textfield name="v[%{#stat.index}].value" />
	</s:iterator>

Regards,
Nikunj

-----Original Message-----
From: EoneZhang [mailto:everhow@163.com] 
Sent: Monday, November 24, 2008 7:44 AM
To: user@struts.apache.org
Subject: [HELP]: struts tag and OGNL


Hi, everyone.

I have something wrong about the usage of struts tag and OGNL.

Here is my problem:

I want to generate the following html with <s:textfiled/> tag:

    
<input name="mylist[0].dstn" value="CNS" type="text"><br/>
<input name="mylist[1].dstn" value="CNS" type="text"><br/>
<input name="mylist[2].dstn" value="CNS" type="text"><br/>


I use the tag like following:

    
  <s:iterator status="sts" value="mylist">
   <s:textfield name="mylist[#sts.index].dstn"/>
  </s:iterator>
  

But it generate the below html:


<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>
<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>
<input type="text" name="mylist[#sts.index].dstn" value="CNS"
id="list_mylist__sts_index__dstn"/>


Is there anyone who can give some help,thanks a lot:handshake:





-- 
View this message in context:
http://www.nabble.com/-HELP-%3A-struts-tag-and-OGNL-tp20653798p20653798.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


__________ NOD32 3632 (20081121) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com



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