File---->AppicationResources_es_CL.properties
page.one= PAGE1
page.two= PAGE2
------------------------------------------
File---->entrada.jsp
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html>
<head>
<title>
entrada
</title>
</head>
<body bgcolor="#ffffff">
<html:form action="/myAction">
<html:submit property="accion"><bean:message key="page.one"/></html:submit>
<html:submit property="accion"><bean:message key="page.two"/></html:submit>
</html:form>
</body>
</html:html>
--------------------------------------
File------->flow1.jsp
<html>
<head>
<title>
flow1
</title>
</head>
<body bgcolor="#ffffff">
<h1>
Flow1
</h1>
</body>
</html>
-----------------------------
File-->flow2.jsp
<html>
<head>
<title>
flow2
</title>
</head>
<body bgcolor="#ffffff">
<h1>
Flow2
</h1>
</body>
</html>
------------------------
File--->struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="myActionForm" type="sample.actionForm.MyActionForm" />
</form-beans>
<action-mappings>
<action name="myActionForm" parameter="accion" path="/myAction" scope="request" type="sample.actions.MyAction" validate="false">
<forward name="pagina1" path="/flow1.jsp" />
<forward name="pagina2" path="/flow2.jsp" />
</action>
</action-mappings>
<message-resources parameter="sample.resources.ApplicationResources" />
</struts-config>
----------------------------------------
File-->MyActionForm.java
package sample.actionForm;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
public class MyActionForm extends ActionForm {
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest httpServletRequest) {
return null;
}
public void reset(ActionMapping actionMapping,
HttpServletRequest servletRequest) {
}
}
--------------------------------
File-->MyAction.java
package sample.actions;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.actions.LookupDispatchAction;
import java.util.Map;
import java.util.HashMap;
public class MyAction extends LookupDispatchAction {
public ActionForward method1(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
System.out.println("method1");
return actionMapping.findForward("pagina1");
}
public ActionForward method2(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest servletRequest,
HttpServletResponse servletResponse) {
System.out.println("method2");
return actionMapping.findForward("pagina2");
}
protected Map getKeyMethodMap() {
Map map = new HashMap();
map.put("page.one","method1");
map.put("page.two","method2");
return map;
}
}
can you make this code??