struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nils-Helge Garli Hegvik" <nil...@gmail.com>
Subject Re: Pls convert this code using struts2 tags
Date Tue, 23 Dec 2008 07:39:36 GMT
Yikes....how hard is it to read curly braces and numbers... Could
someone please sponsor me a pair of new glasses?

Your "Index" values should read: "%{#idx.index + 3}" etc (note the
number is inside the expression). Actually, I think you can skip the
curly braces as well.

Nils-H


On Mon, Dec 22, 2008 at 2:27 PM, Nils-Helge Garli Hegvik
<nilsga@gmail.com> wrote:
> I aparently cannot read, your indexes does look correct after all,
> although maybe not needed... Sorry about that. I also didn't notice
> until now that parts of the code is outside the s:iterator loop.
> Seeing some of the generated html that doesn't work compared to what
> does work could help.
>
> Nils-H
>
> On Mon, Dec 22, 2008 at 11:53 AM, taj uddin <tajuddin19@yahoo.com> wrote:
>> Can u pls suggest me on how to use Index as a variable?
>>
>> Let me explain u in clear abt the application.
>> From my stuts1.2 code u can understand that in <logic:iterate> index value
>> of iteration is stored in a variable "Index" and the value in that variable
>> is incremented using JSP tags.
>>
>> But using struts2, the status attribute of <s:iterator> tag holds the index
>> value of current iteration and i am trying to get that using index()
>> method.So, how can i asign the value that the status attribut is holding to
>> an ordinary where which can b used in JSP tags?
>>
>> --- On Mon, 12/22/08, Nils-Helge Garli Hegvik <nilsga@gmail.com> wrote:
>>
>> From: Nils-Helge Garli Hegvik <nilsga@gmail.com>
>> Subject: Re: Pls convert this code using struts2 tags
>> To: tajuddin19@yahoo.com, "Struts Users Mailing List"
>> <user@struts.apache.org>
>> Date: Monday, December 22, 2008, 5:23 AM
>>
>> That's hard to say considering I know nothing about what result you
>> expect, and what the rendered html actually looks like. But from your
>> code, it looks like the "Index1", "Index2" and
>> "Index3" variables
>> might not have the value you expect them to be. And do you really need
>> to store the index in a variable?
>>
>> Nils-H
>>
>> On Mon, Dec 22, 2008 at 11:11 AM, taj uddin <tajuddin19@yahoo.com> wrote:
>>>
>>> Hey I have tried using <s:set> and <s:property> tags. By using
>> them, i am
>>> not getting any error but my required Menu is not appearing on the header
>>> page.
>>> Here is the code:
>>>  //Sub Menu for 2nd Main Menu Item ("ABC"):
>>>                                                             menus[1] = new
>>>
>>  menu(180, "vertical", 0, 0, -1, -1, "",
>> "#ce122d", "Verdana,Helvetica", 8,
>>>
>> "normal",
>>> "normal", "white", "#fcccb5", 1,
>> "#ce122d", 2, 62, false, true, false,
>>> false, 0, true, 4, 4, "black");
>>>
>>>                                                             <s:set
>>> name="Index" value="0" />
>>>
>>>                                                             <s:iterator
>>> value="%{#session.Tables}" status="idx"
>> id="Table" >
>>>                                                             <s:set
>>> name="Index" value="%{#idx.index}+3" />" />
>>>
>>>
>>> menus[1].addItem("#", "", 20, "left",
>> '<s:property value="#Table.tableName"
>>> />', '<s:property value="#Index" />');
>>>
>> </s:iterator>
>>>
>>                                                         <s:set
>>> name="Index1" value="%{#Index}+1" />
>>>
>>> menus[1].addItem("#", "", 20, "left",
>> "PQR",'<s:property
>>> value="#Index1"/>');
>>>                                                             <s:set
>>> name="Index2" value="%{#Index1}+1" />
>>>
>>> menus[1].addItem("#", "", 20, "left",
>> "DEF", '<s:property value="#Index2"
>>> />');
>>>                                                             <s:set
>>> name="Index3" value="%{#Index2}+1"/>
>>>
>>> menus[1].addItem("#", "", 20, "left",
>> "XYZ", '<s:property value="#Index3"
>>> />');
>>>
>>> On the jsp page it is not displaying this menu.
>>> So, pls help me out
>>> --- On Mon, 12/22/08, Nils-Helge Garli Hegvik <nilsga@gmail.com>
>> wrote:
>>>
>>> From: Nils-Helge Garli Hegvik <nilsga@gmail.com>
>>>
>>  Subject: Re: Pls convert this code using struts2 tags
>>> To: "Struts Users Mailing List" <user@struts.apache.org>,
>>> tajuddin19@yahoo.com
>>> Date: Monday, December 22, 2008, 5:04 AM
>>>
>>> Take a look at the s:set and s:property tags.
>>>
>>> Nils-H
>>>
>>> On Mon, Dec 22, 2008 at 10:56 AM, taj uddin <tajuddin19@yahoo.com>
>> wrote:
>>>> Hi
>>>>
>>>> I am working on application where i have to convert the code developed
>> in
>>> struts1.2 to struts2.0.
>>>> Here is the struts1.2 code:
>>>>  //Sub Menu for 2nd Main Menu Item ("ABC"):
>>>>                                                             menus[1] =
>> new
>>> menu(180, "vertical", 0, 0, -1, -1, "",
>> "#ce122d",
>>> "Verdana,Helvetica", 8,
>>>>
>>> "normal", "normal", "white",
>> "#fcccb5",
>>> 1, "#ce122d", 2, 62, false, true, false, false, 0, true, 4, 4,
>>>
>>  "black");
>>>>                                                             <% int
>>> Index = 0; %>
>>>>
>>> <logic:iterate indexId="idx"
>>>  id="Table"
>>> name="Tables" scope="session">
>>>>                                                                 <%
>>> Index = idx.intValue() + 3; %>
>>>>
>>> menus[1].addItem("#", "", 20, "left",
>>> "<bean:write name="Table"
>>> property="tableName"/>", <%=Index%>);
>>>>
>>> </logic:iterate>
>>>>                                                             <%
>> Index++;
>>> %>
>>>>
>>> menus[1].addItem("#", "", 20, "left",
>>> "PQR", <%=Index%>);
>>>>                                                             <%
>> Index++;
>>> %>
>>>>
>>> menus[1].addItem("#", "", 20, "left",
>>> "DEF", <%=Index%>);
>>>>
>>>
>>       <% Index++;
>>> %>
>>>>
>>> menus[1].addItem("#", "", 20, "left",
>>> "XYZ", <%=Index%>);
>>>>
>>>> Here is my struts2.0 code(below) :-
>>>>
>>>> //Sub Menu for 2nd Main Menu Item ("ABC"):
>>>>                                                             menus[1] =
>> new
>>> menu(180,
>>>>
>>>> "vertical", 0, 0, -1, -1, "", "#ce122d",
>>> "Verdana,Helvetica", 8,
>>>>
>>> "normal", "normal",
>>>>
>>>> "white", "#fcccb5", 1, "#ce122d", 2, 62,
>>> false, true, false, false, 0, true, 4, 4,
>>>>
>>>> "black");
>>>>                                                             <% int
>>> Index = 0; %>
>>>>
>> <s:iterator
>>> status="idx"
>>>>
>>>> id="Table" value="Tables" >
>>>>
>>>
>>           <%
>>> Index = idx.index() + 3;
>>>>
>>>> %>
>>>>
>>> menus[1].addItem("#", "",
>>>>
>>>> 20, "left", "<s:property
>>> value="#Table.tableName"/>", <%=Index%>);
>>>>
>>> </s:iterator>
>>>>                                                             <%
>> Index++;
>>> %>
>>>>
>>> menus[1].addItem("#", "", 20,
>>>>
>>>> "left", "PQR", <%=Index%>);
>>>>                                                             <%
>> Index++;
>>> %>
>>>>
>>> menus[1].addItem("#", "", 20,
>>>>
>>>> "left", "DEF", <%=Index%>);
>>>>                                                             <%
>> Index++;
>>> %>
>>>>
>>>
>>> menus[1].addItem("#", "", 20,
>>>>
>>>> "left", "XYZ", <%=Index%>);
>>>>
>>>> where i am getting the
>>  error on the line:
>>>> <% Index = idx.index() + 3; %>
>>>> indicating that idx cannot be resolved.
>>>>
>>>> Pls help me out in this issue.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>

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


Mime
View raw message