//Action class
package demo;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;
public class RegisterAction1 extends Action {
public ActionForward execute(HttpServletRequest request,
HttpServletResponse response,
ActionForm form,
ActionMapping mapping) throws Exception
{
return (mapping.findForward("success"));
}
}
//register1.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body bgcolor="pink">
<center>
<h1>New Account Registration</h1>
<form ACTION="register1.do" method="get">
Email Address: <input type="text" name="email"/><BR>
Password: <input type="password" name="password"/><BR>
<input type="submit" value="Sign me On"/>
</form>
</center>
</body>
</html>
//confirm-registration.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>
<center>
<h1>You have been registered successfully.</h1>
Congratualtions
</center>
</body>
</html>
//struts-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<data-sources></data-sources>
<form-beans></form-beans>
<global-exceptions></global-exceptions>
<global-forwards>
</global-forwards>
<action-mappings>
<action path="/register1"
type="demo.RegisterAction1">
<forward name="success" path="/confirm-registration.jsp"/>
</action>
</action-mappings>
<controller></controller>
</struts-config>
//web.xml
<welcome-file-list>
<welcome-file>register1.jsp</welcome-file>
</welcome-file-list>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.