html:select and html:options example?

2003-06-15 Thread Stephan Niedermeier
Hello,

who can give me an example, how to use the html:select in conjunction with
html:options? I had already defined an ActionForm and JSP like follows. The
listing of the option-Elements works fine but not the "reshowing" of the
selected elements of the list, because after I have clicked the submit
button I've got an IllegalArgumentException (BeanUtils.populate):

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.j
ava:1789)
at
org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.j
ava:1684)
at
org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:17
13)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
{...}

My FormBean looks like this:
{...}
public final class RoleEditForm extends ActionForm {
{...}public void setAllUsers(ArrayList allUsers)
 this.allUsers = allUsers;}public ArrayList getAllUsers()
 return this.allUsers;}
{...}}
The allUsers list contains user objects. The user objects have the accessor
methods getId(), getName().
My JSP looks like this:





After clicking the submit button I've got the Exception. That's wrong?

Thank you very much!
Regards
Stephan



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



Re: Need help with html:select and html:options

2003-01-24 Thread Scott Seong
Yes, I do have dyna from-bean defined for "month" and "day" in the
struts-config.xml.


- Original Message -
From: "Suresh Addagalla" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Friday, January 24, 2003 12:03 AM
Subject: RE: Need help with html:select and html:options


> Check if you have month & day properties defined in your form bean.
>
> Suresh
>
> >-Original Message-
> >From: Scott Seong [mailto:[EMAIL PROTECTED]]
> >Sent: Friday, January 24, 2003 11:32 AM
> >To: Struts Users Mailing List
> >Subject: Need help with html:select and html:options
> >
> >
> >Hello,
> >
> >I'm having trouble with html:select and html:options. Basically, I have
> >three select/options pairs in a JSP page, and the result is complaining
> >about "No getter method available for Property month for bean
> >name under
> >org.apache...". Here is the code sample:
> >
> ><%
> >Vector states = new Vector();
> >
> >states.add(new LabelValueBean("Alabama", "AL"));
> >
> >states.add(new LabelValueBean("Alaska", "AK"));
> >
> >...
> >
> >pageContext.setAttribute( "states", states);
> >
> >Vector months = new Vector();
> >
> >months.add(new LabelValueBean("Month", "00"));
> >
> >months.add(new LabelValueBean("January", "01"));
> >
> >...
> >
> >pageContext.setAttribute( "months", months);
> >
> >
> >
> >Vector days = new Vector();
> >
> >days.add(new LabelValueBean("Day", "00"));
> >
> >days.add(new LabelValueBean("1", "01"));
> >
> >...
> >
> >pageContext.setAttribute( "days", days);
> >
> >%>
> >
> >
> >Then, I have html:select and html:options tags as shown below:
> >
> >
> > >labelProperty="label" />
> >
> >
> >
> >
> >
> > >labelProperty="mLabel"
> >/>
> >
> >
> >
> >
> >
> > >labelProperty="dLabel" />
> >
> >
> >
> >
> >
> >The JSP chokes at the 2nd select/options, and I don't know
> >why. If I remove
> >2nd and third pair, the JSP seems to work fine. Can someone help?
> >
> >Thanks,
> >Scott
> >
> >
> >
> >
> >--
> >To unsubscribe, e-mail:
> ><mailto:struts-user->[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: Need help with html:select and html:options

2003-01-23 Thread Suresh Addagalla
Check if you have month & day properties defined in your form bean.

Suresh

>-Original Message-
>From: Scott Seong [mailto:[EMAIL PROTECTED]] 
>Sent: Friday, January 24, 2003 11:32 AM
>To: Struts Users Mailing List
>Subject: Need help with html:select and html:options
>
>
>Hello,
>
>I'm having trouble with html:select and html:options. Basically, I have
>three select/options pairs in a JSP page, and the result is complaining
>about "No getter method available for Property month for bean 
>name under
>org.apache...". Here is the code sample:
>
><%
>Vector states = new Vector();
>
>states.add(new LabelValueBean("Alabama", "AL"));
>
>states.add(new LabelValueBean("Alaska", "AK"));
>
>...
>
>pageContext.setAttribute( "states", states);
>
>Vector months = new Vector();
>
>months.add(new LabelValueBean("Month", "00"));
>
>months.add(new LabelValueBean("January", "01"));
>
>...
>
>pageContext.setAttribute( "months", months);
>
>
>
>Vector days = new Vector();
>
>days.add(new LabelValueBean("Day", "00"));
>
>days.add(new LabelValueBean("1", "01"));
>
>...
>
>pageContext.setAttribute( "days", days);
>
>%>
>
>
>Then, I have html:select and html:options tags as shown below:
>
>
>labelProperty="label" />
>
>
>
>
>
>labelProperty="mLabel"
>/>
>
>
>
>
>
>labelProperty="dLabel" />
>
>
>
>
>
>The JSP chokes at the 2nd select/options, and I don't know 
>why. If I remove
>2nd and third pair, the JSP seems to work fine. Can someone help?
>
>Thanks,
>Scott
>
>
>
>
>--
>To unsubscribe, e-mail:   
><mailto:struts-user->[EMAIL PROTECTED]>
>For 
>additional commands, 
>e-mail: <mailto:[EMAIL PROTECTED]>
>


**Disclaimer** 
   
 
 Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' 
and 'confidential' and intended for use only by the individual or entity to which it 
is 
addressed. You are notified that any use, copying or dissemination of the information 
contained in the E-MAIL in any manner whatsoever is strictly prohibited.







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


Need help with html:select and html:options

2003-01-23 Thread Scott Seong
Hello,

I'm having trouble with html:select and html:options. Basically, I have
three select/options pairs in a JSP page, and the result is complaining
about "No getter method available for Property month for bean name under
org.apache...". Here is the code sample:

<%
Vector states = new Vector();

states.add(new LabelValueBean("Alabama", "AL"));

states.add(new LabelValueBean("Alaska", "AK"));

...

pageContext.setAttribute( "states", states);

Vector months = new Vector();

months.add(new LabelValueBean("Month", "00"));

months.add(new LabelValueBean("January", "01"));

...

pageContext.setAttribute( "months", months);



Vector days = new Vector();

days.add(new LabelValueBean("Day", "00"));

days.add(new LabelValueBean("1", "01"));

...

pageContext.setAttribute( "days", days);

%>


Then, I have html:select and html:options tags as shown below:




















The JSP chokes at the 2nd select/options, and I don't know why. If I remove
2nd and third pair, the JSP seems to work fine. Can someone help?

Thanks,
Scott




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




Re: html:select and html:options

2003-01-03 Thread Jose Luis
RE: html:select and html:optionsnow i have the page www.husted.com/struts/, please 
could you guideme where exactly or moreless?

Thanks
p.s happy new year
  - Original Message - 
  From: Sterin, Ilya 
  To: 'Jose Luis ' ; 'Struts Users Mailing List ' 
  Sent: Friday, January 03, 2003 7:08 PM
  Subject: RE: html:select and html:options


  You can use the LabelValueBean class for that, see www.husted.com for examples. 

  Ilya 

  -Original Message- 
  From: Jose Luis 
  To: Struts Users Mailing List 
  Sent: 1/3/03 11:04 AM 
  Subject: html:select and html:options 

  hi everyone, i have a page whit the following code: 

   

   

   

  where sectorCompany is an ArrayList that i built prior to view the jsp. 
  My problem is: 

  what i really need is to pass to the result action the value which 
  represents the labels that contains the SectorCompany ArrayList, so, How 
  i can build a select that shows labels but that also stores the id 
  (longs representing registers in a RDBMS) to pass this id? 



  Thank everybody in advance. 

  ps. If someOne knows a subject in the mailing list which already solves 
  this plese redirectme to it. 

  José Luis 







RE: html:select and html:options

2003-01-03 Thread Sterin, Ilya
You can use the LabelValueBean class for that, see www.husted.com for
examples.

Ilya

-Original Message-
From: Jose Luis
To: Struts Users Mailing List
Sent: 1/3/03 11:04 AM
Subject: html:select and html:options

hi everyone, i have a page whit the following code:







where sectorCompany is an ArrayList that i built prior to view the jsp.
My problem is:

what i really need is to pass to the result action the value which
represents the labels that contains the SectorCompany ArrayList, so, How
i can build a select that shows labels but that also stores the id
(longs representing registers in a RDBMS) to pass this id?


Thank everybody in advance.

ps. If someOne knows a subject in the mailing list which already solves
this plese redirectme to it.

José Luis






html:select and html:options

2003-01-03 Thread Jose Luis
hi everyone, i have a page whit the following code:







where sectorCompany is an ArrayList that i built prior to view the jsp. My problem is:

what i really need is to pass to the result action the value which represents the 
labels that contains the SectorCompany ArrayList, so, How i can build a select that 
shows labels but that also stores the id (longs representing registers in a RDBMS) to 
pass this id?


Thank everybody in advance.

ps. If someOne knows a subject in the mailing list which already solves this plese 
redirectme to it.

José Luis






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: 




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: html:select and html:options

2001-08-06 Thread Craig R. McClanahan



On Mon, 6 Aug 2001, Stefan Faist wrote:

> Hello all,
> I these two lists:
> 
>   
>   
>   labelProperty="label" />
>   
> 
> 
>property="allProjekt_aktivitaeten" />
>   
>labelProperty="label" />
>   
> 
> 
> I want this:
> When I select one element in the list <... id="names" ...> the then the list
> <... id="aktivitaeten" ...> get elements, that are the activities from the
> element of the first list. Is there a way to call a action when I select a
> element?
> I hope you understand what I want.
> 

There are two possible scenarios, depending on how big the various lists
of options for the second select box is.

* You can use Javascript to detect changes in the first select box,
  and dynamically change the contents of the second box.  This requires
  that the various choices for the second box are small enough to have
  been included in the page -- perhaps as Javascript arrays of strings.

* You can use Javascript to detect changes in the first select box,
  and then submit the form for you.  You'll need to tell the Action that
  receives the form that this is *only* being submitted to repopulate
  the second select box -- perhaps by setting the value of a particular
  hidden variable in the form -- so that it will just redisplay the form
  with the updated values.

None of this is really particular to Struts -- we're stuck with the
capabilities of HTTP and HTML that we are running on top of.

> Is there any way to do this?
> Can someone help me?
> 
> Best regards,
> STEFAN
> 

Craig McClanahan




html:select and html:options

2001-08-06 Thread Stefan Faist

Hello all,
I these two lists:













I want this:
When I select one element in the list <... id="names" ...> the then the list
<... id="aktivitaeten" ...> get elements, that are the activities from the
element of the first list. Is there a way to call a action when I select a
element?
I hope you understand what I want.

Is there any way to do this?
Can someone help me?

Best regards,
STEFAN


--
hmi-Informatik GmbH
Zettachring 6 - D-70567 Stuttgart
E-Mail: [EMAIL PROTECTED]
http://www.hmi-informatik.de




RE: accessing user-defined classes from html:select and html:options tags

2001-07-25 Thread Philip Tucker

I added the import statement, but still get the same error.  It's in a
Struts method called "BeanUtils.populate".  I have the imported class in my
.WAR file, and I even tried placing it directly in the server class path,
but still the same error.  Any ideas?

Below is the full error text.

Thanks for the help,
Philip


Internal Servlet Error:

javax.servlet.ServletException: BeanUtils.populate
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:774)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20
61)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1563)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)

