You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jainitya <ja...@gmail.com> on 2011/02/22 17:21:15 UTC

Re: Struts2 iterator tag

Hi 
I am also a newbie in struts 2 ,I dont know how to use this forum so
replying on this thread.
I also have lookalike problem with Iterator tag
My JSP is 
<s:iterator value="selllog" var="selllog" id="selllog"  status="selllog">
				<tr align="left" valign="top">
					<s:hidden value="%{selllog.idSellLog}"
name="selllog[%{#selllog.index}].idSellLog"  disabled="true" theme="simple" 
/>
					<s:hidden value="%{selllog.shopbrandmaster.brandmaster.idBrandMaster}"
name="shopbrandmaster.brandmaster.idBrandMaster" disabled="true"
theme="simple"  />
					<td><s:textfield value="%{shopbrandmaster.brandmaster.brandsName}"
disabled="true" theme="simple"  /></td>
					<td><s:textfield value="%{openingBalence}" name="openingBalence"
id="openingBalence" 	disabled="true"  theme="simple" /></td>
					<td><s:textfield value="%{receive}" name="receive" id="receive" " 
theme="simple" /></td>
					<td><s:textfield value="%{transfer}"name="transfer" id="transfer" " 
theme="simple" /></td>
					<td><s:textfield value="%{transferToComment}"name="transferToComment"
id="transferToComment" theme="simple" /></td>
					<td><s:textfield id="TotalDayStock" disabled="true" theme="simple"
/></td>
					<td><s:textfield value="%{dayBrandRate}"name="dayBrandRate"
id="dayBrandRate" disabled="true"  theme="simple"/></td>
					<td><s:textfield value="%{closingBalance}"name="closingBalance"
id="closingBalance"	theme="simple" /></td>
					<td><s:textfield id="sell" disabled="true" theme="simple" /></td>
					<td><s:textfield id="totalBrandSale" disabled="true" theme="simple"
/></td>
				</tr>
				</s:iterator>

In my Action I have 
public class shopLogEntry extends ActionSupport {
private List<Selllog> selllog;
//getter and setter
}
and in action class I have getter and for setter selllog.it works fine when
I am trying to get value in JSP.
but after submitting it, i am not able to access the selllog List in my
action .It is returning me as a null list.
can anyone tell me where I am wrong.


-- 
View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987224.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: Struts2 iterator tag

Posted by Dave Newton <da...@gmail.com>.
On Tue, Feb 22, 2011 at 12:26 PM, Jainitya wrote:
> [JSP]

Would it be possible for you to only include the actual stuff that
matters? Editing stuff down is really helpful for people trying to
focus on what's actually wrong.

1) http://struts.apache.org/2.x/docs/selecting-themes.html

You may be able to avoid setting the theme on every single form field.

2) If the value is coming from an action property of the same name you
shouldn't need to set the value explicitly.

3) You may be able to use the "key" attribute to eliminate setting
both the "id" and "name" attributes (not sure how it interacts w/ the
"simple" theme).

I'd take a little time and poke around the framework a bit before
proceeding much further--you'll save yourself, and those that have to
maintain your code, some time and hassle.

In any case: why *wouldn't* the list be null? You're not passing any
form values that would populate it. Actions are created per request:
any action properties not set by the form or by action code will be
whatever their type's default value is.

Dave

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


Re: Struts2 iterator tag

Posted by Jainitya <ja...@gmail.com>.
hi Dave
I have updated my JSP as per your suggestion but still the issue is same.
updated JSP
<s:iterator value="selllog"  id="selllogId"  status="selllogStatus">
				<tr align="left" valign="top">
					<td><s:textfield value="%{idSellLog}"   disabled="true" theme="simple" 
/></td>
					<td><s:textfield value="%{shopbrandmaster.brandmaster.idBrandMaster}"
name="shopbrandmaster" disabled="true" theme="simple"  /></td>
					<td><s:textfield value="%{shopbrandmaster.brandmaster.brandsName}"
disabled="true" theme="simple"  /></td>
					<td><s:textfield value="%{openingBalence}" name="openingBalence"
id="openingBalence" 	disabled="true" onchange="Total_Day_Stock();"
theme="simple" /></td>
					<td><s:textfield value="%{receive}" name="receive" id="receive"
onchange="Total_Day_Stock();"  theme="simple" /></td>
					<td><s:textfield value="%{transfer}"name="transfer" id="transfer"
onchange="Total_Day_Stock();"  theme="simple" /></td>
					<td><s:textfield value="%{transferToComment}"name="transferToComment"
