struct-config.xml
<struts-config>
<form-beans>
<form-bean name="loginForm"
type="app.LoginForm"/>
</form-beans>
<global-forwards>
<forward name="welcome"
path="/Welcome.do"/>
</global-forwards>
<action-mappings>
<action path="/Welcome"
forward="/pages/Home.jsp"/>
<action path="/login"
type="app.LoginAction"
name="loginForm"
scope="request"
validate="true"
input="/pages/Login.jsp">
<forward name="success"
path="/pages/success.jsp"/>
</action>
</action-mappings>
<controller
processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="MessageResources" />
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config"
value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
</struts-config>
---------------------------------------------------
login.jsp
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<HTML>
<HEAD>
<TITLE>Sign in, Please!</TITLE>
</HEAD>
<BODY>
<html:errors/>
<html:form action="/login">
<TABLE border="0" width="100%">
<TR>
<TH align="right"><FONT SIZE="5">Username:</FONT></TH>
<TD align="left"><html:text property="username"/></TD>
</TR>
<TR>
<TH align="right"><FONT SIZE="5">Password:</FONT></TH>
<TD align="left"><html:password property="password"/></TD>
</TR>
<TR>
<TD align="right"><html:submit/></TD>
<TD align="right"><html:reset/></TD>
</TR>
</TABLE>
</html:form>
</BODY>
</HTML>
--------------------------------------------------------------------------------------
success.jsp
<html>
<body>
<h1> successfully logged in</h1>
</body>
</html>
-------------------------------------------------------------------------------
login form
package app;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public final class LoginForm extends ActionForm {
private
String password = null;
private String username = null;
public String getUsername() {
return (this.username);
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return (this.password);
}
public void setPassword(String password) {
this.password = password;
}
}
}
---------------------------------------------------------------------
login action
package app;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
//import org.apache.struts.action.ActionServlet;
import app.dao.mydao.dao;
public final class LoginAction extends Action {
public boolean isUserLogin(String username, String password)
{
dao t2=new dao();
String pass=null;
try
{
pass=t2.select(username);
}
catch (SQLException e)
{
e.printStackTrace();
}
if (password.equals(pass))
return true;
else
return false;
}
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
String username = ((LoginForm) form).getUsername();
String password = ((LoginForm) form).getPassword();
boolean validated = false;
try
{
validated = isUserLogin(username,password);
}
catch (Exception e) {
ActionErrors errors = new ActionErrors();
errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError("error.logon.connect"));
saveErrors(request,errors);
return (new ActionForward(mapping.getInput()));
}
return (mapping.findForward("success"));
}
}
------------------------------------------------
when i try to login it is not going to success.jsp page. instead it is showing me a blank page with url
http://localhost:8080/oxy/login.do
is there anything wrong in my program