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