RE: html:options list source question

2003-07-14 Thread Craig Berry
Thanks for the very useful information.  Everything you said worked with
a single exception; to get the correct interpretation of the property
value pointing to a collection of LabelValueBeans, I needed to use
html:optionsCollection rather than html:options .

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: Sunday, July 13, 2003 9:22 PM
To: 'Struts Users Mailing List'
Subject: RE: html:options list source question


Craig Berry wrote:
> The jsp page contains an html:form section linked via action mapping 
> to
the EditDeForm type.  
> In it, there is a select/options section that looks like this:
> 
> 
>  property="value"
>   labelProperty="label"/>
> 
> I had thought that this would be enough to make it work.

The docs say that if you don't specify 'name', it will look to the form
bean for 'property'.  

So without the  (definitely not needed) did you try:
 ?

(I'm not sure if you'd still need labelName/labelProperty, I suspect not
since you're using LabelValueBean.)

http://jakarta.apache.org/struts/userGuide/struts-html.html#options

(BTW, you don't need the 'set' method to be a bean, read-only properties
are perfectly acceptable.)

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 

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



RE: html:options list source question

2003-07-13 Thread Wendy Smoak
Craig Berry wrote:
> The jsp page contains an html:form section linked via action mapping to
the EditDeForm type.  
> In it, there is a select/options section that looks like this:
> 
> 
>  property="value"
>   labelProperty="label"/>
>  
> I had thought that this would be enough to make it work.

The docs say that if you don't specify 'name', it will look to the form bean
for 'property'.  

So without the  (definitely not needed) did you try:
 ?

(I'm not sure if you'd still need labelName/labelProperty, I suspect not
since you're using LabelValueBean.)

http://jakarta.apache.org/struts/userGuide/struts-html.html#options

(BTW, you don't need the 'set' method to be a bean, read-only properties are
perfectly acceptable.)

-- 
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management 


html:options list source question

2003-07-13 Thread Craig Berry
After much googling and head-scratching, I finally have an html:options tag working on 
a jsp.  The problem is that I don't know why one component of the solution is needed, 
and I was hoping someone can explain it to me.
 
My ActionForm subclass, EditDeForm, has a pair of methods to provide the option list 
as part of the form bean:

public Collection getNumFmtOptions() {
  ArrayList list = new ArrayList();
  list.add(new LabelValueBean("None", "0"));
  list.add(new LabelValueBean("Comma separated", "1"));
  list.add(new LabelValueBean("Currency", "2"));
  return list;
}
 
public void setNumFmtOptions(Collection options) {
  // No op, here to satisfy bean-ness.
}

The jsp page contains an html:form section linked via action mapping to the EditDeForm 
type.  In it, there is a select/options section that looks like this:


  
 

I had thought that this would be enough to make it work.  The html:options is in the 
context of an html:form that knows about the current form bean, and the form bean has 
a property numFmtOptions that contains what is needed to populate the options list.  
But when I tried just this, I got a "cannot find bean" error on numFmtOptions.
 
The googling mentioned above finally revealed that I had to add this at the top of my 
jsp:



My question is:  Why?  What is this additional definition for?  What information does 
it supply that isn't already available to html:options inside the html:form context?
 
I'm happy that I have my code working, but I'd be even happier if I knew why it's 
working. :)
 
-- 
Craig Berry
Principal Architect
PortBlue Corp.
 
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]