Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Eddie Bush

Go look at the ValidatorPlugin source :-)  Here is a brief overview:

Each plugin gets a reference to:
- an ActionServlet instance
- an ApplicationConfig instance (for the current "module")

You can use the ActionServlet instance to get at the application 
(servlet-context) scope and then set an attribute.  It'd go something 
like this:

servlet.getServletContext().setAttribute("myAttribute", myVar);

That will result in you having a variable out there in application scope 
named "myAttribute" which is a reference to "myVar".

Note that you're not constrained to using a plugin.  A context listener 
would also get a reference to the context (the application-scope), so 
you could easily adopt this approach too -- especially if there's 
nothing special you need from Struts in order to configure whatever 
you're poking out there :-).  My modules need to know which sub-app they 
are associated with, so I can use that information later ;-) so I have 
opted for the plugin route.  I can get the prefix from the 
ApplicationConfig (config.getPrefix()), and that's enough information 
for me to tell "where I am".

Day, Michael-IBM/TT wrote:

>Eddie,
>
>I agree with your approach.  How can I place the beans into application scope?  
>Forgive me if these seems ignorant.
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Day, Michael-IBM/TT

Eddie,

I agree with your approach.  How can I place the beans into application scope?  
Forgive me if these seems ignorant.

-Original Message-
From: Eddie Bush [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 10:24 AM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


Here's what I do:

- Plugin uses digester to load config into bean instances.
- Place the overall container into application scope under a known key.

I don't particularly care of the Struts approach of "declare a constant 
in some distant package for this key", as, at best, it causes the 
introduction of a run-time expression (at least that's the way I've 
found to do it - someone please tell me if there is a better way).  I 
just defined a key under which my config could be found -- and I stick 
to it everywhere.  I wish struts would adopt this approach ...

The top-level object in my graph is a ModuleManager instance.  Once that 
is initialized, I poke it out into application scope under the key of 
"moduleManager".

I suppose Struts uses the keys it does so that it doesn't trample on 
folks names-space.  Personally, I'd give up what insignificant amount of 
namespace Struts would require -- just to have the keys more easily 
accessible.  (hrm ... application config in app scope under "appCfg" or 
"strutsAppCfg" or the like .. same deal on mappings ... resources ... hrm)

Day, Michael-IBM/TT wrote:

>Both are much easier than I thought.  Thanks for the help.  One question remains: if 
>I were to have a ConfigurationPlugIn, for example, how would I get that information 
>to each servlet.  Should I create static method within the ConfigurationPlugIn class 
>that returns an object with all of the config values?
>

-- 
Eddie Bush




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


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




Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Eddie Bush

No, that's not true.  You can set it to be loaded on startup -- just 
like Struts' own ActionServlet is done.

Day, Michael-IBM/TT wrote:

>Jan,
>
>Definitely clear; however, using an Init servlet requires someone to access that 
>servlet each time I restart the server, correct?  When I really think about it, 
>that's not a big deal, but it's something I might forget :).
>
>Thanks for the suggestion.
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Eddie Bush

Here's what I do:

- Plugin uses digester to load config into bean instances.
- Place the overall container into application scope under a known key.

I don't particularly care of the Struts approach of "declare a constant 
in some distant package for this key", as, at best, it causes the 
introduction of a run-time expression (at least that's the way I've 
found to do it - someone please tell me if there is a better way).  I 
just defined a key under which my config could be found -- and I stick 
to it everywhere.  I wish struts would adopt this approach ...

The top-level object in my graph is a ModuleManager instance.  Once that 
is initialized, I poke it out into application scope under the key of 
"moduleManager".

I suppose Struts uses the keys it does so that it doesn't trample on 
folks names-space.  Personally, I'd give up what insignificant amount of 
namespace Struts would require -- just to have the keys more easily 
accessible.  (hrm ... application config in app scope under "appCfg" or 
"strutsAppCfg" or the like .. same deal on mappings ... resources ... hrm)

Day, Michael-IBM/TT wrote:

>Both are much easier than I thought.  Thanks for the help.  One question remains: if 
>I were to have a ConfigurationPlugIn, for example, how would I get that information 
>to each servlet.  Should I create static method within the ConfigurationPlugIn class 
>that returns an object with all of the config values?
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Day, Michael-IBM/TT

Jan,

Definitely clear; however, using an Init servlet requires someone to access that 
servlet each time I restart the server, correct?  When I really think about it, that's 
not a big deal, but it's something I might forget :).

Thanks for the suggestion.

-Original Message-
From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 8:53 AM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


How to by using an Init Servlet.

Some examples, since explaining would take too long :

Java startup servlet
---cut---
package org.init.whatever;

import javax.servlet.*;
import javax.servlet.http.*;

public class InitServlet extends HttpServlet {

public void init(ServletConfig config) throws ServletException {
super.init(config);
//DO WHATEVER YOU NEED TO DO HERE
//config.getServletContext().setAttribute("states","some object with 
states in it");
}

public void destroy() {

}

/** Processes requests for both HTTP GET and 
POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, 
HttpServletResponse response)
throws ServletException, java.io.IOException {
//do nothing
}

/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}

/** Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse 
response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}

/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Init ME";
}

}
cut 
again-
in you web.xml:
-cut cut 

Init Servlet
Init Servlet
Servlet to initialize whatever
org.init.whatever.InitServlet

param1
WEB-INF/maybe.some.file.if.you.need.such.a.thing.properties

3

-/cut cut 

Is it clearer or as mud ?

Jf

Eddie Bush wrote:

> Michael,
>
> I'm currently building some functionality on top of Struts for a 
> project. The way I found to do this the easiest was to keep my config 
> in an XML file and use the commons digester in a Plugin. Plugin 
> writing is very straight-forward, and there are a couple of standard 
> examples (TilesPlugin/ValidatorPlugin) out there for you to look at. 
> Personally, when I started in, I looked at the ValidatorPlugin. It's 
> much shorter and covered everything I cared about.
>
> Day, Michael-IBM/TT wrote:
>
>> This is probably one of the stupidest questions, but I don't know how 
>> to do something once during application startup.
>>
>> For instance, if I wanted a bean to hold a list of states, how would 
>> I create that once during startup?
>>
> Note: If you needed to get persistent stuff out of a database, you 
> could do your DB-access here to load your beans.
>
> HTH
>


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


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




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Day, Michael-IBM/TT

Both are much easier than I thought.  Thanks for the help.  One question remains: if I 
were to have a ConfigurationPlugIn, for example, how would I get that information to 
each servlet.  Should I create static method within the ConfigurationPlugIn class that 
returns an object with all of the config values?

-Original Message-
From: Eddie Bush [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 9:43 AM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


Yeah, actually this might be your best approach.  Mine would depend on 
Struts.  This approach would be totally independent of Struts.  If 
you're (wasn't it spec 2.3 that brought us these listeners?) on an older 
spec, using the plugin may well be the way to go though.

Robert Taylor wrote:

>javax.servlet.ServletContextListener @since Servlet2.2 spec acts a
>bootstrap.
>Prior to Servlet2.2 spec, try a bootstrap  servlet.
>
>A quick scan of the mailing list archives and .
>http://www.mail-archive.com/struts-user@jakarta.apache.org/msg38242.html
>
>should help.
>
>robert
>

-- 
Eddie Bush




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


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




Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Jan Fetyko

How to by using an Init Servlet.

Some examples, since explaining would take too long :

Java startup servlet
---cut---
package org.init.whatever;

import javax.servlet.*;
import javax.servlet.http.*;

public class InitServlet extends HttpServlet {

public void init(ServletConfig config) throws ServletException {
super.init(config);
//DO WHATEVER YOU NEED TO DO HERE
//config.getServletContext().setAttribute("states","some object with 
states in it");
}

public void destroy() {

}

/** Processes requests for both HTTP GET and 
POST methods.
* @param request servlet request
* @param response servlet response
*/
protected void processRequest(HttpServletRequest request, 
HttpServletResponse response)
throws ServletException, java.io.IOException {
//do nothing
}

/** Handles the HTTP GET method.
* @param request servlet request
* @param response servlet response
*/
protected void doGet(HttpServletRequest request, HttpServletResponse 
response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}

/** Handles the HTTP POST method.
* @param request servlet request
* @param response servlet response
*/
protected void doPost(HttpServletRequest request, HttpServletResponse 
response)
throws ServletException, java.io.IOException {
processRequest(request, response);
}

/** Returns a short description of the servlet.
*/
public String getServletInfo() {
return "Init ME";
}

}
cut 
again-
in you web.xml:
-cut cut 

Init Servlet
Init Servlet
Servlet to initialize whatever
org.init.whatever.InitServlet

param1
WEB-INF/maybe.some.file.if.you.need.such.a.thing.properties

3

-/cut cut 

Is it clearer or as mud ?

Jf

Eddie Bush wrote:

> Michael,
>
> I'm currently building some functionality on top of Struts for a 
> project. The way I found to do this the easiest was to keep my config 
> in an XML file and use the commons digester in a Plugin. Plugin 
> writing is very straight-forward, and there are a couple of standard 
> examples (TilesPlugin/ValidatorPlugin) out there for you to look at. 
> Personally, when I started in, I looked at the ValidatorPlugin. It's 
> much shorter and covered everything I cared about.
>
> Day, Michael-IBM/TT wrote:
>
>> This is probably one of the stupidest questions, but I don't know how 
>> to do something once during application startup.
>>
>> For instance, if I wanted a bean to hold a list of states, how would 
>> I create that once during startup?
>>
> Note: If you needed to get persistent stuff out of a database, you 
> could do your DB-access here to load your beans.
>
> HTH
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Eddie Bush

Yeah, actually this might be your best approach.  Mine would depend on 
Struts.  This approach would be totally independent of Struts.  If 
you're (wasn't it spec 2.3 that brought us these listeners?) on an older 
spec, using the plugin may well be the way to go though.

Robert Taylor wrote:

>javax.servlet.ServletContextListener @since Servlet2.2 spec acts a
>bootstrap.
>Prior to Servlet2.2 spec, try a bootstrap  servlet.
>
>A quick scan of the mailing list archives and .
>http://www.mail-archive.com/struts-user@jakarta.apache.org/msg38242.html
>
>should help.
>
>robert
>

-- 
Eddie Bush




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Jan Fetyko

