Have a look at the struts-showcase examples. There are lots of
s:select tags with Actions.

http://www.planetstruts.org/struts2-showcase/tags/ui/example!input.action

Regards
-- 
Markus Stauffer


On Wed, Feb 13, 2008 at 9:17 AM, Prashant Khanal
<[EMAIL PROTECTED]> wrote:
> Hello Markus,
>
>  Can you please elucidate your mail with an example?
>  Actually my requirement is if i use a list of objects to populate on the
>  select element, how can i get the selected element as an object. For example
>  if i populate select element using list of Banner objects,  how can i get
>  the  selected value as a Banner object not just  as an id.
>  My be i am missing something as i am new to struts 2.
>
>
>
>
>  On 2/13/08, Markus Stauffer <[EMAIL PROTECTED]> wrote:
>  >
>  > Hi
>  > name="concept" means the struts Action will call the setConcept()
>  > method with the selected value as parameter. You want to add an
>  > instance variable named conecept in your Action class. Add getters and
>  > setters as well.
>  >
>  > Regards
>  > --
>  > Markus Stauffer
>  >
>  >
>  > On Wed, Feb 13, 2008 at 5:31 AM, Prashant Khanal
>  > <[EMAIL PROTECTED]> wrote:
>  > > Hello all,
>  > >  I just started working on struts 2 and stuck in a problem.
>  > >  I have a page that consists of a select element and a submit button:
>  > >  <s:form name="conceptSelection" action="sequenceSelection"
>  > method="post">
>  > >     <li><s:select label="Select Concept" name="concept" list="banners"
>  > >  listKey="id"
>  > >         listValue="bannerName" /></li>
>  > >     <li><s:submit cssClass="button" /></li>
>  > >  </s:form>
>  > >  The select element populates list of Banner objects.
>  > >  @Entity
>  > >  @Table(name="DTC_BANNER")
>  > >  public class Banner implements Serializable {
>  > >
>  > >     private Long id;
>  > >     private String bannerName;
>  > >
>  > >     @Id
>  > >     @GeneratedValue(strategy=GenerationType.AUTO)
>  > >     @Column(name="banner_id")
>  > >     public Long getId() {
>  > >         return id;
>  > >     }
>  > >     public void setId(Long id) {
>  > >         this.id = id;
>  > >     }
>  > >
>  > >     @Column(name="banner_name")
>  > >     public String getBannerName() {
>  > >         return bannerName;
>  > >     }
>  > >     public void setBannerName(String bannerName) {
>  > >         this.bannerName = bannerName;
>  > >     }
>  > >
>  > >  }
>  > >
>  > >  So i fetch the list of available banners from the database and populate
>  > in
>  > >  the select element. The select element displays correctly.
>  > >
>  > >  Now after the user clicks on the submit button the
>  > >  SequenceSelectionAction.java comes into act and now i want to fetch the
>  > >  banner selected in the previous page. In fact i could only fetch the id
>  > of
>  > >  the banner object selected as the listKey property is assigned "id".
>  > >
>  > >  Is there any way i can get the Banner object rather than just id?
>  > >
>  > >  --
>  > >  Thanks,
>  >
>  > >  Prashant Khanal <[EMAIL PROTECTED]>
>  > >  <http://www.nepalhomepage.com>
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>
>  --
>
> Thanks,
>  Prashant Khanal
>  [EMAIL PROTECTED]
>  Solutions for your information
>  _________________
>  Yomari Pvt. Ltd.
>  HB Complex, Ekantakuna, Lalitpur.
>  G.P.O. Box: 21295
>  Kathmandu, Nepal
>  Tel: 977 (1) 5000111, 2113000
>  Fax: 977 (1) 5000157
>  http://www.yomari.com
>  ____________________
>  Your guide to Nepal on the Net.
>  http://www.nepalhomepage.com
>

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

Reply via email to