You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Knee, Jeff" <kn...@digineer.com> on 2001/11/30 20:58:48 UTC

My first Struts question

All,

I've just subscribed to the Struts Users mailing list, so "Hello, all!"

I also took the time to try to get the FAQ for the list and to find a
searchable archive but the mailing list faq is non-existant (according to
ezmlm).  I've looked at the Jakarta site and I'm still needing a push in the
right direction.

I'm building my first Stuts "app" to learn more about it and at the moment
I'm trying to use the html options JSP tag like so:

<html:select property="opponentName">
    <html:options collection="opponents" 
                  property="username" 
                  labelProperty="username"/>
</html:select>

The action form for this JSP has the following method:

    public ArrayList getOpponents()
    {
        PlayerController playerController = new PlayerController();
        
        ArrayList list = playerController.getOpponents(ourName);

        return list;
    }


Unfortunately, I get the following error:

javax.servlet.ServletException: Cannot find bean under name opponents

If I manually create a list on the JSP and stick on the page context like
so:

<%
// ...
// create list
// ...

pageContext.setAttribute("opponents", list);

%>

...Then the page renders.

Am I missing something?  How can I get the options tag to find the
collection within the form?

(Or am I completely bonkers thinking that the options tag is supposed to
look for the array in various places?  Perhaps I need to change
"<html:options collection="opponents"..." to something like "<html:options
collection="form.opponents"..." 

It just occurred to me to look in the bug database at jakarta.apache.org...

I think I might be describing Bugzilla Bug 905 & 2096...

If so, how can I, on the JSP, get to the ActionForm object so that I can do
a setAttribute?

Any help?

+= Jeff Knee


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: My first Struts question

Posted by Ajay Chitre <aj...@diligentteam.com>.
Jeff,

Welcome to the list.  

You can find the searchable archive at;

http://www.mail-archive.com/struts-user@jakarta.apache.org/

Thanks.




-- Original Message --

>All,
>
>I've just subscribed to the Struts Users mailing list, so "Hello, all!"
>
>I also took the time to try to get the FAQ for the list and to find a
>searchable archive but the mailing list faq is non-existant (according
to
>ezmlm).  I've looked at the Jakarta site and I'm still needing a push in
>the
>right direction.
>
>I'm building my first Stuts "app" to learn more about it and at the moment
>I'm trying to use the html options JSP tag like so:
>
><html:select property="opponentName">
>    <html:options collection="opponents" 
>                  property="username" 
>                  labelProperty="username"/>
></html:select>
>
>The action form for this JSP has the following method:
>
>    public ArrayList getOpponents()
>    {
>        PlayerController playerController = new PlayerController();
>        
>        ArrayList list = playerController.getOpponents(ourName);
>
>        return list;
>    }
>
>
>Unfortunately, I get the following error:
>
>javax.servlet.ServletException: Cannot find bean under name opponents
>
>If I manually create a list on the JSP and stick on the page context like
>so:
>
><%
>// ...
>// create list
>// ...
>
>pageContext.setAttribute("opponents", list);
>
>%>
>
>...Then the page renders.
>
>Am I missing something?  How can I get the options tag to find the
>collection within the form?
>
>(Or am I completely bonkers thinking that the options tag is supposed to
>look for the array in various places?  Perhaps I need to change
>"<html:options collection="opponents"..." to something like "<html:options
>collection="form.opponents"..." 
>
>It just occurred to me to look in the bug database at jakarta.apache.org...
>
>I think I might be describing Bugzilla Bug 905 & 2096...
>
>If so, how can I, on the JSP, get to the ActionForm object so that I can
>do
>a setAttribute?
>
>Any help?
>
>+= Jeff Knee
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>

Ajay Chitre

Diligent Team, Inc.
(Where Diligent People Work as a Team)

http://www.DiligentTeam.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>