Fala Galera,
Estou tentando rodar esse código e tá dando esse erro:
INFO: Initialize action or type: br.com.wincomp.AlterarCursosAction
org.apache.struts.action.ActionMapping findForward
WARNING: Unable to find “failure” forward.
struts-config.xml
<action-mappings>
<action
path="/alterarCursos"
scope="session"
type="br.com.wincomp.AlterarCursosAction"
unknown="false"
validate="false">
<forward
name="success"
path="/pages/alterarcursos.jsp"
reditect="false"
contextRelative="false"/>
</action>
</action-mappings>
AlterarCursosAction.java
package br.com.wincomp;
import java.sql.*;
import java.util.*;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class AlterarCursosAction extends Action{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception{
ActionErrors errors = new ActionErrors();
try {
HttpSession s = request.getSession();
AdminCursos c = new AdminCursos();
String idcurso = request.getParameter("idCurso");
s.removeAttribute("alterarCursoBean");
LinkedList listaCursos = (LinkedList)s.getAttribute("listabean");
Iterator i = listaCursos.iterator();
while(i.hasNext()){
Curso curso = (Curso)i.next();
if(curso.getIdCurso() == Integer.parseInt(idcurso)){
s.setAttribute("alterarCursoBean", curso);
break;
}
}
} catch (Exception e) {
return (mapping.findForward("failure"));
}
return (mapping.findForward("success"));
}
}
alterarcursos.jsp
<%@ page import="br.com.wincomp.*"%>
<%@ page import="java.util.*"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<logic:notPresent name="alterarCursoBean" scope="session">
<logic:redirect forward="error"/>
</logic:notPresent>
<html:html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="estilo.css" type="text/css" rel="stylesheet">
</head>
<body>
<center>
<br>
<html:form action="salvarCurso.do" method="post">
<html:hidden property="idCurso" name="alterarCursoBean"/>
<table border="0">
<tr>
<td align="right">idcurso:</td>
<td align="left"><b>
<bean:write property="idCurso" name="alterarCursoBean"/>
</b></td>
</tr>
<tr>
<td align="right">Curso:</td>
<td align="left"><b>
<html:text property="curso" name="alterarCursoBean" size="20"/>
</b></td>
</tr>
<tr colspan="2" align="center">
<html:submit>Alterar</html:submit>
<html:reset>Cancelar</html:reset>
</tr>
</table>
</html:form>
</center>
</body>
</html:html>
Valeu !!!