struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Kirdatt <Amit.Kird...@Ingenix.com>
Subject RE: [newbie]: Accessing labelProperty in <html:options>
Date Tue, 22 Jul 2003 14:19:04 GMT
Shyam,
Here is a way to do it! It might not be the most elegent way of doing it,
but it is a way none the less from top of my head.

In your Action class get the term code by doing the following

int termCode = ((MyCodeForm)anActionForm).getTermCode();

Then do this:

HttpSession t_HttpSession = aRequest.getSession();
ArrayList t_ArrayList = (t_ArrayList)t_HttpSession.getAttribute("termList");
Iterator t_Iterator = t_ArrayList.iterator();
String termLabel = null;

while( t_Iterator.hasNext() )
{
  MyBean t_MyBean = (MyBean)t_Iterator.next();
  
  if(termCode == t_MyBean.getValue())
  {
    //we found the term code
    termLabel = t_MyBean.getLabel();
    break;
  }
}

Hope this helps..


--Amit


-----Original Message-----
From: Shyam A [mailto:struts_newbie@yahoo.com]
Sent: Monday, July 21, 2003 8:14 PM
To: Struts Users Mailing List
Subject: RE: [newbie]: Accessing labelProperty in <html:options> 


Amit,

Sorry, I overlooked your code and missed something. I
need to access both the termCode (property) and
name(labelProperty) in my action class.
Is there a way to do it?

Thanks,
Shyam

--- Amit Kirdatt <Amit.Kirdatt@Ingenix.com> wrote:
> To access the selected value in your action class
> 
> ((MyCodeForm)anActionForm).getTermCode()
> 
> --Amit
> 
> -----Original Message-----
> From: Amit Kirdatt 
> Sent: Monday, July 21, 2003 5:17 PM
> To: 'Struts Users Mailing List'
> Subject: RE: [newbie]: Accessing labelProperty in
> <html:options> 
> 
> 
> Do the following:
> 
> <html:select property="termCode"
> onchange="submitForm(this.form)">	
>   <html:options collection="termList"
> property="label"
> labelProperty="label"/>
> </html:select>
> 
> 
> 
> -----Original Message-----
> From: Shyam A [mailto:struts_newbie@yahoo.com]
> Sent: Monday, July 21, 2003 3:04 PM
> To: struts-user@jakarta.apache.org
> Subject: [newbie]: Accessing labelProperty in
> <html:options> 
> 
> 
> Hi,
> 
> I'm using the <html:options> tag to populate a
> drop-down list from a collection.
> 
> My code is as follows:
> 
> <html:select property="termCode"
> onchange="submitForm(this.form)">
> <html:options
> collection="termList" property="value"
> labelProperty="label"/>
> </html:select>
> 
> The property "termCode" is a string in my ActionForm
> class. I would like to access the selected value in
> the drop-down, i.e, labelProperty in my ActionClass.
> I'm not sure how it is done.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> Shyam
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> This e-mail, including attachments, may include
> confidential and/or
> proprietary information, and may be used only by the
> person or entity to
> which it is addressed. If the reader of this e-mail
> is not the intended
> recipient or his or her authorized agent, the reader
> is hereby notified that
> any dissemination, distribution or copying of this
> e-mail is prohibited. If
> you have received this e-mail in error, please
> notify the sender by replying
> to this message and delete this e-mail immediately.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 
> 
> This e-mail, including attachments, may include
> confidential and/or
> proprietary information, and may be used only by the
> person or entity to
> which it is addressed. If the reader of this e-mail
> is not the intended
> recipient or his or her authorized agent, the reader
> is hereby notified that
> any dissemination, distribution or copying of this
> e-mail is prohibited. If
> you have received this e-mail in error, please
> notify the sender by replying
> to this message and delete this e-mail immediately.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.

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


Mime
View raw message