property="list"/>
</html:select>

<html:optionsCollection name="statesNew" >

<html:optionsCollection name="statesNew" property="list"/> was indeed the fix. Thank you Jim, you rock. What I don't understand is that I thought I had tried that before as well and that it had screamed about not finding the bean in any scope. I must have been giving the wrong bean name - who cares?!


Thanks again,

Kevin




On Jul 21, 2004, at 3:01 PM, Jim Barrows wrote:



-----Original Message-----
From: Kevin McAbee [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 21, 2004 12:47 PM
To: Struts Users Mailing List
Subject: App scoped bean to be used with html:optionsCollection in JSP


As for thorough flamings... I like my meat medium rare :)

<snip setup code>


// msgres is a MessageResources object // sc is the ServletContext object String statesList = msgres.getMessage("list.states"); statesNew = LabelValueListBean.populate(sc.getRealPath(statesList)); sc.setAttribute("statesNew", statesNew); // I now print out the LabelValueListBean System.out.println(statesNew.toString());

looks good.

<snip>


I have tried various methods, all of which failed, of accessing the LabelValueListBean object in a JSP page via tag libraries for use in html:optionsCollection and the like.

Attempts:
(<app:xxx> is the Jakarta application tag library)

<html:select property="homeState">
   <app:attributes id="statesTest" name="statesNew">
      <html:optionsCollection name="statesTest" property="list"/>
   </app:attributes>

I think that html:optionsCollection will search up the scope to application scope to find statesNew.
I would check the java code and make sure that there is a getList for statesNew, then try and get rid of the app:attributes and see if that helps.



</html:select>

The above returns the following:
javax.servlet.ServletException: No getter method for property list of
bean statesTest



In my desperation:

<html:select property="homeState">
   <html:optionsCollection name='${applicationScope.statesNew}'

This translates rougly to applicationScope.getStatesNew()

property="list"/>
</html:select>

<html:optionsCollection name="statesNew" >


javax.servlet.ServletException: Cannot find bean Label: Alabama --- Value: AL Label: Alaska --- Value: AK Label: Arizona --- Value: AZ ... (the rest of the toString() of LabelValueListBean)



What am I doing wrong?  How can I fix this?  I am going about this a
totally wrong way?  I figure the solution is probably quite
simple and
under my foolish nose.  Any help would be greatly appreciated.

Regards,

Kevin


--------------------------------------------------------------------- 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