Struts 申请空白页

Struts application giving blank page

我正在尝试获取用户的电子邮件和密码,在提交表单后,它会检查数据库是否存在电子邮件和密码,如果存在,则会将其转发给 success.jsp else failure.jsp 但是,当我提交表格时,它给我一个空白页,请帮助我

login.jsp

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

<html:html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <title>Login page</title>        
 </head>
 <body style="background-color: white">

 <html:form action="/login">
    <html:errors property="wrongcred" />
    
                 Email:
                 <html:text property="email" /><br><br>
                 Password:
                 <html:password property="pass" /><br><br>

     <html:submit value="Login" />
    </html:form>

    </body>
   </html:html> 

LoginAction.java

package com.myapp.struts;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.http.HttpServletRequest; 
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm; 
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class LoginAction extends org.apache.struts.action.Action {


private static final String SUCCESS = "success";
private static final String FAILURE = "failure";

private String email,pass,name;
 
   public String execute() {
  String ret = FAILURE;
  Connection conn = null;

  try {
     String URL = "jdbc:mysql://localhost:3306/studentdb";
     Class.forName("com.mysql.jdbc.Driver");
     conn = DriverManager.getConnection(URL, "root", "root");
     String sql = "select name from logincred where";
     sql+=" email = ? and pass = ?";
     PreparedStatement ps = conn.prepareStatement(sql);
     ps.setString(1, email);
     ps.setString(2, pass);
     ResultSet rs = ps.executeQuery();

     while (rs.next()) {
        name = rs.getString(1);
        ret = SUCCESS;
     }
  } catch (Exception e) {
     ret = FAILURE;
  } finally {
     if (conn != null) {
        try {
           conn.close();
        } catch (Exception e) {
        }
     }
  }
  return ret;
  }

   public String getEmail() {
    return email;
   }

   public String getName() {
    return name;
   }


    public void setEmail(String login) {
    login = email;
    }
    public void setName(String user){
    user = name;
    }
    public String getPass() {
    return pass;
    }


    public void setPass(String password) {
    password = pass;
    }


    }

struts.config.xml

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC
      "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
      "http://jakarta.apache.org/struts/dtds/struts-config_1_3.dtd">


 <struts-config>
 <form-beans>
    <form-bean name="LoginActionForm" type="com.myapp.struts.LoginActionForm"/>

 </form-beans>

 <global-exceptions>

 </global-exceptions>

 <global-forwards>
 <forward name="login" path="/Login.do"/>
 </global-forwards>

   <action-mappings>
   <action input="/login.jsp" name="LoginActionForm" path="/login" scope="request" 
   type="com.myapp.struts.LoginAction">
       <forward name="success" path="/success.jsp"/>
       <forward name="failure" path="/failure.jsp"/>
    </action>
   <action path="/Login" forward="/login.jsp"/>
   </action-mappings>
   <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

   <message-resources parameter="com/myapp/struts/ApplicationResource"/>    

   <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>

    <!-- ========================= Validator plugin ================================= -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property
        property="pathnames"
        value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>

    </struts-config>

更新执行方法签名如下,

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    String ret = FAILURE;
    Connection conn = null;

    try {
        String URL = "jdbc:mysql://localhost:3306/studentdb";
        Class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(URL, "root", "root");
        String sql = "select name from logincred where";
        sql += " email = ? and pass = ?";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.setString(1, email);
        ps.setString(2, pass);
        ResultSet rs = ps.executeQuery();

        while (rs.next()) {
            name = rs.getString(1);
            ret = SUCCESS;
        }
    } catch (Exception e) {
        ret = FAILURE;
    } finally {
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {
            }
        }
    }
    return mapping.findForward(ret);
}