Senhores podem me ajudar no caso abaixo:
<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/tags/struts-bean</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-html</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-logic</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-nested</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/tags/struts-tiles</taglib-uri>
<taglib-location>/WEB-INF/tld/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jstl/c</taglib-uri>
<taglib-location>/WEB-INF/tld/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jtl/cal</taglib-uri>
<taglib-location>/WEB-INF/tld/cal.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>jtl/displaytag</taglib-uri>
<taglib-location>/WEB-INF/tld/displaytag-11.tld</taglib-location>
</taglib>
</web-app>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0 EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<form-beans>
<form-bean name="registerForm" type="com.livro.RegisterForm"/>
</form-beans>
<action-mappings>
<action path="/register"
type="com.livro.RegisterAction"
name="registerForm">
<forward name="sucess" path="/sucess.jsp"/>
<forward name="erro" path="/erro.jsp"/>
</action>
</action-mappings>
</struts-config>
<%@ taglib uri="WEB-INF/tld/struts-html.tld" prefix="html"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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>Insert title here</title>
</head>
<body>
<html:form action="register.jsp">
Nome:<html:text property="nome"/><br>
Senha1:<html:text property="senha1"/><br>
Senha2:<html:text property="senha2"/><br>
<html:submit value="Register" />
</html:form>
</body>
</html>
package com.livro;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class RegisterAction extends Action{
public ActionForward perfom(ActionMapping map, ActionForm form, HttpServletResponse response, HttpServletRequest request){
RegisterForm rf = (RegisterForm) form;
ActionForward retorno = null;
String username = rf.getNome();
String password1 = rf.getSenha1();
String password2 = rf.getSenha2();
if (password1.equals(password2)) {
try{
retorno = map.findForward("sucesso");
}catch (Exception e) {
retorno = map.findForward("erro");
}
}
return retorno;
}
}
package com.livro;
import org.apache.struts.action.ActionForm;
public class RegisterForm extends ActionForm{
private String nome;
private String senha1;
private String senha2;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSenha1() {
return senha1;
}
public void setSenha1(String senha1) {
this.senha1 = senha1;
}
public String getSenha2() {
return senha2;
}
public void setSenha2(String senha2) {
this.senha2 = senha2;
}
}
HTTP Status 404 - /exercicio-livro/
description The requested resource (/exercicio-livro/) is not available.
Esta dando esse erro, vcs podem me???
Obrigado…