You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mo...@physics.gmu.edu on 2003/11/24 22:54:52 UTC

logic:iterate help

Hi All
I have a Vector called as testScoresVector (Vector of testScores Objects)
stored in the session

I am trying this
<logic:iterate id="tsv" name="testScoresVector">
     <html:select property="tsv.testName">
        <html:option value="SAT-1">SAT-1</html:option>
        <html:option value="SAT-2">SAT-2</html:option>
        :
        :

      </html:select>
</logic:iterate>

The idea is to add the selected value into the TestScores Object for each
object in the Vector.

This gives an error saying :No getter method available for property
tsv.testName for bean under name org.apache.struts.taglib.html.BEAN
I think the "tsv" holds a TestScoresVector object for each iteration. Am i
right or not. Please let me know

Thank you

--Mohan






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


Re: logic:iterate help

Posted by mo...@physics.gmu.edu.
Hi All
I have tried this
<logic:iterate id="tsv" collection="testScoresVector">
testScoresVector is a vector stored as a session Attribute as
request.getSession().setAttribute("testScoresVector", testScoresVector)
Please let me know what the problem is

--Mohan


> Hi Guys
> The reason i am using the logic:iterate is not to populate the select
> box but to create the select box for the number times the length of the
> testScoresVector and store the option selected in the select box in each
> of the testScoresVector element.
>
> --Mohan
>> Hi All
>> I have a Vector called as testScoresVector (Vector of testScores
>> Objects) stored in the session
>>
>> I am trying this
>> <logic:iterate id="tsv" name="testScoresVector">
>>      <html:select property="tsv.testName">
>>         <html:option value="SAT-1">SAT-1</html:option>
>>         <html:option value="SAT-2">SAT-2</html:option>
>>         :
>>         :
>>
>>       </html:select>
>> </logic:iterate>
>>
>> The idea is to add the selected value into the TestScores Object for
>> each object in the Vector.
>>
>> This gives an error saying :No getter method available for property
>> tsv.testName for bean under name org.apache.struts.taglib.html.BEAN I
>> think the "tsv" holds a TestScoresVector object for each iteration. Am
>> i right or not. Please let me know
>>
>> Thank you
>>
>> --Mohan
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
>> additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: struts-user-help@jakarta.apache.org




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


Re: logic:iterate help

Posted by mo...@physics.gmu.edu.
Hi Guys
The reason i am using the logic:iterate is not to populate the select box
but to create the select box for the number times the length of the
testScoresVector and store the option selected in the select box in each
of the testScoresVector element.

--Mohan
> Hi All
> I have a Vector called as testScoresVector (Vector of testScores
> Objects) stored in the session
>
> I am trying this
> <logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="tsv.testName">
>         <html:option value="SAT-1">SAT-1</html:option>
>         <html:option value="SAT-2">SAT-2</html:option>
>         :
>         :
>
>       </html:select>
> </logic:iterate>
>
> The idea is to add the selected value into the TestScores Object for
> each object in the Vector.
>
> This gives an error saying :No getter method available for property
> tsv.testName for bean under name org.apache.struts.taglib.html.BEAN I
> think the "tsv" holds a TestScoresVector object for each iteration. Am i
> right or not. Please let me know
>
> Thank you
>
> --Mohan
>
>
>
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org For
> additional commands, e-mail: struts-user-help@jakarta.apache.org




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


Re: logic:iterate help

Posted by Gurpreet Dhanoa <gu...@smartdatainc.com>.
hi MOhan

Error is coming coz your syntax is not upto the mark. Try with the following

<logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="testName">
    <html:collection name="tsv" labelproperty="any property name of the
Vector"/>
>       </html:select>
> </logic:iterate>

Cheers
gary

----- Original Message -----
From: <mo...@physics.gmu.edu>
To: <st...@jakarta.apache.org>
Sent: Tuesday, November 25, 2003 3:24 AM
Subject: logic:iterate help


