Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

html:multibox

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam new to struts

i cant retrieve values from database using html:multibox

error is :

org.apache.jasper.JasperException: Exception in JSP: /jsp/Check.jsp:19

16: </head>
17: <body>
18: <html:form action="Check" method="post">
19: <logic:iterate id="item" property="check" name="checkForm">
20: <html:multibox property="check" name="checkForm">
21: <bean:write name="item"/>
22: </html:multibox>

javax.servlet.ServletException: No getter method for property: "check" of bean: "checkForm"

this is my jsp page:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>

<%@ page import="jobportal.beans.Check"%>
<%@ page import="jobportal.struts.actionform.CheckForm"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">;
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Check</title>
</head>
<body>
<html:form action="Check" method="post">
<logic:iterate id="item" property="check" name="checkForm">
<html:multibox property="check" name="checkForm">
<bean:write name="item"/>
</html:multibox>
<bean:write name="item"/>
</logic:iterate>

<
</html:form>

my form bean:

package jobportal.struts.actionform;
import jobportal.beans.*;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class CheckForm extends ActionForm {
private String employeeStatus;

public String getEmployeeStatus() {
return employeeStatus;
}

public void setEmployeeStatus(String employeeStatus) {
this.employeeStatus = employeeStatus;
}

}
my dao is :
public ArrayList getCheck(HttpServletRequest request,String path,String uName) throws Exception
{
SQLExecuter sqlExe = new SQLExecuter(this.path,JobPortalConstants.DATA_SOURCE_KEY);
ArrayList arraylist=null;
try
{

java.sql.ResultSet rs = sqlExe.executeSql2("GetCheck", new String[0]);
arraylist=new ArrayList();
while(rs.next())
{
System.out.println("gdsd");
String employeeStatus=rs.getString(1);
Check check =new Check();
check.setEmployeeStatus(employeeStatus);
arraylist.add(check);


}
sqlExe.closeConnection();
} catch (Exception e) {
System.out.println("CheckActionsexception"+e);
sqlExe.closeConnection();
throw e;
}

return arraylist ;
}
}

my action class is:
public ActionForward execute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException {
ActionMessages msgs = new ActionMessages();
//String target = "failure2";
ActionErrors errors = new ActionErrors();
try{

String path = this.getServlet().getServletContext()
.getRealPath("/");

String uName="kizar";
System.out.println("name"+uName);
CheckForm checkForm=(CheckForm)form;
CheckActions checkactions=new CheckActions(checkForm,uName);
ArrayList list=checkactions.getCheck(request, path, uName);
request.setAttribute("check", list);


} catch (Exception e) {
System.out.println("actionPage"+e);
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
e.printStackTrace(pw);
logger.fatal(sw.toString());
} finally {
}
return mapping.findForward("check");
}

can any one solve my problem
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:multibox name="privileges" property="privilegeID">
<bean:write name="privileges" property="privilegeID"/>
</html:multibox>

here name is the iterate id.
and property is your formbean property..like that .....
 
Jayesh Sisodiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:multibox name="privileges" property="privilegeID">
<bean:write name="privileges" property="privilegeID"/>
</html:multibox>

here name is the iterate id.
and property is your formbean property..like that .....
 
Jayesh Sisodiya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<html:multibox name="privileges" property="privilegeID">
<bean:write name="privileges" property="privilegeID"/>
</html:multibox>

here name is the iterate id.
and property is your formbean property..like that .....
 
Paper jam tastes about as you would expect. Try some on this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic