You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shyam Anand <sh...@yahoo.com> on 2003/04/25 04:00:21 UTC

Re:
Tim,

I guess I have problems with my email software and
hence code samples were missing. So, I'm trying
again..

Here goes...

Tim,

Thanks for your mail. I tried to send my code sample
in my previous mail but I guess the Struts mailing
list filters anything with '<html' in it and hence my
code was missing!!
I'm sending it again with the 'html' stripped :)....

<!-- <select property="bmod" multiple="true">
                                   <options
collection="modules" property="value"
                   labelProperty="label"/> 
                </select> -->

I got the Exception when I did not use the <html: form
tag. 
But when I use  the <html:form tag with the same
action as my ActionForm is associated
with, I get a "Page Not Found" error on my browser. I
store the collection, "modules" into the session in my
ActionClass and use it inside <html:select. I guess
the reason is that <html:select
is not able to access the collection object in
session.

I have followed the examples that come with Struts and
used the "LabelValueBean" for storing 
<select label and value pairs. The collection
"modules" is an ArrayList of "LabelValueBean".
I also imported the above mentioned classes but the
outcome is the same.

However, I'm able to display the list values when I
use the scriptlet given below:

<select name="bmod" size="3" multiple>
                        <% ArrayList list =
(ArrayList) session.getAttribute("modules");          
                     
                           out.println("Size: " +
list.size());
                           for(int
i=0;i<list.size();i++)
                           { 
                                LabelValueBean bean =
(LabelValueBean) list.get(i);     
                                   %>
                                <option
value="<%=bean.getValue()%>"> <%= bean.getLabel()%> 
                                </option>
                                           
                                <%}%>                 
  
                        </select>

I understand that using the scriptlet defies the very
purpose of Struts, and hence should be avoided.

What do you think may be causing the error? Any help
would be greatly appreciated.

Thanks,
Shyam

P.S.
I'm new to Struts and just beginning to figure out how
the framework works.


At 09:41 AM 4/24/2003 -0400, you wrote:

Not sure if this is the issue but when you said bmod
is the property
associated with the JSP, JSPs aren't associated with
ActionForms. Actions
are. Therefore in your jsp you need a <html:form that
has the same action as
your ActionForm is associated with.
Do you have an html:form wrapping it as such?
-Tim


__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com

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