hi,
i have created my dropdown list, i am able to display data from the database, my
jsp code look like this
<html:select property="resume" size="3" multiple="true">
<html
ptions collection="usersCV" property="cvid" labelProperty="cvname" />
</html:select>
usersCV is the arralist which contains my bean, in turn bean contains cvid and cvname, my bean code look like this
public class UserCVList {
protected
String cvname;
protected Integer cvid;
public void setCvname(String cvname) {
this.cvname = cvname;
}
public String getCvname() {
return cvname;
}
public void setCvid(Integer cvid) {
this.cvid = cvid;
}
public Integer getCvid() {
return cvid;
}
}
i could display the info properly once i submit the page, it is giving this error,
org.apache.jasper.JasperException: Cannot find bean under name usersCV
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
.................
and my action code look like this
public class UserCVListAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
// Default target to success
String target = new String("success");
ArrayList usersCV = null;
try{
usersCV = UserData.getUserCVs(getDataSource(request));
if(usersCV == null) {
target = new String("login");
}else{
request.setAttribute("usersCV", usersCV);
}
} catch ( Exception e ) {
System.err.println("Setting target to error");
target = new String("error");
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("errors.database.error", e.getMessage()));
// Report any errors
if ( !errors.isEmpty() ) {
saveErrors(request, errors);
}
}
// Forward to the appropriate View
return (mapping.findForward(target));
}
}
my database method look like this
public static ArrayList getUserCVs(DataSource dataSource) {
UserCVList cvlist = null;
ArrayList userCVs = new ArrayList();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
try {
conn = dataSource.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("select * from cvtable");
while (rs.next()) {
cvlist = new UserCVList();
cvlist.setCvname(rs.getString("cvname"));
cvlist.setCvid(new Integer(rs.getInt("cvid")));
userCVs.add(cvlist);
}
.......
return userCVs;
}
could u plz help me out