<form-beans>
<form-bean name="LoginActionForm"
type="com.junhe.operate.loginOpe.LoginActionForm"/>
</form-beans>
<action-mappings>
<action path="/LoginAction"
type="com.junhe.operate.loginOpe.LoginAction">
<forward name="success" path="/jsp/login/test.jsp" />
</action>
<action input = "/login.jsp"
path="/LoginAction"
type="com.junhe.operate.loginOpe.LoginAction"
name="LoginActionForm"
parameter="methode"
scope="request"
validate="false">
<forward name="success" path="/jsp/login/test.jsp" />
</action>
</action-mappings>
action 这样配置应该没问题吧
在线等
<form-bean name="LoginActionForm"
type="com.junhe.operate.loginOpe.LoginActionForm"/>
</form-beans>
<action-mappings>
<action path="/LoginAction"
type="com.junhe.operate.loginOpe.LoginAction">
<forward name="success" path="/jsp/login/test.jsp" />
</action>
<action input = "/login.jsp"
path="/LoginAction"
type="com.junhe.operate.loginOpe.LoginAction"
name="LoginActionForm"
parameter="methode"
scope="request"
validate="false">
<forward name="success" path="/jsp/login/test.jsp" />
</action>
</action-mappings>
action 这样配置应该没问题吧
在线等
action path="/jsp/login/LoginAction"
exception javax.servlet.ServletException: Servlet execution threw an exception
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122)root cause java.lang.NoSuchMethodError: com.junhe.operate.loginOpe.LoginAction.getDataSource(Ljavax/servlet/http/HttpServletRequest;Ljava/lang/String;)Ljavax/sql/DataSource;
com.junhe.operate.loginOpe.LoginAction.execute(LoginAction.java:19)
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:53)
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:64)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:48)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:280)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1858)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:459)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122)
import java.util.*;
import javax.servlet.http.*;import org.apache.struts.*;
import org.apache.struts.action.*;public class LoginAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LoginActionForm loginActionform = (LoginActionForm)form;
LoginUser loginUser = new LoginUser();
loginUser.setUserName(loginActionform.getUserName());
loginUser.setUserPassword(loginActionform.getUserPassword()); try{
LoginLogic loginLogic =new LoginLogic(getDataSource(request,"ChargeCard"));
if(!loginLogic.login(loginUser)){
// 出错信息
//创建Actionerrors实例和ActionError实例
ActionErrors actionErrors = new ActionErrors();
ActionError actionError = new ActionError("登录出现错误!");
actionErrors.add("登录错误·!",actionError);
saveErrors(request,actionErrors);
return mapping.findForward("success");
}
return mapping.findForward("success");
}catch (Exception ex ){
ex.printStackTrace();
return null;
}
}
}