Root cause: 
java.lang.IllegalArgumentException: argument type mismatch
at java.lang.reflect.Method.invoke(Native Method)
at
org.apache.struts.util.PropertyUtils.setSimpleProperty(PropertyUtils.java:98
8)
at
org.apache.struts.util.PropertyUtils.setNestedProperty(PropertyUtils.java:90
4)
at
org.apache.struts.util.PropertyUtils.setProperty(PropertyUtils.java:932)
at org.apache.struts.util.BeanUtils.populate(BeanUtils.java:509)
at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:772)
at
org.apache.struts.action.ActionServlet.processPopulate(ActionServlet.java:20
61)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1563)
at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:213)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:484)

> -Original Message-
> From: eden [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 23, 2001 7:23 PM
> To: [EMAIL PROTECTED]
> Subject: RE: accessing user-defined classes from html:select and
> html:options tags
> 
> 
> Hi!  I know you asked this question last Friday, but I didn't 
> see a response
> to it in the last several days.  So, in case you're still 
> wondering, yes -
> you've got to import that class into the jsp page in order 
> for it to be used
> in the page context.  And don't forget that it needs to be in your web
> server's classpath!
> 
> Hope this helps,
> Melissa
> Web Developer
> 
> -Original Message-
> From: Philip Tucker [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 9:39 PM
> To: '[EMAIL PROTECTED]'
> Cc: Jyotisana Verma
> Subject: accessing user-defined classes from html:select and
> html:options tags
> 
> 
> I'm using Struts 1.0 with Tomcat 3.2.2 and JBoss 2.2.2.  I'm using an
>  containing an  tag in a JSP, with 
> the property
> attributes referring to form and bean fields.  It works fine 
> when the Java
> class of the 2 bean properties is String, but when I try to 
> use class I
> created I get an error.  I've verified my .class file is in 
> the deployment
> WAR file.
> 
> Do I have to do something special to use my own class?  Do I 
> need an import
> statement in the JSP?
> 
> Thanks,
> Philip
> 



accessing user-defined classes from html:select and html:options tags

2001-07-20 Thread Philip Tucker

I'm using Struts 1.0 with Tomcat 3.2.2 and JBoss 2.2.2.  I'm using an
 containing an  tag in a JSP, with the property
attributes referring to form and bean fields.  It works fine when the Java
class of the 2 bean properties is String, but when I try to use class I
created I get an error.  I've verified my .class file is in the deployment
WAR file.

Do I have to do something special to use my own class?  Do I need an import
statement in the JSP?

Thanks,
Philip



RE: how to set the default selected value using html:select and html:options

2001-05-18 Thread Sidney Chong

Doh, found my problem... my form bean name was capitalised in my
struts-config file whereas in my action and jsp files, I wasn't using the
capitalised name! grr... its errors like that which is hard to find.

-Original Message-
From: Jae W. Chang [mailto:[EMAIL PROTECTED]]On Behalf Of
[EMAIL PROTECTED]
Sent: Friday, 18 May, 2001 4:38 PM
To: [EMAIL PROTECTED]
Subject: how to set the default selected value using html:select and
html:options


yes, it does what you'd expect it to. selects the label that
corresponds to the value of the property in the form bean.

i'd recommend checking out the exercise-taglib examples. there are
samples of how to drive most of the html tags.

jae




how to set the default selected value using html:select and html:options

2001-05-18 Thread struts

yes, it does what you'd expect it to. selects the label that
corresponds to the value of the property in the form bean.

i'd recommend checking out the exercise-taglib examples. there are
samples of how to drive most of the html tags.

jae



how to set the default selected value using html:select and html:options

2001-05-18 Thread Sidney Chong
Title: forms and javascript



Hi 
guys, just wondering if I've misunderstood the workings of the html:select and 
html:options tag. Is it true that html:options tag will automatically set 
the default selected value to that of the property declared in html:select? or 
is there a need to set the value explictly using the "value" 
attribute?
 
I'm 
assuming the former but it sure as hell isn't showing on my form. Any 
advice?
 
Cheers
Sidney