You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Henrique VIECILI <vi...@softplan.com.br> on 2004/10/26 13:49:15 UTC
Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to iterate over the vector and access the array values by index. I've tried a sort of things but I don´t know how to access the value of an array by index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
Re: Vector of array in session
Posted by Jeff Beal <jb...@webmedx.com>.
<bean:write name="array[0]"/>
Henrique VIECILI wrote:
> Hi all,
>
> i have a vector of arrays (double[]) in the session scope, and i want to iterate over the vector and access the array values by index. I've tried a sort of things but I don´t know how to access the value of an array by index.
>
> my last innocent try was:
>
> <logic:iterate id="array" name="myvector" >
> <bean:write name="array.0" />
> </logic:iterate>
>
> Does anyone have a solution?
>
> Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Vector of array in session
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
What about using JSTL...
<c:out value="${array[0]}" />
Alternatively, its not very elegant, but you could use a second iterate,
setting the length to 1...
<logic:iterate id="array" name="myvector" >
<logic:iterate id="myValue" name="array" length="1" >
<bean:write name="myValue" />
<logic:iterate id="array" name="myvector" >
</logic:iterate>
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 2:20 PM
Subject: Re: Vector of array in session
It threw
javax.servlet.ServletException: Cannot find bean array[0] in any scopeI
think the [0] can only be used in value attribute, and i need to access the
array value directly by the index.Henrique VieciliPS.: now I am looking at
<c:out> instead of <bean:write>----- Original Message -----
From: Niall Pemberton
To: Struts Users Mailing List
Sent: Tuesday, October 26, 2004 9:56 AM
Subject: Re: Vector of array in session
Try
<bean:write name="array[0]" />
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 12:49 PM
Subject: Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to
iterate over the vector and access the array values by index. I've tried a
sort of things but I don´t know how to access the value of an array by
index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Vector of array in session
Posted by Henrique VIECILI <vi...@softplan.com.br>.
Thanks Niall, i switched to <c:out> option.
Henrique
----- Original Message -----
From: Niall Pemberton
To: Struts Users Mailing List
Sent: Tuesday, October 26, 2004 10:43 AM
Subject: Re: Vector of array in session
Sorry should have read...
<logic:iterate id="array" name="myvector" >
<logic:iterate id="myValue" name="array" length="1" >
<bean:write name="myValue" />
</logic:iterate>
</logic:iterate>
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 2:20 PM
Subject: Re: Vector of array in session
It threw
javax.servlet.ServletException: Cannot find bean array[0] in any scopeI
think the [0] can only be used in value attribute, and i need to access the
array value directly by the index.Henrique VieciliPS.: now I am looking at
<c:out> instead of <bean:write>----- Original Message -----
From: Niall Pemberton
To: Struts Users Mailing List
Sent: Tuesday, October 26, 2004 9:56 AM
Subject: Re: Vector of array in session
Try
<bean:write name="array[0]" />
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 12:49 PM
Subject: Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to
iterate over the vector and access the array values by index. I've tried a
sort of things but I don´t know how to access the value of an array by
index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Vector of array in session
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Sorry should have read...
<logic:iterate id="array" name="myvector" >
<logic:iterate id="myValue" name="array" length="1" >
<bean:write name="myValue" />
</logic:iterate>
</logic:iterate>
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 2:20 PM
Subject: Re: Vector of array in session
It threw
javax.servlet.ServletException: Cannot find bean array[0] in any scopeI
think the [0] can only be used in value attribute, and i need to access the
array value directly by the index.Henrique VieciliPS.: now I am looking at
<c:out> instead of <bean:write>----- Original Message -----
From: Niall Pemberton
To: Struts Users Mailing List
Sent: Tuesday, October 26, 2004 9:56 AM
Subject: Re: Vector of array in session
Try
<bean:write name="array[0]" />
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 12:49 PM
Subject: Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to
iterate over the vector and access the array values by index. I've tried a
sort of things but I don´t know how to access the value of an array by
index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Vector of array in session
Posted by Henrique VIECILI <vi...@softplan.com.br>.
It threw
javax.servlet.ServletException: Cannot find bean array[0] in any scopeI think the [0] can only be used in value attribute, and i need to access the array value directly by the index.Henrique VieciliPS.: now I am looking at <c:out> instead of <bean:write>----- Original Message -----
From: Niall Pemberton
To: Struts Users Mailing List
Sent: Tuesday, October 26, 2004 9:56 AM
Subject: Re: Vector of array in session
Try
<bean:write name="array[0]" />
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 12:49 PM
Subject: Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to
iterate over the vector and access the array values by index. I've tried a
sort of things but I don´t know how to access the value of an array by
index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Vector of array in session
Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
Try
<bean:write name="array[0]" />
Niall
----- Original Message -----
From: "Henrique VIECILI" <vi...@softplan.com.br>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Tuesday, October 26, 2004 12:49 PM
Subject: Vector of array in session
Hi all,
i have a vector of arrays (double[]) in the session scope, and i want to
iterate over the vector and access the array values by index. I've tried a
sort of things but I don´t know how to access the value of an array by
index.
my last innocent try was:
<logic:iterate id="array" name="myvector" >
<bean:write name="array.0" />
</logic:iterate>
Does anyone have a solution?
Henrique Viecili
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org