Sorry - the ServletException was:
Cannot find bean component in any scope

I was doing another experiment attempting to
iterate containers and got the messages mixed.

Thanks

-----Original Message-----
From: Ray Madigan [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 10, 2003 11:23 PM
To: Struts Users Mailing List
Subject: RE: Newbie Question


Here is my new code:

ArrayList components = ( ArrayList ) service.gatherAccessory
 Bean.getContainer ( ) );
request.setAttribute ( "components", components );

the jsp:
<logic:iterate id="component" name="components" scope="request" >
  <logic:equal name="component" property="name" scope="page"
               value="<bean:write name="navigateForm"
property="component"/>">
    <tr>
      <td COLSPAN="2"align="left">
        <bean:write name="component" property="name" filter="false"/>
      </td>
    </tr>
  </logic:equal>
</logic:iterate>

I get the ServletException:
Cannot find bean container in any scope
If I remove the <tr><td><bean:write: .../></td></tr>
It is fine -doesn't fault - doesn't write anything

If I remove the <logic:equal ...></logic:equal>
It will iterate the list only once.
I have print statements in the Action

Im stumped? Any Ideas

I will try Struts 1.0.2 - Except the examples seem to work :-)

Thanks for your help
Ray Madigan

-----Original Message-----
From: Jacob Hookom [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 10, 2003 10:24 PM
To: 'Struts Users Mailing List'
Subject: RE: Newbie Question


ArrayList components = (ArrayList) service
                                     .gatherAccessory(Bean.getContainer());

session.setAttribute("someKey", components);

-or-
request.setAttribute("someKey", components);


<!-- jsp -->

<logic:iterate id="item" name="someKey" scope="session"> //or request scope
  <bean:write name="item" property="name" /><br />
</logic:iterate>

-Jacob

| -----Original Message-----
| From: Ray Madigan [mailto:[EMAIL PROTECTED]]
| Sent: Tuesday, February 11, 2003 12:06 AM
| To: Struts Users Mailing List
| Subject: Newbie Question
|
| Greetings:
|
| I am new to struts, and i have a question that has been giving me fits all
| day.
|
| I have a large application I am attempting to rewrite in struts, with
| several hundred jsp's and servlets.  It currently runs on Tomcat.  I am
| using, don't all of you laugh at once, 1.1-b3.
|
| I haveured out some of how struts works from reading the samples and
| groping
| throught the code, but i can't seem to figure out how to make
| logic:iterate
| work.  Here are a couple oc code fragments, if someone could point out
| where
| i'm a bonehead, i would appreciate it.
|
| In the Action class:
|     ArrayList components = ( ArrayList ) service.gatherAccessory
|  Bean.getContainer ( ) );
|     // Error checking and logging etc
|     if ( components != null && components.size ( ) > 0 ) {
|         System.out.println ( "Nav: Comp: " + components.size ( ) );
|         //txSupport component = new txSupport ( );
|         //session.setAttribute ( Constants.COMPONENT_KEY, components.get
| ( 1 ) );
|         //session.setAttribute ( Constants.COMPONENTS_KEY,
| components.toArray ( as ) );
|         session.setAttribute ( component, components.get ( 0 ) );
|         navForm.setComponents ( components );
|     }
|
| I have tried several alternatives as to how to set the id attribute:
| - an empty instance of the Bean that is contained in the collection
| - the first element in the array
| I have tried to set the name property of the iterate to an array
| all with different errors.  The one that worked the best was when
| I pointed the id property of iterate to the first element of the
| Collection.  Here i simply got the iterator to iterate the first
| element.  In the Action class I have iterated the Collection and
| there are three elements in the list.
|
| In the jsp:
|
|   <logic:iterate id="component" name="navigateForm" property="components"
| >
|
|     <tr>
|       <td COLSPAN="2"align="left">
|         <bean:write name="component" property="support" filter="true"/>
|       </td>
|     </tr>
|
|   </logic:iterate>
|
| The navigateForm has a pair of methods get/setComponents that return the
| Collection.  If I put a logic:equal and test a member of the iteration it
| works in all cases.
|
| I am very perplexed by this situation and any light shed on the problem
| would be appreciated.
|
| Thanks in advance
| Ray Madigan
|
|
| ---------------------------------------------------------------------
| To unsubscribe, e-mail: [EMAIL PROTECTED]
| For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to