I¹m pretty new to Struts2 myself, but all of my Appfuse Struts2 pages use a
select tag something like this:

        <s:select name="storyText.status.id"
         list="activeStatusList" listKey="id" listValue="name"
key="storyText.status"/>
I think your tag looks more like a Struts(1) tag.

Here is the Struts2 reference page for the select tag:
    http://struts.apache.org/2.0.11.1/docs/select.html

Hope this helps.



From: Bandula Rathnasekara <[EMAIL PROTECTED]>
Reply-To: <users@appfuse.dev.java.net>
Date: Sun, 1 Jun 2008 12:36:01 +0530
To: <[EMAIL PROTECTED]>
Cc: <users@appfuse.dev.java.net>
Subject: [appfuse-user] Drop-Down List

Hi all,
 
I want to add simple drop down list in a JSP page with my Struts2 web
application on AppFuse framework. I went through related post in web and
tried to do it with StartupListener class.
 
I created/modified following classes/jsp.
 
1.      Created Statuses POJO.

Not used for the time being

 

2.      Constant

public static final String AVAILABLE_STATUSES =  "availableStatuses";

 

3.      StartupListner

context.setAttribute(Constants.AVAILABLE_STATUSES ,
mgr.getObjects(TaskStatuses.class));

 

4.      LookupManager

public List<LabelValue> getObjects(Class<TaskStatuses> name);

 

5.      LookupManagerImpl

public List<LabelValue> getObjects(Class<TaskStatuses> name) {

      List<LabelValue> list = new ArrayList<LabelValue>();

      list.add(new LabelValue("PENDING", "PENDING"));

      list.add(new LabelValue("OPEN", "OPEN"));

      list.add(new LabelValue("DONE", "DONE"));

      list.add(new LabelValue("HOLD", "HOLD"));

      return list;

}

 
6.      taskForm.jsp

<html:select property="status">

      <html:options collection="availableStatuses" property="status"
labelProperty="name"/>

</html:select>

 

 

 
I was struggling with this whole yesterday and I could not populate drop
down-list in my jsp. I don¹t even get error in JSP page. Is it do something
with tag libraries in? Any configuration XML file? Can you tell me where
else I need to change/correct.
 
If anyone has sample code on this or a place where I can find them pls let
me know.
 
Thanks &Regards,
Bandula


Reply via email to