aspose file tools*
The moose likes Struts and the fly likes dropdown problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "dropdown problem" Watch "dropdown problem" New topic
Author

dropdown problem

Vishal Maga
Greenhorn

Joined: Nov 27, 2007
Posts: 11
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();
while(rs.next()){
arr.add(new org.apache.struts.util.LabelValueBean(rs.getString("domainID"), rs.getString("domainName")));

}

} catch (Exception e) {
e.printStackTrace();
}

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
Greenhorn

Joined: Nov 27, 2007
Posts: 11
Hi,
i did some following modification, but still not getting answer.
jsp:-

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

bean:-
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;
}
Action:-
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;

dropdownForm.setDomain(details);
request.setAttribute("domain", details);

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

}
struts-config:-
<form-bean name="ExpSearchBean"
type="com.project.web.Search.form.ExpSearchBean">
<form-property name="selectedDomain" type="java.lang.String"/>
</form-bean>

<action path="/loadData" name="ExpSearchBean"
type="com.project.web.Search.action.SearchBeanAction"
parameter="loadData"
input="/ExpSearchCandidate.jsp">
<forward name="success" path="/ExpSearchCandidate.jsp" />
</action>

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

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dropdown problem