Alguem sabe pq acontece esse erro em minha aplicação Struts? estou 3 dias tentando resolver esse problema…
javax.servlet.ServletException: No getter method for property codOperacao of bean atributosOperacao
Obrigado.
Trecho de codigo da minha action:
try {
OpeDAO opeDAO = new OpeDAO();
HttpSession session = request.getSession();
String codOperacao = request.getParameter("codOperacao");
int idOpe = Integer.parseInt(codOperacao);
ArrayList atributosOpe = opeDAO.AtributoOperacao(idOpe);
session.setAttribute("atributosOperacao", atributosOpe);
}
catch (Exception e) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.ope.edita"));
}
Trecho da classe OpeDAO:
public ArrayList AtributoOperacao(int idOperacao) throws SQLException {
conn = retornaConn();
Statement stmt = conn.createStatement();
ArrayList atributos = new ArrayList();
try {
ResultSet rs = stmt.executeQuery ("select * from Tab_Operacao where CodOperacao LIKE '%" + idOperacao + "%'");
if (rs.next()) {
OpeBean ope = new OpeBean();
ope.setCodOperacao(rs.getInt("CodOperacao"));
ope.setDescricao(rs.getString("Descricao"));
ope.setAtivo(rs.getInt("Ativo"));
ope.setId(rs.getInt("CodUsuario"));
ope.setTipoOperacao(rs.getInt("TipoOperacao"));
atributos.add(ope);
}
rs.close();
}
catch (SQLException e) {
throw e;
}
finally{
stmt.close();
conn.close();
}
System.out.println(atributos);
return atributos;
}
--------------------------------------------------------------------------------------Techo da minha JSP:
<html:form action="/salvaEditaOpe.do">
Código: <bean:write name=“atributosOperacao” property=“codOperacao”/>
Descrição: <html:text name="atributosOperacao" property="descricao"/>
<html:radio property="ativo" value="1" name="atributosOperacao">Ativo</html:radio>
<html:radio property="ativo" value="2" name="atributosOperacao">Inativo</html:radio>
<html:submit>Alterar</html:submit>
</html:form>