> Hi All
> I have a Vector called as testScoresVector (Vector of testScores Objects)
> stored in the session
>
> I am trying this
> <logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="tsv.testName">
>         <html:option value="SAT-1">SAT-1</html:option>
>         <html:option value="SAT-2">SAT-2</html:option>
>         :
>         :
>
>       </html:select>
> </logic:iterate>
>
> The idea is to add the selected value into the TestScores Object for each
> object in the Vector.
>
> This gives an error saying :No getter method available for property
> tsv.testName for bean under name org.apache.struts.taglib.html.BEAN
> I think the "tsv" holds a TestScoresVector object for each iteration. Am i
> right or not. Please let me know
>
> Thank you
>
> --Mohan
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: logic:iterate help

Posted by Gurpreet Dhanoa <gu...@smartdatainc.com>.
try this


> <logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="testName">

<html:options collection="tsv" property="stateId"
labelProperty="stateName"/>
>         :
>         :
>
>       </html:select>
> </logic:iterate>



cheers
Gurpreet DHanoa

----- Original Message -----
From: <mo...@physics.gmu.edu>
To: <st...@jakarta.apache.org>
Sent: Tuesday, November 25, 2003 3:24 AM
Subject: logic:iterate help


> Hi All
> I have a Vector called as testScoresVector (Vector of testScores Objects)
> stored in the session
>
> I am trying this
> <logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="tsv.testName">
>         <html:option value="SAT-1">SAT-1</html:option>
>         <html:option value="SAT-2">SAT-2</html:option>
>         :
>         :
>
>       </html:select>
> </logic:iterate>
>
> The idea is to add the selected value into the TestScores Object for each
> object in the Vector.
>
> This gives an error saying :No getter method available for property
> tsv.testName for bean under name org.apache.struts.taglib.html.BEAN
> I think the "tsv" holds a TestScoresVector object for each iteration. Am i
> right or not. Please let me know
>
> Thank you
>
> --Mohan
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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


Re: logic:iterate help

Posted by Mike Duffy <md...@yahoo.com>.
I recommend you drop the Struts logic tags and switch to JSTL combined with the Struts-el tags.

"JSTL has support for common, structural tasks such as iteration and conditionals, tags for
manipulating XML documents, internationalization and locale-sensitive formatting tags, and SQL
tags. It also introduces a new expression language to simplify page development..."

http://java.sun.com/products/jsp/jstl/

Core JSTL: Mastering the JSP Standard Tag Library
by David M. Geary 
http://www.amazon.com/exec/obidos/tg/detail/-/0131001531/qid=1069734758/sr=1-2/ref=sr_1_2/002-2465270-5458431?v=glance&s=books

By combing Struts-el with JSTL a select tag with options can be written as:
    
<html-el:select property="moduleTypeCode">
  <c:forEach items='${applicationScope[constants.moduleTypeCodeTypeLabelMapKey]}' var='mapItem'>
    <html-el:option value="${mapItem.key}"><c:out value='${mapItem.value}'/></html-el:option>
  </c:forEach>
</html-el:select>

The map of module types is loaded from a data store by a Struts plug-in at system start up. 

Mike 


--- mohan@physics.gmu.edu wrote:
> Hi All
> I have a Vector called as testScoresVector (Vector of testScores Objects)
> stored in the session
> 
> I am trying this
> <logic:iterate id="tsv" name="testScoresVector">
>      <html:select property="tsv.testName">
>         <html:option value="SAT-1">SAT-1</html:option>
>         <html:option value="SAT-2">SAT-2</html:option>
>         :
>         :
> 
>       </html:select>
> </logic:iterate>
> 
> The idea is to add the selected value into the TestScores Object for each
> object in the Vector.
> 
> This gives an error saying :No getter method available for property
> tsv.testName for bean under name org.apache.struts.taglib.html.BEAN
> I think the "tsv" holds a TestScoresVector object for each iteration. Am i
> right or not. Please let me know
> 
> Thank you
> 
> --Mohan
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

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