id="transferToComment" theme="simple" /></td>
					<td><s:textfield id="TotalDayStock" disabled="true" theme="simple"
/></td>
					<td><s:textfield value="%{dayBrandRate}"name="dayBrandRate"
id="dayBrandRate" disabled="true" onchange="Total_Day_Stock();"
theme="simple"/></td>
					<td><s:textfield value="%{closingBalance}"name="closingBalance"
id="closingBalance"	theme="simple" /></td>
					<td><s:textfield id="sell" disabled="true" theme="simple" /></td>
					<td><s:textfield id="totalBrandSale" disabled="true" theme="simple"
/></td>
				</tr>
				</s:iterator>

Still when I am trying to access this list after submission it is returning
me null value;
:-((
-- 
View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987872.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: Struts2 iterator tag

Posted by Dave Newton <da...@gmail.com>.
On Tue, Feb 22, 2011 at 11:21 AM, Jainitya wrote:
> I am also a newbie in struts 2 ,I dont know how to use this forum

http://struts.apache.org/mail.html

> <s:iterator value="selllog" var="selllog" id="selllog"  status="selllog">
>     <tr align="left" valign="top">
>           <s:hidden value="%{selllog.idSellLog}" disabled="true" theme="simple"
>                          name="selllog[%{#selllog.index}].idSellLog"/>

FWIW, I'm not sure this is valid HTML--have you run it through a
validator? You're basically inserting elements between a TR and TD.

> but after submitting it, i am not able to access the selllog List in my
> action .It is returning me as a null list.

This is the only thing that would set anything on the list, but it's
disabled (which is weird for a hidden element), so the browser won't
send it.

Dave

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


Re: Struts2 iterator tag

Posted by Maurizio Cucchiara <ma...@gmail.com>.
First and foremost, I'd try to make cleaner the iterator definition:

 <s:iterator value="selllog" var="selllogVar" status="selllogStatus">


On 22 February 2011 17:21, Jainitya <ja...@gmail.com> wrote:
>
> Hi
> I am also a newbie in struts 2 ,I dont know how to use this forum so
> replying on this thread.
> I also have lookalike problem with Iterator tag
> My JSP is
> <s:iterator value="selllog" var="selllog" id="selllog"  status="selllog">
>                                <tr align="left" valign="top">
>                                        <s:hidden value="%{selllog.idSellLog}"
> name="selllog[%{#selllog.index}].idSellLog"  disabled="true" theme="simple"
> />
>                                        <s:hidden value="%{selllog.shopbrandmaster.brandmaster.idBrandMaster}"
> name="shopbrandmaster.brandmaster.idBrandMaster" disabled="true"
> theme="simple"  />
>                                        <td><s:textfield value="%{shopbrandmaster.brandmaster.brandsName}"
> disabled="true" theme="simple"  /></td>
>                                        <td><s:textfield value="%{openingBalence}" name="openingBalence"
> id="openingBalence"     disabled="true"  theme="simple" /></td>
>                                        <td><s:textfield value="%{receive}" name="receive" id="receive" "
> theme="simple" /></td>
>                                        <td><s:textfield value="%{transfer}"name="transfer" id="transfer" "
> theme="simple" /></td>
>                                        <td><s:textfield value="%{transferToComment}"name="transferToComment"
> id="transferToComment" theme="simple" /></td>
>                                        <td><s:textfield id="TotalDayStock" disabled="true" theme="simple"
> /></td>
>                                        <td><s:textfield value="%{dayBrandRate}"name="dayBrandRate"
> id="dayBrandRate" disabled="true"  theme="simple"/></td>
>                                        <td><s:textfield value="%{closingBalance}"name="closingBalance"
> id="closingBalance"     theme="simple" /></td>
>                                        <td><s:textfield id="sell" disabled="true" theme="simple" /></td>
>                                        <td><s:textfield id="totalBrandSale" disabled="true" theme="simple"
> /></td>
>                                </tr>
>                                </s:iterator>
>
> In my Action I have
> public class shopLogEntry extends ActionSupport {
> private List<Selllog> selllog;
> //getter and setter
> }
> and in action class I have getter and for setter selllog.it works fine when
> I am trying to get value in JSP.
> but after submitting it, i am not able to access the selllog List in my
> action .It is returning me as a null list.
> can anyone tell me where I am wrong.
>
>
> --
> View this message in context: http://old.nabble.com/Struts2-iterator-tag-tp18258667p30987224.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
>
>



-- 
Maurizio Cucchiara

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