This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

dropdown problem  RSS feed

Vishal Maga
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting this logic iterate.Below is my code for that please help.
In My JSp i have
<td height="21" align="left" bgcolor="#F3F3F3" class="smallwhitetext"><strong class="bluetext">Domain Knowledge </strong></td>
<td> <html:select property="selectedDomain" name ="ExpSearchBean">
<html ptions Collection="DomainDropdownList" name ="ExpSearchBean" property="domain" value="doaminID" label="domainName" /></html:select></td>

In action:-
DropdownGetDAO dropdown = new DropdownGetDAO();
Collection details2 = dropdown.fetch();
request.setAttribute("domain", details2);

And in DAo:-

public Collection fetch() {
String INSERT = "SELECT * FROM tbl_domain";
System.out.println("Search Query:: " + INSERT);
Collection arr = new ArrayList();
PreparedStatement pStmt = null;

ResultSet rs;
String s = null;
Connection con = getConnection();
try {
pStmt = con.prepareStatement(INSERT);

rs = pStmt.executeQuery();
arr.add(new org.apache.struts.util.LabelValueBean(rs.getString("domainID"), rs.getString("domainName")));


} catch (Exception e) {

return arr;
Every time i m getting failed to get the collection.
Please help. Is my JSp code is correct.

Thanks in advance
Vishal Maga
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did some following modification, but still not getting answer.

<html:select property="selectedDomain" styleClass="dropdown" size="1" >
<html ptions property="domain" />

public ArrayList getDomain() {
return domain;
public void setDomain(ArrayList domain) {

this.domain = domain;

public String getSelectedDomain() {
System.out.println("in get method"+selectedDomain);

return selectedDomain;

public void setSelectedDomain(String selectedDomain) {
System.out.println("in set method"+selectedDomain);
this.selectedDomain = selectedDomain;
public ActionForward loadData(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DomainFormGetDAO dao1 = new DomainFormGetDAO();

ArrayList details = dao1.fetch();
ExpSearchBean dropdownForm =(ExpSearchBean) form;

request.setAttribute("domain", details);

return (mapping.findForward("success"));

<form-bean name="ExpSearchBean"
<form-property name="selectedDomain" type="java.lang.String"/>

<action path="/loadData" name="ExpSearchBean"
<forward name="success" path="/ExpSearchCandidate.jsp" />

On load the dropdown is still blank. Please let me know where i m doing wrong.

Thanks in advance
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!