You were not alone. :((

Galbreath, Mark wrote:

>Aboslutely - must have been brain-dead for not thinking of that (especially
>because that's exactly what I do!).
>
>-Original Message-
>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, September 19, 2002 8:00 AM
>To: Struts Users Mailing List
>Subject: Re: RGH! SOMEONE! How do I set the default selection when
>I'm using html:options?
>
>
>One more advice to make your life easier: Why bother getting the states 
>from the database for every form ( or even the same form ) when it's 
>accessed ? I think the better way is to load the states when the app 
>starts up and store it in the application bean in format that you can 
>get the list very easy way, by getting it from the application bean on 
>the form, like this :
>
>
>
>
>labelName="abean" labelProperty="statesarrayvalues"/>
>
>
>
>both "statesarraykeys" and "statesarrayvalues" in the application bean 
>are "ArrayList"(s).
>
>Let's face it, how often a list of US states changes ? Once in 500 years 
>? :)
>
>Jf
>
>
>Galbreath, Mark wrote:
>
>  
>
>>In your Action class, call a data access object to get a ResultSet from
>>
>>
>your
>  
>
>>database containing all the states and pass them as a List.
>>
>>Action class:
>>myDAO dao = new myDAO();
>>dao.getStates();
>>
>>
>>DAO:
>>public List getStates() throws SQLException {
>> List states = new ArrayList();
>>
>> while( rs.next()) {
>>   states.add( rs.getString( "[name of db column containing states]");
>> }
>> return states;
>>}
>>
>>Action class:
>>MyActionForm actionForm = (MyActionForm) form;
>>form.setStates( states);
>>
>>ActionForm class:
>>private List states = null;
>>public void setStates( List states){
>> this.states = states;
>>}
>>public List getStates(){
>> return states;
>>}
>>
>>JSP:
>>
>> Select A State
>> 
>>
>>
>>Mark
>>
>>-Original Message-
>>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 18, 2002 2:22 PM
>>To: Struts Users Mailing List
>>Subject: Re: RGH! SOMEONE! How do I set the default selection when
>>I'm using html:options?
>>
>>
>>Can you post some code : what are the values of the states, what is the 
>>definitions in the form, how you're setting the default value , etc.
>>
>>Jf
>>
>>Michael Lee wrote:
>>
>> 
>>
>>
>>
>>>Thanks, but nada.
>>>The ActionForm state is set yet its still not working. :(
>>>Is the problem with the options?
>>>
>>>  
>>>
>>>
>>>- Original Message -
>>>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>>Sent: Wednesday, September 18, 2002 11:31 AM
>>>Subject: RE: How do I set the default selection when I'm using
>>>   
>>>
>>>  
>>>
>>html:options?
>> 
>>
>>
>>
>>>   
>>>
>>>  
>>>
>>>>You need to populate the value of the property of the dropdown before the
>>>>jsp is render...the best way to do this is in the action class.
>>>>
>>>>For example, you have getter and setter for State in the form bean...now
>>>>  
>>>>
>>>> 
>>>>
>>>>
>>>>
>>>you
>>>
>>>
>>>   
>>>
>>>  
>>>
>>>>need to setState("TX") in the action class if you want to have Texas as a
>>>>default state.
>>>>
>>>>-Original Message-
>>>>From: [EMAIL PROTECTED]
>>>>[mailto:[EMAIL PROTECTED]]
>>>>Sent: Wednesday, September 18, 2002 10:28 AM
>>>>To: [EMAIL PROTECTED]
>>>>Subject: RE: How do I set the default selection when I'm using
>>>>  
>>>>
>>>> 
>>>>
>>>>
>>>>
>>>html:options?
>>>
>>>
>>>   
>>>
>>>  
>>>
>>>>You can add in an  tag above the  tag that
>>>>will be the default.
>>>>
>>&

RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Robert Taylor

javax.servlet.ServletContextListener @since Servlet2.2 spec acts a
bootstrap.
Prior to Servlet2.2 spec, try a bootstrap  servlet.

A quick scan of the mailing list archives and .
http://www.mail-archive.com/struts-user@jakarta.apache.org/msg38242.html

should help.

robert


> -Original Message-
> From: Day, Michael-IBM/TT [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 9:17 AM
> To: Struts Users Mailing List
> Subject: RE: RGH! SOMEONE! How do I set the default selection when
> I'm using html:options?
>
>
> This is probably one of the stupidest questions, but I don't know
> how to do something once during application startup.
>
> For instance, if I wanted a bean to hold a list of states, how
> would I create that once during startup?
>
> -Original Message-
> From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 19, 2002 8:00 AM
> To: Struts Users Mailing List
> Subject: Re: AAAARGH! SOMEONE! How do I set the default selection when
> I'm using html:options?
>
>
> One more advice to make your life easier: Why bother getting the states
> from the database for every form ( or even the same form ) when it's
> accessed ? I think the better way is to load the states when the app
> starts up and store it in the application bean in format that you can
> get the list very easy way, by getting it from the application bean on
> the form, like this :
>
> 
> 
> 
>  labelName="abean" labelProperty="statesarrayvalues"/>
> 
> 
>
> both "statesarraykeys" and "statesarrayvalues" in the application bean
> are "ArrayList"(s).
>
> Let's face it, how often a list of US states changes ? Once in 500 years
> ? :)
>
> Jf
>
>
> Galbreath, Mark wrote:
>
> >In your Action class, call a data access object to get a
> ResultSet from your
> >database containing all the states and pass them as a List.
> >
> >Action class:
> >myDAO dao = new myDAO();
> >dao.getStates();
> >
> >
> >DAO:
> >public List getStates() throws SQLException {
> >  List states = new ArrayList();
> >
> >  while( rs.next()) {
> >states.add( rs.getString( "[name of db column containing states]");
> >  }
> >  return states;
> >}
> >
> >Action class:
> >MyActionForm actionForm = (MyActionForm) form;
> >form.setStates( states);
> >
> >ActionForm class:
> >private List states = null;
> >public void setStates( List states){
> >  this.states = states;
> >}
> >public List getStates(){
> >  return states;
> >}
> >
> >JSP:
> >
> >  Select A State
> >  
> >
> >
> >Mark
> >
> >-Original Message-
> >From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, September 18, 2002 2:22 PM
> >To: Struts Users Mailing List
> >Subject: Re: RGH! SOMEONE! How do I set the default selection when
> >I'm using html:options?
> >
> >
> >Can you post some code : what are the values of the states, what is the
> >definitions in the form, how you're setting the default value , etc.
> >
> >Jf
> >
> >Michael Lee wrote:
> >
> >
> >
> >>Thanks, but nada.
> >>The ActionForm state is set yet its still not working. :(
> >>Is the problem with the options?
> >>
> >>   
> >> 
> >>
> >>- Original Message -
> >>From: "Hoang, Hai" <[EMAIL PROTECTED]>
> >>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >>Sent: Wednesday, September 18, 2002 11:31 AM
> >>Subject: RE: How do I set the default selection when I'm using
> >>
> >>
> >html:options?
> >
> >
> >>
> >>
> >>
> >>
> >>>You need to populate the value of the property of the dropdown
> before the
> >>>jsp is render...the best way to do this is in the action class.
> >>>
> >>>For example, you have getter and setter for State in the form
> bean...now
> >>>
> >>>
> >>>
> >>>
> >>you
> >>
> >>
> >>
> >>
> >>>need to setState("TX") in the action class if you want to have
> Texas as a
> >>>default state.
> >>>
> >>>-

Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-19 Thread Eddie Bush

Michael,

I'm currently building some functionality on top of Struts for a 
project.  The way I found to do this the easiest was to keep my config 
in an XML file and use the commons digester in a Plugin.  Plugin writing 
is very straight-forward, and there are a couple of standard examples 
(TilesPlugin/ValidatorPlugin) out there for you to look at.  Personally, 
when I started in, I looked at the ValidatorPlugin.  It's much shorter 
and covered everything I cared about.

Day, Michael-IBM/TT wrote:

>This is probably one of the stupidest questions, but I don't know how to do something 
>once during application startup.
>
>For instance, if I wanted a bean to hold a list of states, how would I create that 
>once during startup?
>
Note:  If you needed to get persistent stuff out of a database, you 
could do your DB-access here to load your beans.

HTH

-- 
Eddie Bush




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Day, Michael-IBM/TT

This is probably one of the stupidest questions, but I don't know how to do something 
once during application startup.

For instance, if I wanted a bean to hold a list of states, how would I create that 
once during startup?

-Original Message-
From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 8:00 AM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


One more advice to make your life easier: Why bother getting the states 
from the database for every form ( or even the same form ) when it's 
accessed ? I think the better way is to load the states when the app 
starts up and store it in the application bean in format that you can 
get the list very easy way, by getting it from the application bean on 
the form, like this :








both "statesarraykeys" and "statesarrayvalues" in the application bean 
are "ArrayList"(s).

Let's face it, how often a list of US states changes ? Once in 500 years 
? :)

Jf


Galbreath, Mark wrote:

>In your Action class, call a data access object to get a ResultSet from your
>database containing all the states and pass them as a List.
>
>Action class:
>myDAO dao = new myDAO();
>dao.getStates();
>
>
>DAO:
>public List getStates() throws SQLException {
>  List states = new ArrayList();
>
>  while( rs.next()) {
>states.add( rs.getString( "[name of db column containing states]");
>  }
>  return states;
>}
>
>Action class:
>MyActionForm actionForm = (MyActionForm) form;
>form.setStates( states);
>
>ActionForm class:
>private List states = null;
>public void setStates( List states){
>  this.states = states;
>}
>public List getStates(){
>  return states;
>}
>
>JSP:
>
>  Select A State
>  
>
>
>Mark
>
>-Original Message-
>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, September 18, 2002 2:22 PM
>To: Struts Users Mailing List
>Subject: Re: RGH! SOMEONE! How do I set the default selection when
>I'm using html:options?
>
>
>Can you post some code : what are the values of the states, what is the 
>definitions in the form, how you're setting the default value , etc.
>
>Jf
>
>Michael Lee wrote:
>
>  
>
>>Thanks, but nada.
>>The ActionForm state is set yet its still not working. :(
>>Is the problem with the options?
>>
>>   
>> 
>>
>>- Original Message -
>>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>Sent: Wednesday, September 18, 2002 11:31 AM
>>Subject: RE: How do I set the default selection when I'm using
>>
>>
>html:options?
>  
>
>> 
>>
>>
>>
>>>You need to populate the value of the property of the dropdown before the
>>>jsp is render...the best way to do this is in the action class.
>>>
>>>For example, you have getter and setter for State in the form bean...now
>>>   
>>>
>>>  
>>>
>>you
>> 
>>
>>
>>
>>>need to setState("TX") in the action class if you want to have Texas as a
>>>default state.
>>>
>>>-Original Message-
>>>From: [EMAIL PROTECTED]
>>>[mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 10:28 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: RE: How do I set the default selection when I'm using
>>>   
>>>
>>>  
>>>
>>html:options?
>> 
>>
>>
>>
>>>You can add in an  tag above the  tag that
>>>will be the default.
>>>
>>>
>>>
>>>-Original Message-
>>>From: mleejr [mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 11:21 AM
>>>To: struts-user
>>>Subject: How do I set the default selection when I'm using html:options?
>>>
>>>
>>>1) How do I set a default value in an html:select on an options list? I
>>>need the default state to be the one loaded from the struts form.
>>>It doesn't like this.
>>>
>>>
>>>  
>>>
>>>
>>>thanks everyone,
>>>Mike
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>For additional commands, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>
>>

RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Galbreath, Mark

Aboslutely - must have been brain-dead for not thinking of that (especially
because that's exactly what I do!).

-Original Message-
From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 19, 2002 8:00 AM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


One more advice to make your life easier: Why bother getting the states 
from the database for every form ( or even the same form ) when it's 
accessed ? I think the better way is to load the states when the app 
starts up and store it in the application bean in format that you can 
get the list very easy way, by getting it from the application bean on 
the form, like this :








both "statesarraykeys" and "statesarrayvalues" in the application bean 
are "ArrayList"(s).

Let's face it, how often a list of US states changes ? Once in 500 years 
? :)

Jf


Galbreath, Mark wrote:

>In your Action class, call a data access object to get a ResultSet from
your
>database containing all the states and pass them as a List.
>
>Action class:
>myDAO dao = new myDAO();
>dao.getStates();
>
>
>DAO:
>public List getStates() throws SQLException {
>  List states = new ArrayList();
>
>  while( rs.next()) {
>states.add( rs.getString( "[name of db column containing states]");
>  }
>  return states;
>}
>
>Action class:
>MyActionForm actionForm = (MyActionForm) form;
>form.setStates( states);
>
>ActionForm class:
>private List states = null;
>public void setStates( List states){
>  this.states = states;
>}
>public List getStates(){
>  return states;
>}
>
>JSP:
>
>  Select A State
>  
>
>
>Mark
>
>-Original Message-
>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, September 18, 2002 2:22 PM
>To: Struts Users Mailing List
>Subject: Re: RGH! SOMEONE! How do I set the default selection when
>I'm using html:options?
>
>
>Can you post some code : what are the values of the states, what is the 
>definitions in the form, how you're setting the default value , etc.
>
>Jf
>
>Michael Lee wrote:
>
>  
>
>>Thanks, but nada.
>>The ActionForm state is set yet its still not working. :(
>>Is the problem with the options?
>>
>>   
>> 
>>
>>- Original Message -
>>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>Sent: Wednesday, September 18, 2002 11:31 AM
>>Subject: RE: How do I set the default selection when I'm using
>>
>>
>html:options?
>  
>
>> 
>>
>>
>>
>>>You need to populate the value of the property of the dropdown before the
>>>jsp is render...the best way to do this is in the action class.
>>>
>>>For example, you have getter and setter for State in the form bean...now
>>>   
>>>
>>>  
>>>
>>you
>> 
>>
>>
>>
>>>need to setState("TX") in the action class if you want to have Texas as a
>>>default state.
>>>
>>>-Original Message-
>>>From: [EMAIL PROTECTED]
>>>[mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 10:28 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: RE: How do I set the default selection when I'm using
>>>   
>>>
>>>  
>>>
>>html:options?
>> 
>>
>>
>>
>>>You can add in an  tag above the  tag that
>>>will be the default.
>>>
>>>
>>>
>>>-Original Message-
>>>From: mleejr [mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 11:21 AM
>>>To: struts-user
>>>Subject: How do I set the default selection when I'm using html:options?
>>>
>>>
>>>1) How do I set a default value in an html:select on an options list? I
>>>need the default state to be the one loaded from the struts form.
>>>It doesn't like this.
>>>
>>>
>>>  
>>>
>>>
>>>thanks everyone,
>>>Mike
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>For additional commands, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>
>>>
>>>_
>>>Introducing the all new and improved continental.com.  With a totally new
>>>personalized design, it's the best place to go. Before you go.
>>>
>>>Continental Airlines. Work Hard. Fly Right.
>>>
>>>http://www.continental.com
>>>
>>>
>>>   
>>>
>>>  
>>>
>>--
>>To unsubscribe, e-mail:
>>
>>
><mailto:[EMAIL PROTECTED]>
>  
>
>>For additional commands, e-mail:
>>
>>
><mailto:[EMAIL PROTECTED]>
>  
>
>> 
>>
>>
>>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>  
>


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

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




Re: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-19 Thread Jan Fetyko

One more advice to make your life easier: Why bother getting the states 
from the database for every form ( or even the same form ) when it's 
accessed ? I think the better way is to load the states when the app 
starts up and store it in the application bean in format that you can 
get the list very easy way, by getting it from the application bean on 
the form, like this :








both "statesarraykeys" and "statesarrayvalues" in the application bean 
are "ArrayList"(s).

Let's face it, how often a list of US states changes ? Once in 500 years 
? :)

Jf


Galbreath, Mark wrote:

>In your Action class, call a data access object to get a ResultSet from your
>database containing all the states and pass them as a List.
>
>Action class:
>myDAO dao = new myDAO();
>dao.getStates();
>
>
>DAO:
>public List getStates() throws SQLException {
>  List states = new ArrayList();
>
>  while( rs.next()) {
>states.add( rs.getString( "[name of db column containing states]");
>  }
>  return states;
>}
>
>Action class:
>MyActionForm actionForm = (MyActionForm) form;
>form.setStates( states);
>
>ActionForm class:
>private List states = null;
>public void setStates( List states){
>  this.states = states;
>}
>public List getStates(){
>  return states;
>}
>
>JSP:
>
>  Select A State
>  
>
>
>Mark
>
>-Original Message-
>From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, September 18, 2002 2:22 PM
>To: Struts Users Mailing List
>Subject: Re: RGH! SOMEONE! How do I set the default selection when
>I'm using html:options?
>
>
>Can you post some code : what are the values of the states, what is the 
>definitions in the form, how you're setting the default value , etc.
>
>Jf
>
>Michael Lee wrote:
>
>  
>
>>Thanks, but nada.
>>The ActionForm state is set yet its still not working. :(
>>Is the problem with the options?
>>
>>   
>> 
>>
>>- Original Message -
>>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>>Sent: Wednesday, September 18, 2002 11:31 AM
>>Subject: RE: How do I set the default selection when I'm using
>>
>>
>html:options?
>  
>
>> 
>>
>>
>>
>>>You need to populate the value of the property of the dropdown before the
>>>jsp is render...the best way to do this is in the action class.
>>>
>>>For example, you have getter and setter for State in the form bean...now
>>>   
>>>
>>>  
>>>
>>you
>> 
>>
>>
>>
>>>need to setState("TX") in the action class if you want to have Texas as a
>>>default state.
>>>
>>>-Original Message-
>>>From: [EMAIL PROTECTED]
>>>[mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 10:28 AM
>>>To: [EMAIL PROTECTED]
>>>Subject: RE: How do I set the default selection when I'm using
>>>   
>>>
>>>  
>>>
>>html:options?
>> 
>>
>>
>>
>>>You can add in an  tag above the  tag that
>>>will be the default.
>>>
>>>
>>>
>>>-Original Message-
>>>From: mleejr [mailto:[EMAIL PROTECTED]]
>>>Sent: Wednesday, September 18, 2002 11:21 AM
>>>To: struts-user
>>>Subject: How do I set the default selection when I'm using html:options?
>>>
>>>
>>>1) How do I set a default value in an html:select on an options list? I
>>>need the default state to be the one loaded from the struts form.
>>>It doesn't like this.
>>>
>>>
>>>  
>>>
>>>
>>>thanks everyone,
>>>Mike
>>>
>>>
>>>--
>>>To unsubscribe, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>For additional commands, e-mail:
>>><mailto:[EMAIL PROTECTED]>
>>>
>>>
>>>_
>>>Introducing the all new and improved continental.com.  With a totally new
>>>personalized design, it's the best place to go. Before you go.
>>>
>>>Continental Airlines. Work Hard. Fly Right.
>>>
>>>http://www.continental.com
>>>
>>>
>>>   
>>>
>>>  
>>>
>>--
>>To unsubscribe, e-mail:
>>
>>
><mailto:[EMAIL PROTECTED]>
>  
>
>>For additional commands, e-mail:
>>
>>
><mailto:[EMAIL PROTECTED]>
>  
>
>> 
>>
>>
>>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>


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




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-18 Thread Galbreath, Mark

In your Action class, call a data access object to get a ResultSet from your
database containing all the states and pass them as a List.

Action class:
myDAO dao = new myDAO();
dao.getStates();


DAO:
public List getStates() throws SQLException {
  List states = new ArrayList();

  while( rs.next()) {
states.add( rs.getString( "[name of db column containing states]");
  }
  return states;
}

Action class:
MyActionForm actionForm = (MyActionForm) form;
form.setStates( states);

ActionForm class:
private List states = null;
public void setStates( List states){
  this.states = states;
}
public List getStates(){
  return states;
}

JSP:

  Select A State
  


Mark

-Original Message-
From: Jan Fetyko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 2:22 PM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


Can you post some code : what are the values of the states, what is the 
definitions in the form, how you're setting the default value , etc.

Jf

Michael Lee wrote:

>Thanks, but nada.
>The ActionForm state is set yet its still not working. :(
>Is the problem with the options?
> 
>
>  
>
>- Original Message -
>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Sent: Wednesday, September 18, 2002 11:31 AM
>Subject: RE: How do I set the default selection when I'm using
html:options?
>
>
>  
>
>>You need to populate the value of the property of the dropdown before the
>>jsp is render...the best way to do this is in the action class.
>>
>>For example, you have getter and setter for State in the form bean...now
>>
>>
>you
>  
>
>>need to setState("TX") in the action class if you want to have Texas as a
>>default state.
>>
>>-Original Message-
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 18, 2002 10:28 AM
>>To: [EMAIL PROTECTED]
>>Subject: RE: How do I set the default selection when I'm using
>>
>>
>html:options?
>  
>
>>You can add in an  tag above the  tag that
>>will be the default.
>>
>>
>>
>>-Original Message-
>>From: mleejr [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 18, 2002 11:21 AM
>>To: struts-user
>>Subject: How do I set the default selection when I'm using html:options?
>>
>>
>> 1) How do I set a default value in an html:select on an options list? I
>>need the default state to be the one loaded from the struts form.
>>It doesn't like this.
>>
>>
>>   
>> 
>>
>>thanks everyone,
>>Mike
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>
>>
>>_
>>Introducing the all new and improved continental.com.  With a totally new
>>personalized design, it's the best place to go. Before you go.
>>
>>Continental Airlines. Work Hard. Fly Right.
>>
>>http://www.continental.com
>>
>>
>>
>>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>  
>


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

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




Re: AAAARGH! SOMEONE! How do I set the default selection when I'musing html:options?

2002-09-18 Thread Jan Fetyko

Can you post some code : what are the values of the states, what is the 
definitions in the form, how you're setting the default value , etc.

Jf

Michael Lee wrote:

>Thanks, but nada.
>The ActionForm state is set yet its still not working. :(
>Is the problem with the options?
> 
>
>  
>
>- Original Message -
>From: "Hoang, Hai" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Sent: Wednesday, September 18, 2002 11:31 AM
>Subject: RE: How do I set the default selection when I'm using html:options?
>
>
>  
>
>>You need to populate the value of the property of the dropdown before the
>>jsp is render...the best way to do this is in the action class.
>>
>>For example, you have getter and setter for State in the form bean...now
>>
>>
>you
>  
>
>>need to setState("TX") in the action class if you want to have Texas as a
>>default state.
>>
>>-Original Message-
>>From: [EMAIL PROTECTED]
>>[mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 18, 2002 10:28 AM
>>To: [EMAIL PROTECTED]
>>Subject: RE: How do I set the default selection when I'm using
>>
>>
>html:options?
>  
>
>>You can add in an  tag above the  tag that
>>will be the default.
>>
>>
>>
>>-Original Message-
>>From: mleejr [mailto:[EMAIL PROTECTED]]
>>Sent: Wednesday, September 18, 2002 11:21 AM
>>To: struts-user
>>Subject: How do I set the default selection when I'm using html:options?
>>
>>
>> 1) How do I set a default value in an html:select on an options list? I
>>need the default state to be the one loaded from the struts form.
>>It doesn't like this.
>>
>>
>>   
>> 
>>
>>thanks everyone,
>>Mike
>>
>>
>>--
>>To unsubscribe, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail:
>><mailto:[EMAIL PROTECTED]>
>>
>>
>>_
>>Introducing the all new and improved continental.com.  With a totally new
>>personalized design, it's the best place to go. Before you go.
>>
>>Continental Airlines. Work Hard. Fly Right.
>>
>>http://www.continental.com
>>
>>
>>
>>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>  
>


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




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-18 Thread Sri Sankaran

The default value of a  is driven by the value of its property attribute. 
 So, for example, if you have


  Blood
  Leaves
  Sky


and if the 'userChoice' property of the form bean is set to "green", then the default 
selection will show "Leaves".

Please see html-select.jsp that is part of the struts-exercise-taglib war that ships 
with Struts.

Sri

-Original Message-
From: Michael Lee [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 18, 2002 12:55 PM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when I'm using 
html:options?


Thanks, but nada.
The ActionForm state is set yet its still not working. :(
Is the problem with the options?
 

  

- Original Message -
From: "Hoang, Hai" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 11:31 AM
Subject: RE: How do I set the default selection when I'm using html:options?


> You need to populate the value of the property of the dropdown before 
> the jsp is render...the best way to do this is in the action class.
>
> For example, you have getter and setter for State in the form 
> bean...now
you
> need to setState("TX") in the action class if you want to have Texas 
> as a default state.
>
> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: RE: How do I set the default selection when I'm using
html:options?
>
>
> You can add in an  tag above the  tag that 
> will be the default.
>
>
>
> -Original Message-
> From: mleejr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using 
> html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? 
> I need the default state to be the one loaded from the struts form. It 
> doesn't like this.
>
> 
>  
> 
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
>
>
> __
> ___
> Introducing the all new and improved continental.com.  With a totally new
> personalized design, it's the best place to go. Before you go.
>
> Continental Airlines. Work Hard. Fly Right.
>
> http://www.continental.com
>
>

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


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




RE: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-18 Thread Richards, Devin N (Devin)

I have a list of countries in my JSP:








And then in my ValidatorForm class's reset() method I have:


ArrayList countries = // list of countries from LDAP
String shippingCountry = // users country from LDAP


When the page displays the  list has all of our countries, with the 
specified country selected.

HTH

-Devin


-Original Message-
From: Michael Lee [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 12:55 PM
To: Struts Users Mailing List
Subject: Re: RGH! SOMEONE! How do I set the default selection when
I'm using html:options?


Thanks, but nada.
The ActionForm state is set yet its still not working. :(
Is the problem with the options?
 

  

- Original Message -
From: "Hoang, Hai" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 11:31 AM
Subject: RE: How do I set the default selection when I'm using html:options?


> You need to populate the value of the property of the dropdown before the
> jsp is render...the best way to do this is in the action class.
>
> For example, you have getter and setter for State in the form bean...now
you
> need to setState("TX") in the action class if you want to have Texas as a
> default state.
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: RE: How do I set the default selection when I'm using
html:options?
>
>
> You can add in an  tag above the  tag that
> will be the default.
>
>
>
> -Original Message-
> From: mleejr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? I
> need the default state to be the one loaded from the struts form.
> It doesn't like this.
>
> 
>
>  
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> _
> Introducing the all new and improved continental.com.  With a totally new
> personalized design, it's the best place to go. Before you go.
>
> Continental Airlines. Work Hard. Fly Right.
>
> http://www.continental.com
>
>

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

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




RE: How do I set the default selection when I'm using html:options?

2002-09-18 Thread wbchmura


So...

Is that a problem?  I almost think that with something like states you 
would want it to appear as the default and then also in the normal order 
of states...   



-Original Message-
From: mleejr [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 12:56 PM
To: struts-user
Subject: Re: How do I set the default selection when I'm using
html:options?


Tried it.
Problem with that is you now get 2 options that are the same.
ie:
GA
AK
AL

GA

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 11:28 AM
Subject: RE: How do I set the default selection when I'm using 
html:options?


>
> You can add in an  tag above the  tag that
> will be the default.
>
>
>
> -Original Message-
> From: mleejr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using 
html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? 
I
> need the default state to be the one loaded from the struts form.
> It doesn't like this.
>
> 
>
>  
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

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



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




Re: How do I set the default selection when I'm using html:options?

2002-09-18 Thread Michael Lee

Tried it.
Problem with that is you now get 2 options that are the same.
ie:
GA
AK
AL

GA

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 11:28 AM
Subject: RE: How do I set the default selection when I'm using html:options?


>
> You can add in an  tag above the  tag that
> will be the default.
>
>
>
> -Original Message-
> From: mleejr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? I
> need the default state to be the one loaded from the struts form.
> It doesn't like this.
>
> 
>
>  
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

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




Re: AAAARGH! SOMEONE! How do I set the default selection when I'm using html:options?

2002-09-18 Thread Michael Lee

Thanks, but nada.
The ActionForm state is set yet its still not working. :(
Is the problem with the options?
 

  

- Original Message -
From: "Hoang, Hai" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 11:31 AM
Subject: RE: How do I set the default selection when I'm using html:options?


> You need to populate the value of the property of the dropdown before the
> jsp is render...the best way to do this is in the action class.
>
> For example, you have getter and setter for State in the form bean...now
you
> need to setState("TX") in the action class if you want to have Texas as a
> default state.
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: RE: How do I set the default selection when I'm using
html:options?
>
>
> You can add in an  tag above the  tag that
> will be the default.
>
>
>
> -Original Message-
> From: mleejr [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, September 18, 2002 11:21 AM
> To: struts-user
> Subject: How do I set the default selection when I'm using html:options?
>
>
>  1) How do I set a default value in an html:select on an options list? I
> need the default state to be the one loaded from the struts form.
> It doesn't like this.
>
> 
>
>  
>
> thanks everyone,
> Mike
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> _
> Introducing the all new and improved continental.com.  With a totally new
> personalized design, it's the best place to go. Before you go.
>
> Continental Airlines. Work Hard. Fly Right.
>
> http://www.continental.com
>
>

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




RE: How do I set the default selection when I'm using html:options?

2002-09-18 Thread Hoang, Hai

You need to populate the value of the property of the dropdown before the
jsp is render...the best way to do this is in the action class.

For example, you have getter and setter for State in the form bean...now you
need to setState("TX") in the action class if you want to have Texas as a
default state.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 18, 2002 10:28 AM
To: [EMAIL PROTECTED]
Subject: RE: How do I set the default selection when I'm using html:options?


You can add in an  tag above the  tag that 
will be the default.



-Original Message-
From: mleejr [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 11:21 AM
To: struts-user
Subject: How do I set the default selection when I'm using html:options?


 1) How do I set a default value in an html:select on an options list? I
need the default state to be the one loaded from the struts form.
It doesn't like this.


   
 

thanks everyone,
Mike


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


_
Introducing the all new and improved continental.com.  With a totally new 
personalized design, it's the best place to go. Before you go.

Continental Airlines. Work Hard. Fly Right.

http://www.continental.com




RE: How do I set the default selection when I'm using html:options?

2002-09-18 Thread wbchmura


You can add in an  tag above the  tag that 
will be the default.



-Original Message-
From: mleejr [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 11:21 AM
To: struts-user
Subject: How do I set the default selection when I'm using html:options?


 1) How do I set a default value in an html:select on an options list? I
need the default state to be the one loaded from the struts form.
It doesn't like this.


   
 

thanks everyone,
Mike


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




How do I set the default selection when I'm using html:options?

2002-09-18 Thread Michael Lee

 1) How do I set a default value in an html:select on an options list? I
need the default state to be the one loaded from the struts form.
It doesn't like this.


   
 

thanks everyone,
Mike


RE: HELP! html:options with a hashmap

2002-09-12 Thread Joe Barefoot

> I agree but it's not in a form, it's pulled from a helper class.

Ok, good reason to ignore my suggestion. :)

> I did a little research since you told me about the 
> entrySet() in HashMap.
> Since there are no get/set methods in HashMap/Set I thought 
> that "key" and
> "value" were just reserved words in struts. This kind of 
> bugged me since it
> seemed to deviate from the whole struts/jsp introspection 
> model. I figured I
> was missing something and so I looked into entrySet() and 
> this acutally uses
> a HashMap internal class called Map.Entry. The javadocs for 
> this are under
> java.util.Map.Entry. 

That's why I sent you a link to the javadocs in my response, and how I knew the 
attribute values should be "value" and  "key".  ;)  I figured you being a smart dude, 
you'd rather figure it out yourself, which you did in about 5 mins.

> In the javadocs show Map.Entry has a getKey and
> getValue method. I let out a big 'ah' when I saw that. It 
> all makes
> sense now. That's why it works and why you can just use a 
> HashMap as long as
> you use "key" and "value" (the getKey getValue internal to 
> HashMap). I never
> would have found this without that clue (entrySet()). I've included my
> updated code below...

Isn't it nice to feel like Sherlock Holmes? :)  I love javadocs, they rule.

> 
>  // This gets a HashMap and puts it in a variable called 
> alluserRoles
> <%
>   pageContext.setAttribute("allUserRoles",
> Lookup.getData(Constant.USER.USER_ROLES));
> %>
> .
> 
>labelProperty="value"/>
> 
> 
> If you use lots of static data, like dereferencing lists in a 
> database, then
> this is very handy.
> you da man,
> Mike


Thanks.  Happy coding to you!


peace,
Joe


> 
> - Original Message -
> From: "Joe Barefoot" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, September 12, 2002 5:32 PM
> Subject: RE: HELP! html:options with a hashmap
> 
> 
> Cool.  Glad it works.  You could probably do away with the scriplet by
> adding another property getter in your action form though, call it
> getAllUserRolesKeysAsCollection, or some such title, and just return
> myHashMap.entrySet().  To be honest, I've never used a 
> Hashmap like this in
> Struts.  I've always used an ArrayList for the Collection, 
> populated with
> KeyValuePair objects (with key/value getters).  Good to know 
> it can be done.
> 
> peace,
> joe
> 
> 
> > -Original Message-
> > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 12, 2002 1:42 PM
> > To: Struts Users Mailing List
> > Subject: Re: HELP! html:options with a hashmap
> >
> >
> > Wow! This worked like a champ! What I was doing was actually
> > not what you
> > were saying. What I was doing was much more complicated. 
> This is MUCH
> > cleaner.
> >
> > The thing I didn't know about we're the "key" and "value"
> > names. I found the
> > "value" one but didn't understand exactly how to use it. I
> > found the only
> > pertinent example on some spanish web site. I tried to figure
> > out what they
> > were doing but to no avail. (Hey Marc, how's that for well
> > documented?)
> >
> > Anyway, here's the code for all to enjoy;
> > ...
> > ***This section gets the HashMap with the
> > Lookup.getData() method
> > then calls .entrySet()*
> > <%
> > pageContext.setAttribute("allUserRolesKeys",
> > Lookup.getData(Constant.USER.USER_ROLES).entrySet());
> > %>
> > 
> > 
> >> labelProperty="value"/>
> > 
> >
> > Thanks again Joe,
> > Mike
> >
> > - Original Message -
> > From: "Joe Barefoot" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, September 12, 2002 3:51 PM
> > Subject: RE: HELP! html:options with a hashmap
> >
> >
> > You don't see an example because html:options expects a
> > *Collection*, not a
> > Map.  I have no idea if the tag works with a Map, but it
> > probably doesn't
> > because it expects a Collection object.  If you want to use a Map
> > implementation (like HashMap), then your property getter 
> should return
> > myHashMap.entrySet() and you should set th

Re: HELP! html:options with a hashmap

2002-09-12 Thread Michael Lee

I agree but it's not in a form, it's pulled from a helper class.
I did a little research since you told me about the entrySet() in HashMap.
Since there are no get/set methods in HashMap/Set I thought that "key" and
"value" were just reserved words in struts. This kind of bugged me since it
seemed to deviate from the whole struts/jsp introspection model. I figured I
was missing something and so I looked into entrySet() and this acutally uses
a HashMap internal class called Map.Entry. The javadocs for this are under
java.util.Map.Entry. In the javadocs show Map.Entry has a getKey and
getValue method. I let out a big 'ah' when I saw that. It all makes
sense now. That's why it works and why you can just use a HashMap as long as
you use "key" and "value" (the getKey getValue internal to HashMap). I never
would have found this without that clue (entrySet()). I've included my
updated code below...

 // This gets a HashMap and puts it in a variable called alluserRoles
<%
  pageContext.setAttribute("allUserRoles",
Lookup.getData(Constant.USER.USER_ROLES));
%>
.

  


If you use lots of static data, like dereferencing lists in a database, then
this is very handy.
you da man,
Mike

- Original Message -
From: "Joe Barefoot" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 5:32 PM
Subject: RE: HELP! html:options with a hashmap


Cool.  Glad it works.  You could probably do away with the scriplet by
adding another property getter in your action form though, call it
getAllUserRolesKeysAsCollection, or some such title, and just return
myHashMap.entrySet().  To be honest, I've never used a Hashmap like this in
Struts.  I've always used an ArrayList for the Collection, populated with
KeyValuePair objects (with key/value getters).  Good to know it can be done.

peace,
joe


> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 1:42 PM
> To: Struts Users Mailing List
> Subject: Re: HELP! html:options with a hashmap
>
>
> Wow! This worked like a champ! What I was doing was actually
> not what you
> were saying. What I was doing was much more complicated. This is MUCH
> cleaner.
>
> The thing I didn't know about we're the "key" and "value"
> names. I found the
> "value" one but didn't understand exactly how to use it. I
> found the only
> pertinent example on some spanish web site. I tried to figure
> out what they
> were doing but to no avail. (Hey Marc, how's that for well
> documented?)
>
> Anyway, here's the code for all to enjoy;
> ...
> ***This section gets the HashMap with the
> Lookup.getData() method
> then calls .entrySet()*
> <%
> pageContext.setAttribute("allUserRolesKeys",
> Lookup.getData(Constant.USER.USER_ROLES).entrySet());
> %>
> 
> 
>labelProperty="value"/>
> 
>
> Thanks again Joe,
> Mike
>
> - Original Message -
> From: "Joe Barefoot" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, September 12, 2002 3:51 PM
> Subject: RE: HELP! html:options with a hashmap
>
>
> You don't see an example because html:options expects a
> *Collection*, not a
> Map.  I have no idea if the tag works with a Map, but it
> probably doesn't
> because it expects a Collection object.  If you want to use a Map
> implementation (like HashMap), then your property getter should return
> myHashMap.entrySet() and you should set these attributes in the
> : property="value" labelProperty="key".
> Something like
> that.
>
> http://java.sun.com/j2se/1.3/docs/api/index.html
>
>
> Struts javadocs are quite verbose:
>
> http://jakarta.apache.org/struts/doc-1.0.2/api/index.html
>
> Click on any of the taglib packages in the top left frame,
> then the package
> name in the bottom left frame, then the "Description" link
> that comes up in
> the right frame.  Gets you descriptions of any tag.  You can
> reach these
> throught the Struts site as well.
>
> peace,
> Joe
>
>
>
> > -Original Message-
> > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 12, 2002 10:53 AM
> > To: Struts Users Mailing List
> > Subject: HELP! html:options with a hashmap
> >
> >
> > I posted this before but haven't heard anything. Thought I
> > would put up the error message too. What name do I put for
> > name? The exam

RE: HELP! html:options with a hashmap

2002-09-12 Thread Joe Barefoot

Guess I should've mentioned:

Doing it the way below, you'd still need this tag so's the options tag can 'see' the 
collection:




IMHO, the attributes for the options tag was not very well thought out, particularly 
because it does not adhere to the standard name/property way of specifying something 
from your form bean, the way nearly every other tag does.

peace,
Joe

> -Original Message-
> From: Joe Barefoot 
> Sent: Thursday, September 12, 2002 2:32 PM
> To: Struts Users Mailing List
> Subject: RE: HELP! html:options with a hashmap
> 
> 
> Cool.  Glad it works.  You could probably do away with the 
> scriplet by adding another property getter in your action 
> form though, call it getAllUserRolesKeysAsCollection, or some 
> such title, and just return myHashMap.entrySet().  To be 
> honest, I've never used a Hashmap like this in Struts.  I've 
> always used an ArrayList for the Collection, populated with 
> KeyValuePair objects (with key/value getters).  Good to know 
> it can be done.
> 
> peace,
> joe
> 
> 
> > -Original Message-
> > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 12, 2002 1:42 PM
> > To: Struts Users Mailing List
> > Subject: Re: HELP! html:options with a hashmap
> > 
> > 
> > Wow! This worked like a champ! What I was doing was actually 
> > not what you
> > were saying. What I was doing was much more complicated. 
> This is MUCH
> > cleaner.
> > 
> > The thing I didn't know about we're the "key" and "value" 
> > names. I found the
> > "value" one but didn't understand exactly how to use it. I 
> > found the only
> > pertinent example on some spanish web site. I tried to figure 
> > out what they
> > were doing but to no avail. (Hey Marc, how's that for well 
> > documented?)
> > 
> > Anyway, here's the code for all to enjoy;
> > ...
> > ***This section gets the HashMap with the 
> > Lookup.getData() method
> > then calls .entrySet()*
> > <%
> > pageContext.setAttribute("allUserRolesKeys",
> > Lookup.getData(Constant.USER.USER_ROLES).entrySet());
> > %>
> > 
> > 
> >> labelProperty="value"/>
> > 
> > 
> > Thanks again Joe,
> > Mike
> > 
> > - Original Message -
> > From: "Joe Barefoot" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, September 12, 2002 3:51 PM
> > Subject: RE: HELP! html:options with a hashmap
> > 
> > 
> > You don't see an example because html:options expects a 
> > *Collection*, not a
> > Map.  I have no idea if the tag works with a Map, but it 
> > probably doesn't
> > because it expects a Collection object.  If you want to use a Map
> > implementation (like HashMap), then your property getter 
> should return
> > myHashMap.entrySet() and you should set these attributes in the
> > : property="value" labelProperty="key".  
> > Something like
> > that.
> > 
> > http://java.sun.com/j2se/1.3/docs/api/index.html
> > 
> > 
> > Struts javadocs are quite verbose:
> > 
> > http://jakarta.apache.org/struts/doc-1.0.2/api/index.html
> > 
> > Click on any of the taglib packages in the top left frame, 
> > then the package
> > name in the bottom left frame, then the "Description" link 
> > that comes up in
> > the right frame.  Gets you descriptions of any tag.  You can 
> > reach these
> > throught the Struts site as well.
> > 
> > peace,
> > Joe
> > 
> > 
> > 
> > > -Original Message-
> > > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > > Sent: Thursday, September 12, 2002 10:53 AM
> > > To: Struts Users Mailing List
> > > Subject: HELP! html:options with a hashmap
> > >
> > >
> > > I posted this before but haven't heard anything. Thought I
> > > would put up the error message too. What name do I put for
> > > name? The examples don't use a hashmap (seems logical for
> > > 'options'). When I put name it does the name and value. I
> > > want it to put the name under name and value under value, not
> > > both in the drop down.
> > >
> > > I want to populate an  with data from a Map
> > > (HashMap). I have
> > >
> > > ...
> > > <% 

RE: HELP! html:options with a hashmap

2002-09-12 Thread Joe Barefoot

Cool.  Glad it works.  You could probably do away with the scriplet by adding another 
property getter in your action form though, call it getAllUserRolesKeysAsCollection, 
or some such title, and just return myHashMap.entrySet().  To be honest, I've never 
used a Hashmap like this in Struts.  I've always used an ArrayList for the Collection, 
populated with KeyValuePair objects (with key/value getters).  Good to know it can be 
done.

peace,
joe


> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 1:42 PM
> To: Struts Users Mailing List
> Subject: Re: HELP! html:options with a hashmap
> 
> 
> Wow! This worked like a champ! What I was doing was actually 
> not what you
> were saying. What I was doing was much more complicated. This is MUCH
> cleaner.
> 
> The thing I didn't know about we're the "key" and "value" 
> names. I found the
> "value" one but didn't understand exactly how to use it. I 
> found the only
> pertinent example on some spanish web site. I tried to figure 
> out what they
> were doing but to no avail. (Hey Marc, how's that for well 
> documented?)
> 
> Anyway, here's the code for all to enjoy;
> ...
> ***This section gets the HashMap with the 
> Lookup.getData() method
> then calls .entrySet()*
> <%
> pageContext.setAttribute("allUserRolesKeys",
> Lookup.getData(Constant.USER.USER_ROLES).entrySet());
> %>
> 
> 
>labelProperty="value"/>
> 
> 
> Thanks again Joe,
> Mike
> 
> - Original Message -
> From: "Joe Barefoot" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, September 12, 2002 3:51 PM
> Subject: RE: HELP! html:options with a hashmap
> 
> 
> You don't see an example because html:options expects a 
> *Collection*, not a
> Map.  I have no idea if the tag works with a Map, but it 
> probably doesn't
> because it expects a Collection object.  If you want to use a Map
> implementation (like HashMap), then your property getter should return
> myHashMap.entrySet() and you should set these attributes in the
> : property="value" labelProperty="key".  
> Something like
> that.
> 
> http://java.sun.com/j2se/1.3/docs/api/index.html
> 
> 
> Struts javadocs are quite verbose:
> 
> http://jakarta.apache.org/struts/doc-1.0.2/api/index.html
> 
> Click on any of the taglib packages in the top left frame, 
> then the package
> name in the bottom left frame, then the "Description" link 
> that comes up in
> the right frame.  Gets you descriptions of any tag.  You can 
> reach these
> throught the Struts site as well.
> 
> peace,
> Joe
> 
> 
> 
> > -Original Message-
> > From: Michael Lee [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, September 12, 2002 10:53 AM
> > To: Struts Users Mailing List
> > Subject: HELP! html:options with a hashmap
> >
> >
> > I posted this before but haven't heard anything. Thought I
> > would put up the error message too. What name do I put for
> > name? The examples don't use a hashmap (seems logical for
> > 'options'). When I put name it does the name and value. I
> > want it to put the name under name and value under value, not
> > both in the drop down.
> >
> > I want to populate an  with data from a Map
> > (HashMap). I have
> >
> > ...
> > <% pageContext.setAttribute("allUserRoles",
> > Lookup.getData(Constant.USER.USER_ROLES)); %>
> > ...
> > 
> > 
> >   
> > 
> >
> > I don't see an example in the struts-exercise-taglib.war
> > under html:select
> > It is vector or Object[].
> > Ideas?
> > thanks,
> > Mike
> >
> >   
> > <[WebAppServletContext(2285117,rece
> > iptsplus,/receiptsplus)] Servlet failed with Exception
> > java.lang.IllegalArgumentException: No name specified
> > at
> > 
> org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
> > java:405)
> > at
> > 
> org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
> > 53)
> > at
> > 
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
> > )
> > at
> > jsp_servlet.__create_user._jspService(__create_user.java:395)
> > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> >
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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




RE: HashMap with html:options? Anyone? **crickets**

2002-09-12 Thread Galbreath, Mark



Mark

-Original Message-
From: Michael Lee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 3:55 PM
To: Struts Users Mailing List
Subject: Re: HashMap with html:options? Anyone? **crickets**


I searched. All I got was one response from someone saying it cant be done.
I don't believe that.
Anyone else know how to do this?

- Original Message -
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 3:25 PM
Subject: RE: HashMap with html:options? Anyone? **crickets**


> This issue is well documented in the archive.
>
> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 3:18 PM
> To: Struts Users Mailing List
> Subject: HashMap with html:options? Anyone? **crickets**
>
>
> I have looked through all the docs, javadocs, examples, google searches
and
> nada.
> Anyone know how to use html:options with a HashMap. I have tried about
every
> combination I can think of.
> Thanks,
> Mike
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

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

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




Re: HELP! html:options with a hashmap

2002-09-12 Thread Michael Lee

Wow! This worked like a champ! What I was doing was actually not what you
were saying. What I was doing was much more complicated. This is MUCH
cleaner.

The thing I didn't know about we're the "key" and "value" names. I found the
"value" one but didn't understand exactly how to use it. I found the only
pertinent example on some spanish web site. I tried to figure out what they
were doing but to no avail. (Hey Marc, how's that for well documented?)

Anyway, here's the code for all to enjoy;
...
***This section gets the HashMap with the Lookup.getData() method
then calls .entrySet()*
<%
pageContext.setAttribute("allUserRolesKeys",
Lookup.getData(Constant.USER.USER_ROLES).entrySet());
%>


  


Thanks again Joe,
Mike

- Original Message -
From: "Joe Barefoot" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 3:51 PM
Subject: RE: HELP! html:options with a hashmap


You don't see an example because html:options expects a *Collection*, not a
Map.  I have no idea if the tag works with a Map, but it probably doesn't
because it expects a Collection object.  If you want to use a Map
implementation (like HashMap), then your property getter should return
myHashMap.entrySet() and you should set these attributes in the
: property="value" labelProperty="key".  Something like
that.

http://java.sun.com/j2se/1.3/docs/api/index.html


Struts javadocs are quite verbose:

http://jakarta.apache.org/struts/doc-1.0.2/api/index.html

Click on any of the taglib packages in the top left frame, then the package
name in the bottom left frame, then the "Description" link that comes up in
the right frame.  Gets you descriptions of any tag.  You can reach these
throught the Struts site as well.

peace,
Joe



> -Original Message-----
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 10:53 AM
> To: Struts Users Mailing List
> Subject: HELP! html:options with a hashmap
>
>
> I posted this before but haven't heard anything. Thought I
> would put up the error message too. What name do I put for
> name? The examples don't use a hashmap (seems logical for
> 'options'). When I put name it does the name and value. I
> want it to put the name under name and value under value, not
> both in the drop down.
>
> I want to populate an  with data from a Map
> (HashMap). I have
>
> ...
> <% pageContext.setAttribute("allUserRoles",
> Lookup.getData(Constant.USER.USER_ROLES)); %>
> ...
> 
> 
>   
> 
>
> I don't see an example in the struts-exercise-taglib.war
> under html:select
> It is vector or Object[].
> Ideas?
> thanks,
> Mike
>
>   
> <[WebAppServletContext(2285117,rece
> iptsplus,/receiptsplus)] Servlet failed with Exception
> java.lang.IllegalArgumentException: No name specified
> at
> org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
> java:405)
> at
> org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
> 53)
> at
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
> )
> at
> jsp_servlet.__create_user._jspService(__create_user.java:395)
> at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>

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


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




Re: HELP! html:options with a hashmap

2002-09-12 Thread Michael Lee

Hmm, that's the way I'm trying/having to do it now, it just seems logical
that it would use the keys as the html option value and the map values as
labels by default. Oh well.
Ok, kinda depressing (We have to do this A LOT). Thanks for your help Joe.
Mike

- Original Message -
From: "Joe Barefoot" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 3:51 PM
Subject: RE: HELP! html:options with a hashmap


You don't see an example because html:options expects a *Collection*, not a
Map.  I have no idea if the tag works with a Map, but it probably doesn't
because it expects a Collection object.  If you want to use a Map
implementation (like HashMap), then your property getter should return
myHashMap.entrySet() and you should set these attributes in the
: property="value" labelProperty="key".  Something like
that.

http://java.sun.com/j2se/1.3/docs/api/index.html


Struts javadocs are quite verbose:

http://jakarta.apache.org/struts/doc-1.0.2/api/index.html

Click on any of the taglib packages in the top left frame, then the package
name in the bottom left frame, then the "Description" link that comes up in
the right frame.  Gets you descriptions of any tag.  You can reach these
throught the Struts site as well.

peace,
Joe



> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 10:53 AM
> To: Struts Users Mailing List
> Subject: HELP! html:options with a hashmap
>
>
> I posted this before but haven't heard anything. Thought I
> would put up the error message too. What name do I put for
> name? The examples don't use a hashmap (seems logical for
> 'options'). When I put name it does the name and value. I
> want it to put the name under name and value under value, not
> both in the drop down.
>
> I want to populate an  with data from a Map
> (HashMap). I have
>
> ...
> <% pageContext.setAttribute("allUserRoles",
> Lookup.getData(Constant.USER.USER_ROLES)); %>
> ...
> 
> 
>   
> 
>
> I don't see an example in the struts-exercise-taglib.war
> under html:select
> It is vector or Object[].
> Ideas?
> thanks,
> Mike
>
>   
> <[WebAppServletContext(2285117,rece
> iptsplus,/receiptsplus)] Servlet failed with Exception
> java.lang.IllegalArgumentException: No name specified
> at
> org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
> java:405)
> at
> org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
> 53)
> at
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
> )
> at
> jsp_servlet.__create_user._jspService(__create_user.java:395)
> at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
>

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


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




Re: HashMap with html:options? Anyone? **crickets**

2002-09-12 Thread Michael Lee

I searched. All I got was one response from someone saying it cant be done.
I don't believe that.
Anyone else know how to do this?

- Original Message -
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, September 12, 2002 3:25 PM
Subject: RE: HashMap with html:options? Anyone? **crickets**


> This issue is well documented in the archive.
>
> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 3:18 PM
> To: Struts Users Mailing List
> Subject: HashMap with html:options? Anyone? **crickets**
>
>
> I have looked through all the docs, javadocs, examples, google searches
and
> nada.
> Anyone know how to use html:options with a HashMap. I have tried about
every
> combination I can think of.
> Thanks,
> Mike
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

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




RE: HELP! html:options with a hashmap

2002-09-12 Thread Joe Barefoot

You don't see an example because html:options expects a *Collection*, not a Map.  I 
have no idea if the tag works with a Map, but it probably doesn't because it expects a 
Collection object.  If you want to use a Map implementation (like HashMap), then your 
property getter should return myHashMap.entrySet() and you should set these attributes 
in the : property="value" labelProperty="key".  Something like that.

http://java.sun.com/j2se/1.3/docs/api/index.html


Struts javadocs are quite verbose:

http://jakarta.apache.org/struts/doc-1.0.2/api/index.html

Click on any of the taglib packages in the top left frame, then the package name in 
the bottom left frame, then the "Description" link that comes up in the right frame.  
Gets you descriptions of any tag.  You can reach these throught the Struts site as 
well.

peace,
Joe



> -Original Message-
> From: Michael Lee [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 10:53 AM
> To: Struts Users Mailing List
> Subject: HELP! html:options with a hashmap
> 
> 
> I posted this before but haven't heard anything. Thought I 
> would put up the error message too. What name do I put for 
> name? The examples don't use a hashmap (seems logical for 
> 'options'). When I put name it does the name and value. I 
> want it to put the name under name and value under value, not 
> both in the drop down.
> 
> I want to populate an  with data from a Map 
> (HashMap). I have
> 
> ...
> <% pageContext.setAttribute("allUserRoles", 
> Lookup.getData(Constant.USER.USER_ROLES)); %>
> ...
> 
> 
>   
> 
> 
> I don't see an example in the struts-exercise-taglib.war 
> under html:select
> It is vector or Object[].
> Ideas?
> thanks,
> Mike
> 
>
> <[WebAppServletContext(2285117,rece
> iptsplus,/receiptsplus)] Servlet failed with Exception
> java.lang.IllegalArgumentException: No name specified
> at 
> org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
> java:405)
> at 
> org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
> 53)
> at 
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
> )
> at 
> jsp_servlet.__create_user._jspService(__create_user.java:395)
> at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> 

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




RE: HashMap with html:options? Anyone? **crickets**

2002-09-12 Thread Galbreath, Mark

This issue is well documented in the archive.

-Original Message-
From: Michael Lee [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 3:18 PM
To: Struts Users Mailing List
Subject: HashMap with html:options? Anyone? **crickets**


I have looked through all the docs, javadocs, examples, google searches and
nada.
Anyone know how to use html:options with a HashMap. I have tried about every
combination I can think of.
Thanks,
Mike

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




HashMap with html:options? Anyone? **crickets**

2002-09-12 Thread Michael Lee

I have looked through all the docs, javadocs, examples, google searches and nada.
Anyone know how to use html:options with a HashMap. I have tried about every 
combination I can think of.
Thanks,
Mike



HELP! html:options with a hashmap

2002-09-12 Thread Michael Lee

I posted this before but haven't heard anything. Thought I would put up the error 
message too. What name do I put for name? The examples don't use a hashmap (seems 
logical for 'options'). When I put name it does the name and value. I want it to put 
the name under name and value under value, not both in the drop down.

I want to populate an  with data from a Map (HashMap). I have

...
<% pageContext.setAttribute("allUserRoles", Lookup.getData(Constant.USER.USER_ROLES)); 
%>
...


  


I don't see an example in the struts-exercise-taglib.war under html:select
It is vector or Object[].
Ideas?
thanks,
Mike

   <[WebAppServletContext(2285117,rece
iptsplus,/receiptsplus)] Servlet failed with Exception
java.lang.IllegalArgumentException: No name specified
at org.apache.struts.util.PropertyUtils.getNestedProperty(PropertyUtils.
java:405)
at org.apache.struts.util.PropertyUtils.getProperty(PropertyUtils.java:4
53)
at org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:230
)
at jsp_servlet.__create_user._jspService(__create_user.java:395)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)



html:options question

2002-09-12 Thread Michael Lee

I want to populate an  with data from a Map (HashMap). I have

...
<% pageContext.setAttribute("allUserRoles", Lookup.getData(Constant.USER.USER_ROLES)); 
%>
...


  


I don't see an example in the struts-exercise-taglib.war under html:select
It is vector or Object[].
Ideas?
thanks,
Mike




Re: Help with html:options

2002-09-04 Thread Matt Veitas

Change the attribute "name"  to "collection" and it should work.

This tag operates in one of two major modes, depending on whether or not 
the |collection| attribute is specified. If the |collection| attribute 
is included, the following rules apply:

* The *collection* attribute is interpreted as the name of a JSP
  bean, in some scope, that itself represents a collection of
  individual beans, one per option value to be rendered.
* The *property* attribute is interpreted as the name of a property
  of the individual beans included in the collection, and is used to
  retrieve the value that will be returned to the server if this
  option is selected.
* The *labelProperty* attribute is interpreted as the name of a
  property of the individual beans included in the collection, and
  is used to retrieve the label that will be displayed to the user
  for this option. If the |labelProperty| attribute is not
  specified, the property named by the |property| attribute will be
  used to select both the value returned to the server and the label
  displayed to the user for this option.



[EMAIL PROTECTED] wrote:

>hi all,
>
>I am getting the following exception in html:options tag.
>
>[ServletException in:/jsp/EditServerBody.jsp] No getter method available 
>for property value for bean under name nngList' 
>
>This is how I am using it
>
>
>
>Where nngList is of type Vector and it contains elements of type 
>OptionValue which has getValue() and getLabel().
>
>Anything else I am missing.
>
>
>Kamal
>
>
>The information contained in this message may be privileged 
>and confidential and protected from disclosure.  If the 
>reader of this message is not the intended recipient, or an 
>employee or agent responsible for delivering this message to 
>the intended recipient, you are hereby notified that any 
>reproduction, dissemination or distribution of this 
>communication is strictly prohibited. If you have received 
>this communication in error, please notify us immediately by 
>replying to the message and deleting it from your computer.
>
>Thank you.
>Tellabs
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>
>  
>


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




Help with html:options

2002-09-04 Thread Kamal . K . Kang

hi all,

I am getting the following exception in html:options tag.

[ServletException in:/jsp/EditServerBody.jsp] No getter method available 
for property value for bean under name nngList' 

This is how I am using it



Where nngList is of type Vector and it contains elements of type 
OptionValue which has getValue() and getLabel().

Anything else I am missing.


Kamal


The information contained in this message may be privileged 
and confidential and protected from disclosure.  If the 
reader of this message is not the intended recipient, or an 
employee or agent responsible for delivering this message to 
the intended recipient, you are hereby notified that any 
reproduction, dissemination or distribution of this 
communication is strictly prohibited. If you have received 
this communication in error, please notify us immediately by 
replying to the message and deleting it from your computer.

Thank you.
Tellabs


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




html:options

2002-07-16 Thread tsawyer

Hi,

We're trying to use the html:options tag (struts 1.0.2) to render a drop list 
containing the values from a String Tokenizer, which is tokenizing a comma delimited 
string.  We just want a drop list that contains each of the values in the list, with 
the value and description identical.

The behaviour we are seeing is that we are getting half the number of options, because 
the code is sticking the first value from the list as the value, then the second as 
the description, then the third as the second value, and the forth as the second 
description. 

This would appear to be bourne out by this code from the tag itself:

  // Otherwise, use the separate iterators mode to render options
else {

  // Construct iterators for the values and labels collections
  Iterator valuesIterator = getIterator(name, property);
  Iterator labelsIterator = null;
  if ((labelName == null) && (labelProperty == null))
  labelsIterator = getIterator(name, property); // Same coll.
  else
  labelsIterator = getIterator(labelName, labelProperty);

  // Render the options tags for each element of the values coll.
  while (valuesIterator.hasNext()) {
  String value = valuesIterator.next().toString();
  String label = value;
  if (labelsIterator.hasNext())
  label = labelsIterator.next().toString();
  addOption(sb, value, label,
selectTag.isMatched(value));
  }
}

It's using the same iterator for labels and values, and doing a next() twice per row.

Is this a bug?  Am I missing something obvious?

Cheers,

Tim.





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




RE: Html:options question help

2002-06-26 Thread James Mitchell

Try adding type="com.whatever.Engineer"

> 
> labelProperty="name" property="id"/>
>  



HTH

James Mitchell
Software Engineer\Struts Evangelist
Struts-Atlanta, the "Open Minded Developer Network"
http://struts-atlanta.open-tools.org

> -Original Message-
> From: Eyassu, Daniel [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 26, 2002 10:22 AM
> To: [EMAIL PROTECTED]
> Subject: Html:options question help
> 
> 
> IF I have an ActionFrom that looks like
>  
> 
> public class WorkAuthForm extends ActionForm
> {
>  private ArrayList engineers;
> 
> public ArrayList getEngineers()
> {
> return this.engineers;
> }
> 
> public void setEngineers(ArrayList engineers)
> {
> this.engineers = engineers;
> }
>  
> ..
> }
>  
> 
> And engineers are:
> 
> public class Engineer
> {
> 
> private String id;
> 
> private String name;
> 
> /** Creates a new instance of Engineer */
> public Engineer()
> {
> }
> 
> public void setId(String id)
> {
> this.id = id;
> }
> 
> public String getId()
> {
> return id;
> }
> 
> public void setName(String name)
> {
> this.name = name;
> }
> 
> public String getName()
> {
> return name;
> }
> }
>  
> 
> why can"t I do the following:
>  
> 
> 
> labelProperty="name" property="id"/>
>  
>  
> 
> Thanks
> Dan
> 

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




Html:options question help

2002-06-26 Thread Eyassu, Daniel

IF I have an ActionFrom that looks like
 

public class WorkAuthForm extends ActionForm
{
 private ArrayList engineers;

public ArrayList getEngineers()
{
return this.engineers;
}

public void setEngineers(ArrayList engineers)
{
this.engineers = engineers;
}
 
..
}
 

And engineers are:

public class Engineer
{

private String id;

private String name;

/** Creates a new instance of Engineer */
public Engineer()
{
}

public void setId(String id)
{
this.id = id;
}

public String getId()
{
return id;
}

public void setName(String name)
{
this.name = name;
}

public String getName()
{
return name;
}
}
 

why can"t I do the following:
 


   
 
 

Thanks
Dan



Using Hashtable to show html options using struts html:options tag

2002-06-10 Thread Yaman Kumar

Hi,
Can any one suggest me in using Hashtable in html:options tag
to render html options.
I could render with vector but not with Hashtable(key & value are Strings).

TIA
rayaku

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




iterate > arraylist of arrays[] to show html:select and html:options.

2002-06-03 Thread crillo

Hi, how do i iterate on an arrayList of arrays with beans, containg a bean
wich turn contains another bean wich has the attribute i want to show...

the html:select  does'nt seem to be able to reach the attributes of the
elements from the outer iterate.


   


  


any one know how its done?

hate to do it manually with just jsp.

/cv


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: html:options must be enclosed within html:select

2002-05-22 Thread dhay



No, haven't looked yet.  Problem with logic:iterate creating upwards of 1000
options is that it is VERY slow!

Cheers,

Dave





"JM" <[EMAIL PROTECTED]> on 05/22/2002 02:00:22 PM

Please respond to "Struts Users Mailing List"
  <[EMAIL PROTECTED]>

To:   "Struts Users Mailing List"
  <[EMAIL PROTECTED]>
cc:(bcc: David Hay/Lex/Lexmark)
Subject:  RE: html:options must be enclosed within html:select



Have you looked at the source for OptionTag yet?

The first thing it does is check for a SelectTag in the pageContext.
I believe it is forcing this because it needs to know if it should render it
as "selected".

If you need the functionality of Options, but need to write your own select,
I would suggest using logic:iterate.

Hope that helps.


JM

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 22, 2002 12:53 PM
> To: Struts Users Mailing List
> Subject: html:options must be enclosed within html:select
>
>
>
>
> Anyone know why this is the case - ie why html:options won't
> accept a regular
> html  tag to be enclosed in?
>
> Makes it very frustrating when you don't care about value of
> select when it's
> submitted, but want to use html:options for speed to display a
> collection.  You
> have to add a dummy getter in the action form which seems very
> cumbersome at the
> least.
>
> Cheers,
>
> David
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



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








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




RE: html:options must be enclosed within html:select

2002-05-22 Thread JM

Have you looked at the source for OptionTag yet?

The first thing it does is check for a SelectTag in the pageContext.
I believe it is forcing this because it needs to know if it should render it
as "selected".

If you need the functionality of Options, but need to write your own select,
I would suggest using logic:iterate.

Hope that helps.


JM

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 22, 2002 12:53 PM
> To: Struts Users Mailing List
> Subject: html:options must be enclosed within html:select
>
>
>
>
> Anyone know why this is the case - ie why html:options won't
> accept a regular
> html  tag to be enclosed in?
>
> Makes it very frustrating when you don't care about value of
> select when it's
> submitted, but want to use html:options for speed to display a
> collection.  You
> have to add a dummy getter in the action form which seems very
> cumbersome at the
> least.
>
> Cheers,
>
> David
>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



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




html:options must be enclosed within html:select

2002-05-22 Thread dhay



Anyone know why this is the case - ie why html:options won't accept a regular
html  tag to be enclosed in?

Makes it very frustrating when you don't care about value of select when it's
submitted, but want to use html:options for speed to display a collection.  You
have to add a dummy getter in the action form which seems very cumbersome at the
least.

Cheers,

David




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




Re: populating list for html:options tag within FormBean

2002-05-16 Thread Damien VIEL

I think it's what I'm doing ?
companyJob object is doing the DB calls and his methode getAllCompany
returns the ResultSet of the query. Should this methode return the ArrayList
?
Would you give me the subject of the Tread about this subject ?

Dams

- Original Message -
From: "Pruthee, Ranjan" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 7:17 PM
Subject: RE: populating list for html:options tag within FormBean


It is not a good practice to have DB calls in ur Action class. Action Class
belongs to web tier and it should call db layer thru' Business objects via a
Business delegate. There was a good thread couple of weeks ago on this.
After the call is made to the Db and results are returned, u can store the
list as done in the last few lines in this code.

Just my thoughts.
-Ranjan.

-Original Message-
From: Damien VIEL [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 11:59 AM
To: Struts Users Mailing List
Subject: Re: populating list for html:options tag within FormBean


I've created the following Action that will populate my forms :

public final class PrepareFormAction extends Action {

 public ActionForward perform(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

  Locale locale = getLocale(request);
  MessageResources messages = getResources();
  String action = request.getParameter("action");

  if ("addproject".equals(action)) {
   try {
CompanyJob companyJob = new CompanyJob();
ArrayList listcomp = new ArrayList();

ResultSet rs = companyJob.getAllCompany();
while (rs.next()) {
 String name = rs.getString("comp_name");
 String id = rs.getString("comp_id");
 listcomp.add(new LabelValueBean(name,id));
}

request.setAttribute("listcomp", listcomp);
   } catch (SQLException sqle) {
System.err.println("ProjectAction Error >> " + sqle);
   }
   return (mapping.findForward("addproject"));
  }
  return (mapping.findForward("error"));
 }
}

Dams
- Original Message -
From: "Gary Bartlett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 6:27 PM
Subject: populating list for html:options tag within FormBean


> Question -
>
> I saw in an earlier post that someone was populating
> the list for an html:options tag within a FormBean.
> My question is how does the FormBean place the list
> into the context so it is available to the tag ?
>
> I realize this is a pretty basic question, but my only
> frame of reference here is the example where the jsp
> scriptlet creates the list and places it into the
> context with pageContext.setAttribute();
>
> Thanks,
>
> Gary Bartlett
>
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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


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




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




RE: populating list for html:options tag within FormBean

2002-05-15 Thread Pruthee, Ranjan

It is not a good practice to have DB calls in ur Action class. Action Class belongs to 
web tier and it should call db layer thru' Business objects via a Business delegate. 
There was a good thread couple of weeks ago on this. After the call is made to the Db 
and results are returned, u can store the list as done in the last few lines in this 
code.

Just my thoughts.
-Ranjan.

-Original Message-
From: Damien VIEL [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 15, 2002 11:59 AM
To: Struts Users Mailing List
Subject: Re: populating list for html:options tag within FormBean


I've created the following Action that will populate my forms :

public final class PrepareFormAction extends Action {

 public ActionForward perform(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

  Locale locale = getLocale(request);
  MessageResources messages = getResources();
  String action = request.getParameter("action");

  if ("addproject".equals(action)) {
   try {
CompanyJob companyJob = new CompanyJob();
ArrayList listcomp = new ArrayList();

ResultSet rs = companyJob.getAllCompany();
while (rs.next()) {
 String name = rs.getString("comp_name");
 String id = rs.getString("comp_id");
 listcomp.add(new LabelValueBean(name,id));
}

request.setAttribute("listcomp", listcomp);
   } catch (SQLException sqle) {
System.err.println("ProjectAction Error >> " + sqle);
   }
   return (mapping.findForward("addproject"));
  }
  return (mapping.findForward("error"));
 }
}

Dams
- Original Message -
From: "Gary Bartlett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 6:27 PM
Subject: populating list for html:options tag within FormBean


> Question -
>
> I saw in an earlier post that someone was populating
> the list for an html:options tag within a FormBean.
> My question is how does the FormBean place the list
> into the context so it is available to the tag ?
>
> I realize this is a pretty basic question, but my only
> frame of reference here is the example where the jsp
> scriptlet creates the list and places it into the
> context with pageContext.setAttribute();
>
> Thanks,
>
> Gary Bartlett
>
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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


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




Re: populating list for html:options tag within FormBean

2002-05-15 Thread Damien VIEL

I've created the following Action that will populate my forms :

public final class PrepareFormAction extends Action {

 public ActionForward perform(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

  Locale locale = getLocale(request);
  MessageResources messages = getResources();
  String action = request.getParameter("action");

  if ("addproject".equals(action)) {
   try {
CompanyJob companyJob = new CompanyJob();
ArrayList listcomp = new ArrayList();

ResultSet rs = companyJob.getAllCompany();
while (rs.next()) {
 String name = rs.getString("comp_name");
 String id = rs.getString("comp_id");
 listcomp.add(new LabelValueBean(name,id));
}

request.setAttribute("listcomp", listcomp);
   } catch (SQLException sqle) {
System.err.println("ProjectAction Error >> " + sqle);
   }
   return (mapping.findForward("addproject"));
  }
  return (mapping.findForward("error"));
 }
}

Dams
- Original Message -
From: "Gary Bartlett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 6:27 PM
Subject: populating list for html:options tag within FormBean


> Question -
>
> I saw in an earlier post that someone was populating
> the list for an html:options tag within a FormBean.
> My question is how does the FormBean place the list
> into the context so it is available to the tag ?
>
> I realize this is a pretty basic question, but my only
> frame of reference here is the example where the jsp
> scriptlet creates the list and places it into the
> context with pageContext.setAttribute();
>
> Thanks,
>
> Gary Bartlett
>
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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




populating list for html:options tag within FormBean

2002-05-15 Thread Gary Bartlett

Question - 

I saw in an earlier post that someone was populating
the list for an html:options tag within a FormBean. 
My question is how does the FormBean place the list
into the context so it is available to the tag ?  

I realize this is a pretty basic question, but my only
frame of reference here is the example where the jsp
scriptlet creates the list and places it into the
context with pageContext.setAttribute();

Thanks, 

Gary Bartlett

__
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

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




RE: html:options with a Map collection

2002-05-14 Thread James Mitchell

I should know..I'm still cleaning my wounds!

;)

JM

> -Original Message-
> From: Chappell, Simon P [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 14, 2002 12:04 PM
> To: Struts Users Mailing List
> Subject: RE: html:options with a Map collection
>
>
> Please take the hint! Mark is right and you wont like it if you
> force him to become sarcastic!
>
> Simon
>
> -
> Simon P. Chappell [EMAIL PROTECTED]
> Java Programming Specialist  www.landsend.com
> Lands' End, Inc.   (608) 935-4526
>
>
> >-Original Message-
> >From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, May 14, 2002 10:50 AM
> >To: 'Struts Users Mailing List'
> >Subject: RE: html:options with a Map collection
> >
> >
> >That's great!  But a Map is still not a Collection.
> >
> >-Original Message-
> >From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
> >Sent: Tuesday, May 14, 2002 11:32 AM
> >To: Struts Users Mailing List
> >Subject: Re: html:options with a Map collection
> >
> >
> >I got this to work using the following:
> >
> > >  label="key" value="value"/>
> >
> >where "getReportTemplates" returns the Map.
> >
> >- Original Message -
> >From: "Galbreath, Mark" <[EMAIL PROTECTED]>
> >To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
> >Sent: Tuesday, May 14, 2002 11:11 AM
> >Subject: RE: html:options with a Map collection
> >
> >
> >> A Map is not a Collection.
> >>
> >> Mark
> >>
> >> -Original Message-
> >> From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
> >> Sent: Tuesday, May 14, 2002 10:48 AM
> >> To: Struts Users Mailing List
> >> Subject: Re: html:options with a Map collection
> >>
> >>
> >> I've been trying to find documentation on how to use a Map
> >collection in
> >> html:options with the Map key as the label name and the Map
> >value as the
> >> label property.
> >> thanks,
> >> sriram
> >>
> >>
> >>
> >> --
> >> To unsubscribe, e-mail:
> >> <mailto:[EMAIL PROTECTED]>
> >> For additional commands, e-mail:
> >> <mailto:[EMAIL PROTECTED]>
> >>
> >> --
> >> To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >> For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >>
> >>
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> ><mailto:[EMAIL PROTECTED]>
> >
> >--
> >To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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



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




RE: html:options with a Map collection

2002-05-14 Thread Chappell, Simon P

Please take the hint! Mark is right and you wont like it if you force him to become 
sarcastic!

Simon

-
Simon P. Chappell [EMAIL PROTECTED]
Java Programming Specialist  www.landsend.com
Lands' End, Inc.   (608) 935-4526


>-Original Message-
>From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, May 14, 2002 10:50 AM
>To: 'Struts Users Mailing List'
>Subject: RE: html:options with a Map collection
>
>
>That's great!  But a Map is still not a Collection.
>
>-Original Message-
>From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, May 14, 2002 11:32 AM
>To: Struts Users Mailing List
>Subject: Re: html:options with a Map collection
>
>
>I got this to work using the following:
>
>  label="key" value="value"/>
>
>where "getReportTemplates" returns the Map.
>
>- Original Message -
>From: "Galbreath, Mark" <[EMAIL PROTECTED]>
>To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
>Sent: Tuesday, May 14, 2002 11:11 AM
>Subject: RE: html:options with a Map collection
>
>
>> A Map is not a Collection.
>>
>> Mark
>>
>> -Original Message-
>> From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, May 14, 2002 10:48 AM
>> To: Struts Users Mailing List
>> Subject: Re: html:options with a Map collection
>>
>>
>> I've been trying to find documentation on how to use a Map 
>collection in
>> html:options with the Map key as the label name and the Map 
>value as the
>> label property.
>> thanks,
>> sriram
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
>> <mailto:[EMAIL PROTECTED]>
>>
>> --
>> To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>> For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>>
>>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
>--
>To unsubscribe, e-mail:   
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


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




RE: html:options with a Map collection

2002-05-14 Thread Galbreath, Mark

That's great!  But a Map is still not a Collection.

-Original Message-
From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 11:32 AM
To: Struts Users Mailing List
Subject: Re: html:options with a Map collection


I got this to work using the following:



where "getReportTemplates" returns the Map.

- Original Message -
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 11:11 AM
Subject: RE: html:options with a Map collection


> A Map is not a Collection.
>
> Mark
>
> -Original Message-
> From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 14, 2002 10:48 AM
> To: Struts Users Mailing List
> Subject: Re: html:options with a Map collection
>
>
> I've been trying to find documentation on how to use a Map collection in
> html:options with the Map key as the label name and the Map value as the
> label property.
> thanks,
> sriram
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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

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




Re: html:options with a Map collection

2002-05-14 Thread Sriram Nookala

I got this to work using the following:



where "getReportTemplates" returns the Map.

- Original Message -
From: "Galbreath, Mark" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 11:11 AM
Subject: RE: html:options with a Map collection


> A Map is not a Collection.
>
> Mark
>
> -Original Message-
> From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 14, 2002 10:48 AM
> To: Struts Users Mailing List
> Subject: Re: html:options with a Map collection
>
>
> I've been trying to find documentation on how to use a Map collection in
> html:options with the Map key as the label name and the Map value as the
> label property.
> thanks,
> sriram
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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




RE: html:options with a Map collection

2002-05-14 Thread Galbreath, Mark

A Map is not a Collection.

Mark

-Original Message-
From: Sriram Nookala [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 10:48 AM
To: Struts Users Mailing List
Subject: Re: html:options with a Map collection


I've been trying to find documentation on how to use a Map collection in
html:options with the Map key as the label name and the Map value as the
label property.
thanks,
sriram



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

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




Re: html:options with a Map collection

2002-05-14 Thread Sriram Nookala

I've been trying to find documentation on how to use a Map collection in
html:options with the Map key as the label name and the Map value as the
label property.
thanks,
sriram



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




html:options with a Map collection

2002-05-13 Thread Sriram Nookala

I've been trying to find documentation on how to use a Map collection in
html:options with the Map key as the label name and the Map value as the
label property.
thanks,
sriram


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




RE: html:options

2002-05-01 Thread Jayaraman Dorai

Thanks, it looks so trivial now.

-Original Message-
From: James Mitchell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 3:02 PM
To: Struts Users Mailing List
Subject: RE: html:options


  
  

  


JM


> -Original Message-
> From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 2:52 PM
> To: [EMAIL PROTECTED]
> Subject: html:options
> 
> 
> Hi,
>  
> I want in my drop down a blank record. This needs to be the 
> default. This provides the user an option to not select anything( 
> It is a null field). 
>  
> Is it possible to do this other than putting an empty string in 
> the collection. How to set this blank string as the default(not 
> affecting the user's selected value in the edit mode)? 
>  
> I hope I am clear. 
>  
> Jayaraman
> 

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


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




RE: html:options

2002-05-01 Thread Chen, Dean (Zhun)

I have a similar situation:

I'm trying to display the keys of an enumeration in a drop down list.

The keys are Integers and are stored in a Hashtable
>reports.put(new Integer(reportID), item);

The function getReportsKeys returns  reports.keys();

I have two questions:

1. Can html:options collection be used with an enumeration?

2. How can I display the list of keys in JSP?
I have this, what should go in ___WHAT_GOES_HERE???,
I tried intValue   //from the Integer class, but I get
"javax.servlet.ServletException: No getter method for property
reports.reportsKeys of bean com.gs.ed.sh.GLOBAL"

if there's no solution, would I have to create another class call reportID
with getters & setters?
here's the code


--Select Report
Type--

  

Thanks,

Dean Chen

-Original Message-
From: Leonardo Maciel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:55 PM
To: 'Struts Users Mailing List'
Subject: RE: html:options



insert line 

like this:




 

Actually  should do




-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: html:options


Hi,
 
I want in my drop down a blank record. This needs to be the default. This
provides the user an option to not select anything( It is a null field). 
 
Is it possible to do this other than putting an empty string in the
collection. How to set this blank string as the default(not affecting the
user's selected value in the edit mode)? 
 
I hope I am clear. 
 
Jayaraman

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

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




RE: html:options

2002-05-01 Thread Leonardo Maciel


insert line 

like this:




 

Actually  should do




-Original Message-
From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 2:52 PM
To: [EMAIL PROTECTED]
Subject: html:options


Hi,
 
I want in my drop down a blank record. This needs to be the default. This
provides the user an option to not select anything( It is a null field). 
 
Is it possible to do this other than putting an empty string in the
collection. How to set this blank string as the default(not affecting the
user's selected value in the edit mode)? 
 
I hope I am clear. 
 
Jayaraman

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




RE: html:options

2002-05-01 Thread James Mitchell

  
  

  


JM


> -Original Message-
> From: Jayaraman Dorai [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 2:52 PM
> To: [EMAIL PROTECTED]
> Subject: html:options
> 
> 
> Hi,
>  
> I want in my drop down a blank record. This needs to be the 
> default. This provides the user an option to not select anything( 
> It is a null field). 
>  
> Is it possible to do this other than putting an empty string in 
> the collection. How to set this blank string as the default(not 
> affecting the user's selected value in the edit mode)? 
>  
> I hope I am clear. 
>  
> Jayaraman
> 

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




html:options

2002-05-01 Thread Jayaraman Dorai

Hi,
 
I want in my drop down a blank record. This needs to be the default. This provides the 
user an option to not select anything( It is a null field). 
 
Is it possible to do this other than putting an empty string in the collection. How to 
set this blank string as the default(not affecting the user's selected value in the 
edit mode)? 
 
I hope I am clear. 
 
Jayaraman



html:options bug?

2002-04-22 Thread Hoang, Hai

 
I've been using the html:options tag like following without any problems in
the past.
 







 
 
However, I recently get this weird javax.servlet.ServletException:
PropertyDescriptor: internal error
while merging PDs: type mismatch between read and write methods

 

When I change the code to the following and everything is working fine...Any
ideas?

 



<%

User[] users = (User[])session.getAttribute("allusers");

if (users != null)

{

for (int i = 0; i < users.length; i++)   

{%>

<%=users[i].getName()%>

<%}

}%>



 

Thank you




RE: Problem in Html:options tag

2002-04-17 Thread Voytek . Jarnot

In 1.1b1, I'm using html:optionsCollection without any problems; here's a
jsp snippet


 
  
 


Where statusLookup is an application scope bean which has a
getStatusCollection() method which returns a Collection of
org.apache.struts.util.LabelValueBean

It all works, am I missing something?

-Original Message-
From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:14 PM
To: 'Struts Users Mailing List'
Subject: RE: Problem in Html:options tag


You have to use the "collection" property of the options tag - read the tag
spec:

http://jakarta.apache.org/struts/struts-bean.html

but it's not going to work

Mark


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




RE: Problem in Html:options tag

2002-04-17 Thread Galbreath, Mark

You have to use the "collection" property of the options tag - read the tag
spec:

http://jakarta.apache.org/struts/struts-bean.html

but it's not going to work

Mark

-Original Message-
From: Sidhartha Jain [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 2:00 PM
To: [EMAIL PROTECTED]
Subject: Problem in Html:options tag


Hi
I have an options tag which gets a list of values somehwre around 
111 in number.But while displaying the page it gives an error and 
page is not shown.Everything in my code is correct.Just wanted to 
know is there any restriction on the number of options we can show 
in select box or is there some other way to make it around.





I have GetFamilyList which builds up a list from the table and the 
SetFamilyList and GetFamily and setFamily methods which works 
correctly when I select less values.
Is there any other way to achieve this.

Any help would be appreciated.

Thanks
Sidhartha Jain





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

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




RE: Problem in Html:options tag

2002-04-17 Thread Voytek . Jarnot

What's the error?

-Original Message-
From: Sidhartha Jain [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 17, 2002 1:00 PM
To: [EMAIL PROTECTED]
Subject: Problem in Html:options tag


Hi
I have an options tag which gets a list of values somehwre around 
111 in number.But while displaying the page it gives an error and 
page is not shown.Everything in my code is correct.Just wanted to 
know is there any restriction on the number of options we can show 
in select box or is there some other way to make it around.





I have GetFamilyList which builds up a list from the table and the 
SetFamilyList and GetFamily and setFamily methods which works 
correctly when I select less values.
Is there any other way to achieve this.

Any help would be appreciated.

Thanks
Sidhartha Jain





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

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




Problem in Html:options tag

2002-04-17 Thread Sidhartha Jain

Hi
I have an options tag which gets a list of values somehwre around 
111 in number.But while displaying the page it gives an error and 
page is not shown.Everything in my code is correct.Just wanted to 
know is there any restriction on the number of options we can show 
in select box or is there some other way to make it around.





I have GetFamilyList which builds up a list from the table and the 
SetFamilyList and GetFamily and setFamily methods which works 
correctly when I select less values.
Is there any other way to achieve this.

Any help would be appreciated.

Thanks
Sidhartha Jain





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: usage of html:options

2002-04-07 Thread Arron Bates

The tag Ted mentions is html:optionsCollection, and it's in Struts 1.1

If you have to run 1.0/1.0.1, then what you're doing with the 
bean:define is the standard use. Or, if you have a collection for the 
values, and a value for the labels, then you can just use the 
html:options, with the "property" property pointing at the bean property 
that will yield the value list, and the "labelProperty" pointing at the 
bean property that will be the list of labels. Only thing about this is, 
is that they're separate lists.

But to use the list of beans that themselves hold the label and values, 
then there is no other way but your bean:define usage you already have, 
or the new html:optionsCollection tag.

Arron.


Slava_L wrote:

>Now other suggestions?
>
>- Original Message -
>From: "Ted Husted" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Sent: Sunday, April 07, 2002 12:40 AM
>Subject: Re: usage of html:options
>
>
>>If the collection is stored on the ActionForm, you have to use
>>bean:define under Struts 1.0.x
>>
>>For Struts 1.1, there is another tag that gets around this.
>>
>>-Ted.
>>
>>
>>Slava_L wrote:
>>
>>>we have and ActionForm with Collection field (4xmpl list of smthing)
>>>how should i use tag html:options to fill parent tag html:select with
>>>
>values of list (from our Collection)
>
>>>In uptodate we use this scheme:
>>>in jsp file we have
>>> -> related with ActionForm in struts-config.xml
>>>
>>>
>>>
>>>.
>>>
>>>but how can u do the same thin' w/o bean:define ?
>>>
>>>Thnx!
>>>
>>--
>>To unsubscribe, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>For additional commands, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>



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




Re: usage of html:options

2002-04-07 Thread Slava_L

Now other suggestions?

- Original Message -
From: "Ted Husted" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, April 07, 2002 12:40 AM
Subject: Re: usage of html:options


> If the collection is stored on the ActionForm, you have to use
> bean:define under Struts 1.0.x
>
> For Struts 1.1, there is another tag that gets around this.
>
> -Ted.
>
>
> Slava_L wrote:
> >
> > we have and ActionForm with Collection field (4xmpl list of smthing)
> > how should i use tag html:options to fill parent tag html:select with
values of list (from our Collection)
> > In uptodate we use this scheme:
> > in jsp file we have
> >  -> related with ActionForm in struts-config.xml
> > 
> > 
> > 
> > .
> >
> > but how can u do the same thin' w/o bean:define ?
> >
> > Thnx!
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>


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




Re: usage of html:options

2002-04-06 Thread Ted Husted

If the collection is stored on the ActionForm, you have to use
bean:define under Struts 1.0.x 

For Struts 1.1, there is another tag that gets around this.

-Ted.


Slava_L wrote:
> 
> we have and ActionForm with Collection field (4xmpl list of smthing)
> how should i use tag html:options to fill parent tag html:select with values of list 
>(from our Collection)
> In uptodate we use this scheme:
> in jsp file we have
>  -> related with ActionForm in struts-config.xml
> 
> 
> 
> .
> 
> but how can u do the same thin' w/o bean:define ?
> 
> Thnx!

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




usage of html:options

2002-04-03 Thread Slava_L

we have and ActionForm with Collection field (4xmpl list of smthing)
how should i use tag html:options to fill parent tag html:select with values of list 
(from our Collection) 
In uptodate we use this scheme: 
in jsp file we have
 -> related with ActionForm in struts-config.xml



.

but how can u do the same thin' w/o bean:define ?

Thnx! 




Trimming strings in html:options

2002-04-01 Thread Bhaskar Gopalan

Hi,
I am dynamically populating a options field from the database. For this I am
getting an ArrayList
of strings that are formatted as id:value. 

Code:
<%
PipelineFilterForm pipelineFilterForm =
(PipelineFilterForm)session.getAttribute("PipelineFilterForm");
java.util.ArrayList statusOptions = pipelineFilterForm.getStatusOptions();
if(statusOptions != null) {
pageContext.setAttribute("statusOptions", statusOptions,
PageContext.PAGE_SCOPE);
%>

 Select One
 


The options displayed are id:value which is ok. But I want to set the value
of each option
equal to the 'id' part of the string. Is there any way to do this?

Also, line 2 of the code shows how I access the formBean from the form. Is
there any other
way to acheive this?

Thanks,
Bhaskar

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: html:options Iterator Creation error -

2002-03-28 Thread Ted Husted

If PersonalForm has a 

Collection getSecurityOptions();

method then it does look OK. 

This shouldn't matter, but you could try a type property with
bean:define

-Ted.


Sunder wrote:
> 
> Hi,
> I am trying to implement the html:options tag in one of our
> applications,
> 
> I have a form bean with the following attributes,
> 
> private Collection securityOptions = null;
> private String security = "Default";
> 
> In my action class, I populate the collection with
> 
> PersonalForm perform = (PersonalForm) form;
> Collection list = (Collection) new ArrayList();
> for(int i = 0; i<10; i++)
> {
> list.add(new LabelValueBean("Default","Value"));
> }
> perform.setSecurityOptions(list);
> 
> and finally in my jsp, I try to display the collection using
> html:options tag as follows
> 
>  
>   property="securityOptions"/>
>labelProperty="label"/>
> 
> 
> I get the following error when I try to view the page
> 
> javax.servlet.ServletException: Cannot create iterator for
> at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
> tImpl.java:463)
> at
> org.apache.jsp.personal$jsp._jspService(personal$jsp.java:1031)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
> t.java:202)
> at
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
> at
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
> her.java:683)
> - Root Cause -
> javax.servlet.jsp.JspException: Cannot create iterator for
> at
> org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:420
> )
> at
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:222)
> at
> org.apache.jsp.personal$jsp._jspService(personal$jsp.java:785)
> at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 
> Any comments,suggestions? Appreciate your help.
> 
> Thanks,
> Sunder
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

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




html:options Iterator Creation error -

2002-03-25 Thread Sunder

Hi, 
I am trying to implement the html:options tag in one of our
applications,

I have a form bean with the following attributes,

private Collection securityOptions = null;
private String security = "Default";

In my action class, I populate the collection with 

PersonalForm perform = (PersonalForm) form;
Collection list = (Collection) new ArrayList();
for(int i = 0; i<10; i++)
{
list.add(new LabelValueBean("Default","Value"));
}
perform.setSecurityOptions(list);

and finally in my jsp, I try to display the collection using
html:options tag as follows

 
 
  


I get the following error when I try to view the page

javax.servlet.ServletException: Cannot create iterator for
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:463)
at
org.apache.jsp.personal$jsp._jspService(personal$jsp.java:1031)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServle
t.java:202)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:382)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:474)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatc
her.java:683)
- Root Cause -
javax.servlet.jsp.JspException: Cannot create iterator for
at
org.apache.struts.taglib.html.OptionsTag.getIterator(OptionsTag.java:420
)
at
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:222)
at
org.apache.jsp.personal$jsp._jspService(personal$jsp.java:785)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

Any comments,suggestions? Appreciate your help.

Thanks,
Sunder



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




Re: Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread theron . kousek


thank you!!!

You have solved my problem!!!

Theron



   

John   

Kroubalkian  To: Struts Users Mailing List 

  

kian.com>cc:   

 Subject: Re: Controlling MaxWidth for 
html:options or 
03/24/02 html:select?  

04:59 PM   

Please 

respond to 

Struts Users   

Mailing List   

   

   




Have you tried using a stylesheet to help out?

Ex. The following does some inline styling and then assigns our
user-defined
style "selectskinny" to the  tag.



<!--
  .selectskinny {
width: 50px ;
color:  green ;
font-family: arial ;
font-size: 8pt ;
   }
-->

 



- Original Message -
From: <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, March 24, 2002 2:54 PM
Subject: Controlling MaxWidth for html:options or html:select?


>
> I'm having a hardtime controlling the field-width for a dropdown using
> html:select with html:options:
>
> For example:
>
> disabled="<%=
> billingForm.getFormEditFields() %>">
> property="value"
>  labelProperty="label"/>
>   
>
>
> My "states" collection contains states like:
> Alaska
> Arkansas
> etc,...
>
> but there's one that is:
> ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA
>
> Problem I am having is no matter how I try and limit the "width" of the
> dropdown, it wants to be as wide as the largest value in my collection..
> Is there a way to control this so that you get a "horizontal" scrollbar
> when you do the dropdown? In my example above, it's ignoring my "td
> width="100" and it seems to be taking up about 300 pixels to display the
> largest value  :-(
>
> thanks,
> Theron
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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




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




Re: Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread theron . kousek


Hi Aaron:

I tried using a stylesheet but perhaps I am doing it wrong:

My stylesheet class looks like:

.selectStyle
{
font-size: 7pt;
font-family: verdana;
font-weight: bold
   max-width: 110;
}

and the html:select looks like:


   
  

The 2 problems I have is:
1.  The text showing up in the collection is not showing up with the bold
weight.
2.   It ignores my max-width 110 and still decides to show about 300 pixels
for the states collection

:-(

thanks,
Theron



   
   
Arron Bates
   
  <[EMAIL PROTECTED]>   
   
cc:
   
03/24/02 05:38  Subject: Re: Controlling MaxWidth for 
html:options or 
PM  html:select?   
   
Please respond 
   
to Struts Users
   
Mailing List   
   
   
   
   
   



Or, use a stylesheet! :)

That's a good one actually. Problem is though, you'll never see what's
cut off by the width in IE. NS6 actually shows the whole thing when it
drops down. Quite cool NS!.

Arron.



John Kroubalkian wrote:

>Have you tried using a stylesheet to help out?
>
>Ex. The following does some inline styling and then assigns our
user-defined
>style "selectskinny" to the  tag.
>
>
>
><!--
>  .selectskinny {
>width: 50px ;
>color:  green ;
>font-family: arial ;
>font-size: 8pt ;
>   }
>-->
>
> styleClass="selectskinny"
>disabled="<%=
> billingForm.getFormEditFields() %>">
>
>
>
>- Original Message -
>From: <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Sent: Sunday, March 24, 2002 2:54 PM
>Subject: Controlling MaxWidth for html:options or html:select?
>
>
>>I'm having a hardtime controlling the field-width for a dropdown using
>>html:select with html:options:
>>
>>For example:
>>   
>>>   disabled="<%=
>>billingForm.getFormEditFields() %>">
>>   >property="value"
>> labelProperty="label"/>
>>  
>>   
>>
>>My "states" collection contains states like:
>>Alaska
>>Arkansas
>>etc,...
>>
>>but there's one that is:
>>ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA
>>
>>Problem I am having is no matter how I try and limit the "width" of the
>>dropdown, it wants to be as wide as the largest value in my collection..
>>Is there a way to control this so that you get a "horizontal" scrollbar
>>when you do the dropdown? In my example above, it's ignoring my "td
>>width="100" and it seems to be taking up about 300 pixels to display the
>>largest value  :-(
>>
>>thanks,
>>Theron
>>
>>
>>--
>>To unsubscribe, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>For additional commands, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:   <
mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>
>
>



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




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




Re: Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread Arron Bates

Or, use a stylesheet! :)

That's a good one actually. Problem is though, you'll never see what's 
cut off by the width in IE. NS6 actually shows the whole thing when it 
drops down. Quite cool NS!.

Arron.



John Kroubalkian wrote:

>Have you tried using a stylesheet to help out?
>
>Ex. The following does some inline styling and then assigns our user-defined
>style "selectskinny" to the  tag.
>
>
>
><!--
>  .selectskinny {
>width: 50px ;
>color:  green ;
>font-family: arial ;
>font-size: 8pt ;
>   }
>-->
>
> styleClass="selectskinny"
>disabled="<%=
> billingForm.getFormEditFields() %>">
>
>
>
>- Original Message -
>From: <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Sent: Sunday, March 24, 2002 2:54 PM
>Subject: Controlling MaxWidth for html:options or html:select?
>
>
>>I'm having a hardtime controlling the field-width for a dropdown using
>>html:select with html:options:
>>
>>For example:
>>   
>>>   disabled="<%=
>>billingForm.getFormEditFields() %>">
>>   >property="value"
>> labelProperty="label"/>
>>  
>>   
>>
>>My "states" collection contains states like:
>>Alaska
>>Arkansas
>>etc,...
>>
>>but there's one that is:
>>ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA
>>
>>Problem I am having is no matter how I try and limit the "width" of the
>>dropdown, it wants to be as wide as the largest value in my collection..
>>Is there a way to control this so that you get a "horizontal" scrollbar
>>when you do the dropdown? In my example above, it's ignoring my "td
>>width="100" and it seems to be taking up about 300 pixels to display the
>>largest value  :-(
>>
>>thanks,
>>Theron
>>
>>
>>--
>>To unsubscribe, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>>For additional commands, e-mail:
>>
><mailto:[EMAIL PROTECTED]>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>



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




Re: Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread Arron Bates

I'm afraid that there's nothing you can do about it.

Limitation defined by Html, because no horizontal scroll bar will appear 
so users can read the whole string. You'll either have to split it up 
into the different parts or abreviate it in some way.

Arron.



[EMAIL PROTECTED] wrote:

>I'm having a hardtime controlling the field-width for a dropdown using
>html:select with html:options:
>
>For example:
>   
>   disabled="<%=
>billingForm.getFormEditFields() %>">
>   property="value"
> labelProperty="label"/>
>  
>   
>
>My "states" collection contains states like:
>Alaska
>Arkansas
>etc,...
>
>but there's one that is:
>ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA
>
>Problem I am having is no matter how I try and limit the "width" of the
>dropdown, it wants to be as wide as the largest value in my collection..
>Is there a way to control this so that you get a "horizontal" scrollbar
>when you do the dropdown? In my example above, it's ignoring my "td
>width="100" and it seems to be taking up about 300 pixels to display the
>largest value  :-(
>
>thanks,
>Theron
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>



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




Re: Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread John Kroubalkian

Have you tried using a stylesheet to help out?

Ex. The following does some inline styling and then assigns our user-defined
style "selectskinny" to the  tag.



<!--
  .selectskinny {
width: 50px ;
color:  green ;
font-family: arial ;
font-size: 8pt ;
   }
-->

 



- Original Message -
From: <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Sunday, March 24, 2002 2:54 PM
Subject: Controlling MaxWidth for html:options or html:select?


>
> I'm having a hardtime controlling the field-width for a dropdown using
> html:select with html:options:
>
> For example:
>
> disabled="<%=
> billingForm.getFormEditFields() %>">
> property="value"
>  labelProperty="label"/>
>   
>
>
> My "states" collection contains states like:
> Alaska
> Arkansas
> etc,...
>
> but there's one that is:
> ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA
>
> Problem I am having is no matter how I try and limit the "width" of the
> dropdown, it wants to be as wide as the largest value in my collection..
> Is there a way to control this so that you get a "horizontal" scrollbar
> when you do the dropdown? In my example above, it's ignoring my "td
> width="100" and it seems to be taking up about 300 pixels to display the
> largest value  :-(
>
> thanks,
> Theron
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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




Controlling MaxWidth for html:options or html:select?

2002-03-24 Thread theron . kousek


I'm having a hardtime controlling the field-width for a dropdown using
html:select with html:options:

For example:
   

   
  
   

My "states" collection contains states like:
Alaska
Arkansas
etc,...

but there's one that is:
ARMED FORCES CANADA/EUROPE/PACIFIC/AFRICA/MIDDLE EAST/ASIA

Problem I am having is no matter how I try and limit the "width" of the
dropdown, it wants to be as wide as the largest value in my collection..
Is there a way to control this so that you get a "horizontal" scrollbar
when you do the dropdown? In my example above, it's ignoring my "td
width="100" and it seems to be taking up about 300 pixels to display the
largest value  :-(

thanks,
Theron


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




Re: html:options problem with labelProperty

2002-03-14 Thread keithBacon

quick wild guess..
one of the calls to getMerchandiseCategoryDescriptions() returns null.
try returning  "it was null" if you are about to return a null.
 

--- Allen Walker <[EMAIL PROTECTED]> wrote:
> I have the following:
> 
> [html:select property="merchandiseCategory"]
> [html:options property="merchandiseCategoryCodes" 
> labelProperty="merchandiseCategoryDescriptions"/]
> [/html:select]
> 
> Now when I take out the labelProperty attribute, all works. When the 
> labelProperty attribute is in, I get:
> 
> java.lang.NullPointerException at 
> org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:296) at 
>
_jsp._cbmsi._admin._editbookrecord__jsp._jspService(D:\work\resin-1.2.7\webapps\cbmsi\admin\editbookrecord.jsp:101)
> 
> 
> 
> 
> This worked fine until I moved to Struts 1.0.2. There is nothing wrong with 
> my formbean, it contains the "merchandiseCategoryDescriptions" getter on 
> the associated form bean.
> 
> Thanks for any help.
> 
> --
> Allen Walker
> <[EMAIL PROTECTED]>
> Yahoo MessengerID: "auswalk"
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


=
~~
Search the archive:-
http://www.mail-archive.com/struts-user%40jakarta.apache.org/
~~
Keith Bacon - Looking for struts work - South-East UK.
phone UK 07960 011275

__
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

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




html:options problem with labelProperty

2002-03-13 Thread Allen Walker

I have the following:

[html:select property="merchandiseCategory"]
[html:options property="merchandiseCategoryCodes" 
labelProperty="merchandiseCategoryDescriptions"/]
[/html:select]

Now when I take out the labelProperty attribute, all works. When the 
labelProperty attribute is in, I get:

java.lang.NullPointerException at 
org.apache.struts.taglib.html.OptionsTag.doEndTag(OptionsTag.java:296) at 
_jsp._cbmsi._admin._editbookrecord__jsp._jspService(D:\work\resin-1.2.7\webapps\cbmsi\admin\editbookrecord.jsp:101)
 



This worked fine until I moved to Struts 1.0.2. There is nothing wrong with 
my formbean, it contains the "merchandiseCategoryDescriptions" getter on 
the associated form bean.

Thanks for any help.

--
Allen Walker
<[EMAIL PROTECTED]>
Yahoo MessengerID: "auswalk"


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




Re: html:options bug?

2002-03-11 Thread Arron Bates

The collection attribute needs the bean reference only. The dot notation 
is for your property. Because the collection isn't the bean itself 
you'll have to use a define tag or something to make a bean reference 
directly to your collection, then use that reference in your collection 
attribute.

For your second example... The collection attribute is overriding, and 
ignores the name attribute. It's meant to be the direct link to a bean 
reference that itself is a collection.

Arron.


Lawlor, Frank wrote:

>The Struts Options tag seems to have problems accessing collections 
>that are in some other object (e.g., your form).  The following dotted
>notation should work (I thought) (roleList is an ArrayList):
>
>   
>labelProperty="description"/>
>   
>
>or alternatively:
>
>   
>labelProperty="description"/>
>   
>
>But both of these result in an error that a bean cannot be found in
>roleList.
>A workaround is to "cache" the list:
>
>   scope="session" />
>   
>labelProperty="description"/>
>   
>
>Is this a bug or expected behavior?
>
>Frank Lawlor
>Athens Group, Inc.
>(512) 345-0600 x151
>Athens Group, an employee-owned consulting firm integrating technology
>strategy and software solutions.
>
>
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




html:options bug?

2002-03-11 Thread Lawlor, Frank

The Struts Options tag seems to have problems accessing collections 
that are in some other object (e.g., your form).  The following dotted
notation should work (I thought) (roleList is an ArrayList):

   

   

or alternatively:

   

   

But both of these result in an error that a bean cannot be found in
roleList.
A workaround is to "cache" the list:

   
   

   

Is this a bug or expected behavior?

Frank Lawlor
Athens Group, Inc.
(512) 345-0600 x151
Athens Group, an employee-owned consulting firm integrating technology
strategy and software solutions.




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: CachedRowSet for html:options

2002-03-10 Thread Adam Hardy

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

* If the labelProperty attribute is not specified, the property named by the 
property attribute will be used to select both the value returned to the server and 
the label displayed to the user for this option.




On Sat, 09 March 2002, "Sunder R Somasundaram" wrote:

> 
> Thanks for your reply; it is a select box with single or multiple
> options. Do I have to put in both the values and the labels even if both
> are the same?
> 
> 
> -Original Message-
> From: Adam Hardy [mailto:[EMAIL PROTECTED]] 
> Sent: Saturday, March 09, 2002 5:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: CachedRowSet for html:options
> 
> You mean you're displaying a list in a table or you are displaying a
> select drop-down box?
> 
> The html:options tag works great with forms, it'll initialize the select
> box to what's in the form object, and it'll display appropriate labels
> and set up the appropriate values on each option.
> 
> You can quite easily use the CachedRowSet.toCollection(column) to return
> any column of the rowset as a collection. Instead of putting the whole
> rowset in the session, you'll have to put a collection for the values
> and a collection for the labels. A few more lines of code, yes, but not
> exactly difficult.
> 
> If your lists are just lists and not select boxes (it's not clear from
> your message), use a logic:iterate tag.
> 
> 
> 
> On Fri, 08 March 2002, Sunder wrote:
> 
> > 
> > Hi,
> > I am currently retrieving a cachedRowSet from a session bean and
> > displaying lists using the rowset. I would like to use the struts
> > html:options tag to do the same, From the documentation, it looks like
> I
> > have to put this rowset into a collection and use the same. Is there a
> > better way to do this?
> > 
> > Thanks,
> > Sunder
> > 
> > 
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> Find the best deals on the web at AltaVista Shopping!
> http://www.shopping.altavista.com
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

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




RE: CachedRowSet for html:options

2002-03-09 Thread Sunder R Somasundaram

Thanks for your reply; it is a select box with single or multiple
options. Do I have to put in both the values and the labels even if both
are the same?


-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED]] 
Sent: Saturday, March 09, 2002 5:03 AM
To: [EMAIL PROTECTED]
Subject: Re: CachedRowSet for html:options

You mean you're displaying a list in a table or you are displaying a
select drop-down box?

The html:options tag works great with forms, it'll initialize the select
box to what's in the form object, and it'll display appropriate labels
and set up the appropriate values on each option.

You can quite easily use the CachedRowSet.toCollection(column) to return
any column of the rowset as a collection. Instead of putting the whole
rowset in the session, you'll have to put a collection for the values
and a collection for the labels. A few more lines of code, yes, but not
exactly difficult.

If your lists are just lists and not select boxes (it's not clear from
your message), use a logic:iterate tag.



On Fri, 08 March 2002, Sunder wrote:

> 
> Hi,
> I am currently retrieving a cachedRowSet from a session bean and
> displaying lists using the rowset. I would like to use the struts
> html:options tag to do the same, From the documentation, it looks like
I
> have to put this rowset into a collection and use the same. Is there a
> better way to do this?
> 
> Thanks,
> Sunder
> 
> 
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

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



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




Re: CachedRowSet for html:options

2002-03-09 Thread Adam Hardy

You mean you're displaying a list in a table or you are displaying a select drop-down 
box?

The html:options tag works great with forms, it'll initialize the select box to what's 
in the form object, and it'll display appropriate labels and set up the appropriate 
values on each option.

You can quite easily use the CachedRowSet.toCollection(column) to return any column of 
the rowset as a collection. Instead of putting the whole rowset in the session, you'll 
have to put a collection for the values and a collection for the labels. A few more 
lines of code, yes, but not exactly difficult.

If your lists are just lists and not select boxes (it's not clear from your message), 
use a logic:iterate tag.



On Fri, 08 March 2002, Sunder wrote:

> 
> Hi,
> I am currently retrieving a cachedRowSet from a session bean and
> displaying lists using the rowset. I would like to use the struts
> html:options tag to do the same, From the documentation, it looks like I
> have to put this rowset into a collection and use the same. Is there a
> better way to do this?
> 
> Thanks,
> Sunder
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Find the best deals on the web at AltaVista Shopping!
http://www.shopping.altavista.com

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




CachedRowSet for html:options

2002-03-08 Thread Sunder

Hi,
I am currently retrieving a cachedRowSet from a session bean and
displaying lists using the rowset. I would like to use the struts
html:options tag to do the same, From the documentation, it looks like I
have to put this rowset into a collection and use the same. Is there a
better way to do this?

Thanks,
Sunder


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




html:select and html:options tags

2002-03-01 Thread Viet Kevin


Hello all

My question is about the struts html:select and html:options tags

public class xxxForm extends ActionForm 
{
private Person choosed;
private Collection persons;


public get...
// accessors for this attributes are defined but I do not display
// them
}

When creating the form I set the choosed properties to firs instance in the persons 
list
xxxForm.setChoosed(xxxForm.getPersons.iterator.next());

Then I want to display that list in a html page for selecting a person in that list.
The html select must list all the persons AND the chooseen one must be displayed first 
(setting the html-attibute selected="selected" for the choosen one)

The other problem is that I want to use an index (an int that index the instances in 
the list) as the value
of the html option tag (not the name of the person)

so the html produced must be something like : 

 John  
 Henri 
 Max 


I play a lot of time trying to obtain this result with the struts tags 
but never figured out how to do it

Please tell me if it is possible to do or propose me an other solution
but I must have an index in my list so the value in the option tag must 
be an int


And the last question is I can't see what the attribute named tabindex in the 
html:select
tag is used for?

Thx in advance

=
-- KeV -- 
=

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




RE: How to specify scope of bean for html:options tag.

2002-01-23 Thread Alex Colic

Thanks for the help.

Luckily the search method is the way I need it.

Alex

-Original Message-
From: Arnaud Buisine [mailto:[EMAIL PROTECTED]]
Sent: January 23, 2002 10:56 AM
To: Struts Users Mailing List
Subject: RE: How to specify scope of bean for html:options tag.


Tell me if I'm wrong, but it seems to me that the findAttribute(String)
method from class javax.servlet.jsp.PageContext is used by Struts tags.

This method "searches for the named attribute in page, request, session (if
valid), and application scope(s) in order and returns the value associated
or null" (cf. J2EE API Documentation).

Hope it helps.


> -Message d'origine-
> De : Stephen Owens [mailto:[EMAIL PROTECTED]]
> Envoyé : mercredi 23 janvier 2002 16:44
> À : Struts Users Mailing List
> Objet : RE: How to specify scope of bean for html:options tag.
>
>
> Alex,
>
> I believe there is a defined search order used to find the beans, and I
> think by default it would do what you want. So you may have to do
> exactly nothing to have this work the way you want.
>
> regards,
>
> Stephen Owens
> Corner Software
>
> > -Original Message-
> > From: Alex Colic [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 23, 2002 10:44 AM
> > To: Struts
> > Subject: How to specify scope of bean for html:options tag.
> >
> >
> > Hi,
> >
> > I have two beans in request and session scope under the same
> > name. I have to
> > create a drop down using the html:options tag. If the bean
> > under the request
> > scope is found then I want to use that one for the options
> > tag, if it is not
> > then I want to use the one under the session tag. I can't
> > seem to find a way
> > to differentiate the two bean via the options tag.
> >
> > Any help is appreciated.
> >
> > Alex
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




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




RE: How to specify scope of bean for html:options tag.

2002-01-23 Thread Alex Colic

Thanks for the help.

Luckily the search method is the way I need it.

Alex

-Original Message-
From: Arnaud Buisine [mailto:[EMAIL PROTECTED]]
Sent: January 23, 2002 10:56 AM
To: Struts Users Mailing List
Subject: RE: How to specify scope of bean for html:options tag.


Tell me if I'm wrong, but it seems to me that the findAttribute(String)
method from class javax.servlet.jsp.PageContext is used by Struts tags.

This method "searches for the named attribute in page, request, session (if
valid), and application scope(s) in order and returns the value associated
or null" (cf. J2EE API Documentation).

Hope it helps.


> -Message d'origine-
> De : Stephen Owens [mailto:[EMAIL PROTECTED]]
> Envoyé : mercredi 23 janvier 2002 16:44
> À : Struts Users Mailing List
> Objet : RE: How to specify scope of bean for html:options tag.
>
>
> Alex,
>
> I believe there is a defined search order used to find the beans, and I
> think by default it would do what you want. So you may have to do
> exactly nothing to have this work the way you want.
>
> regards,
>
> Stephen Owens
> Corner Software
>
> > -Original Message-
> > From: Alex Colic [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, January 23, 2002 10:44 AM
> > To: Struts
> > Subject: How to specify scope of bean for html:options tag.
> >
> >
> > Hi,
> >
> > I have two beans in request and session scope under the same
> > name. I have to
> > create a drop down using the html:options tag. If the bean
> > under the request
> > scope is found then I want to use that one for the options
> > tag, if it is not
> > then I want to use the one under the session tag. I can't
> > seem to find a way
> > to differentiate the two bean via the options tag.
> >
> > Any help is appreciated.
> >
> > Alex
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>




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




html:options

2001-12-12 Thread Luke Studley

Hi all

This is my first post - so excuse me if it is really basic but I am trying
to get the html:options tag to work as documented. My code looks like:



nameTitles.put("Mr",null);
nameTitles.put("Mrs",null);
nameTitles.put("Miss",null);



.




Where I am declaring a simple map and then trying to use it to populate the
option list. But I get the following error:

javax.servlet.jsp.JspException: No getter method available for property
personTitle for bean under name org.apache.struts.taglib.html.BEAN
at
org.apache.struts.taglib.template.GetTag.doStartTag(GetTag.java:193)
at org.apache.jsp.pagetempl$jsp._jspService(pagetempl$jsp.java:265)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)


What am I doing wrong???!

Luke

PS Tomcat 4.0.1, Struts latest nightly build (needed for validator).


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




Finding a value from html:options bean

2001-11-13 Thread Denham, Martin

Hi,

I have 2 similar forms.  An edit form which allows editing, and another view
form which displays the same data but is read-only.

The read-only form is like the edit form but the html:text have been
removed.

Is it possible to look up the value which should be shown in the select box
from the bean I use which contains all the options.

Part of my edit form is shown below.




My quick and dirty solution is to look it up in the Action and save it to
another String property in the ActionForm, then use that in the jsp.  But I
am sure ther must be a simple way to look it up using struts tags.

Thanks in advance for any help.

Marty


_
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: html:options and FormBean

2001-10-27 Thread David M. Karr

>>>>> "Francois" == Francois Duchaussoy <[EMAIL PROTECTED]> writes:

Francois> Hi,
Francois> I have an ActionForm with a Collection object inside.
Francois> I'd like to use the  tag to display that Collection.
Francois> Could anyone give me an example on how to do that?

Francois> something like that??
Francois>  labelProperty="value"/>

I recently had this problem, but I ended up creating the collection as a
separate bean in my Action class.  However, after I got past this, Ted
H. pointed out to me that the phrase from the reference, "the name of a JSP
bean in some scope", could refer to the same name as set in the "name"
attribute of the "action" element in "struts-config.xml".

So, if you look at the "html:options" reference, take the choice of NOT setting
"collection", then set "name" to the name specified in the "action", and
"property" to the name of the field in the ActionForm.  I haven't done this,
but I believe that's what you would do.

-- 
===
David M. Karr  ; Best Consulting
[EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


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




Re: html:options with FormBean

2001-10-26 Thread Peter Pilgrim


There are two ways but the best way is to set up a simple bean
like "LabelValueBean" that has two attribute; the option value and the
option description

public class LabelValueBean {
 String label, descrip ; 
 public String getLabel() { ... }
 public void setLabel( String newValue ) { ... }
 public String getDescription() { ... }
 public void setDescription( String newValue ) { ... }
}

Write a collection and store  LabelValueBean inside it.
Write an action form that allows you get the collection or add
the collection directly to the request scope under a known name.
Then you write your  tags to get all the options
You need to tell  the JavaBean property to get the value ie "label" == 
getLabel()
and the display text "description" == getDescription



HTH
--
Peter Pilgrim ++44 (0)207-545-9923
  //_\\
"Mathematics is essentially the study of islands of  ===
disparate subjects in a sea of ignorance."   || ! ||
Andrew Wiles _


 Message History 



From: Francois Duchaussoy <[EMAIL PROTECTED]> on 26/10/2001 12:33

Please respond to [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:
Subject:  html:options with FormBean


> I have an ActionForm with a Collection object inside.
> I'd like to use the  tag to display that Collection.
> Could anyone give me an example on how to do that?
>
> something like that??
>  labelProperty="value"/>
>
> Thanks.
> Francois.





--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.





html:options with FormBean

2001-10-25 Thread Francois Duchaussoy

> I have an ActionForm with a Collection object inside.
> I'd like to use the  tag to display that Collection.
> Could anyone give me an example on how to do that?
> 
> something like that??
>  labelProperty="value"/>
> 
> Thanks.
> Francois.



html:options and FormBean

2001-10-25 Thread Francois Duchaussoy

Hi,

I have an ActionForm with a Collection object inside.
I'd like to use the  tag to display that Collection.
Could anyone give me an example on how to do that?

something like that??


Thanks.
Francois.



Re: html:options & collection of beans in FormBean

2001-10-22 Thread Ted Husted

The ActionForm itself is a bean "in some scope". The name is whatever
you specified in struts-config.

People tend to send the options collection over seperately from the form
(your #1), since it usually a seperate query and sometimes used in more
than one place. But referring to the ActionForm itself should work as
well. You should not have to bother with a bean:define.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/struts/


"David M. Karr" wrote:
> 
> I have an ActionForm that has a property which is a collection of beans.  I
> obtained this collection in my Action.perform() method.
> 
> In my JSP page, I want to display an html:options list where the label is one
> property of each of those beans, and the value is another property.
> 
> It appears, from the description of the attributes of "html:options", that I
> can't directly use the collection, being a property of my ActionForm, to
> directly render the options list.
> 
> It seems like I want to use the "collection" attribute of "html:options", if I
> want one property of a bean to be the label, and another to be the value.
> However, it doesn't appear as if I can specify a property of the FormBean for
> this, it just has to be a bean "in some scope".
> 
> Do I have this correct so far?
> 
> It appears that I have two choices:
> 
> 1. To not have the collection as a property of the ActionForm, but have the
> Action.perform() method manually place the collection into a property in
> request or session scope.
> 
> 2. To keep the property in the ActionForm, but do a "bean:define" in the JSP
> page to get it into a request or session scope bean.
> 
> Is this a correct assessment?
> 
> If I do the first one, should I pay attention to the "mapping.getScope()"
> value, to decide whether to put the property in "request" or "session" scope?
> 
> If these are the two basic choices, what are the design tradeoffs?  Will either
> of these "smell bad" after being utilized many times?
> 
> --
> ===
> David M. Karr  ; Best Consulting
> [EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)



html:options & collection of beans in FormBean

2001-10-18 Thread David M. Karr

I have an ActionForm that has a property which is a collection of beans.  I
obtained this collection in my Action.perform() method.

In my JSP page, I want to display an html:options list where the label is one
property of each of those beans, and the value is another property.

It appears, from the description of the attributes of "html:options", that I
can't directly use the collection, being a property of my ActionForm, to
directly render the options list.

It seems like I want to use the "collection" attribute of "html:options", if I
want one property of a bean to be the label, and another to be the value.
However, it doesn't appear as if I can specify a property of the FormBean for
this, it just has to be a bean "in some scope".

Do I have this correct so far?

It appears that I have two choices:

1. To not have the collection as a property of the ActionForm, but have the
Action.perform() method manually place the collection into a property in
request or session scope.

2. To keep the property in the ActionForm, but do a "bean:define" in the JSP
page to get it into a request or session scope bean.

Is this a correct assessment?

If I do the first one, should I pay attention to the "mapping.getScope()"
value, to decide whether to put the property in "request" or "session" scope?

If these are the two basic choices, what are the design tradeoffs?  Will either
of these "smell bad" after being utilized many times?

-- 
===
David M. Karr  ; Best Consulting
[EMAIL PROTECTED]   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)




<    1   2   3   >