基于ssh2的权限登陆,纠结了差不多一个星期了!求解答吖! http://dl.dbank.com/c0tdacscjg上面是我的源码,求解答,呜呜 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package cn.tmen.action;import com.opensymphony.xwork2.Action;import com.opensymphony.xwork2.ActionContext;import cn.tmen.action.base.UserBaseAction;import cn.tmen.domain.Administrator;import cn.tmen.domain.Student;import cn.tmen.domain.Teacher;import cn.tmen.service.*;public class LoginAction extends UserBaseAction { //定义一个常量作为学生登录成功的Result名 private final String STU_RESULT = "stu"; //定义一个常量作为教师登录成功的Result名 private final String TEA_RESULT = "tea"; //定义一个常量作为管理员登录成功的Result名 private final String ADMIN_RESULT = "admin"; private Student stu; private Teacher tea; private Administrator admin; //处理登录后的提示信息 private String tip; public Student getStu() { return stu; } public void setStu(Student stu) { this.stu = stu; } public Teacher getTea() { return tea; } public void setTea(Teacher tea) { this.tea = tea; } public Administrator getAdmin() { return admin; } public void setAdmin(Administrator admin) { this.admin = admin; } public String getTip() { return tip; } public void setTip(String tip) { this.tip = tip; } public String execute() throws Exception { ActionContext ctx = ActionContext.getContext(); String name = (String) ctx.getSession().get("name"); String pass = (String) ctx.getSession().get("pass"); int result = user.validLogin(name, pass); if(result==1){ setTip("您已经成功登录系统"); return STU_RESULT; } else if(result == 2){ setTip("您已经成功登录系统"); return TEA_RESULT; } else if(result == 3){ setTip("您已经成功登录系统"); return ADMIN_RESULT; } else { setTip("用户名与密码不匹配"); return ERROR; } }} <?xml version="1.0" encoding="GBK"?><!-- 指定Struts2配置文件的DTD信息 --><!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN" "http://struts.apache.org/dtds/struts-2.1.7.dtd"><!-- Struts2配置文件的根元素 --><struts> <!-- 配置了系列常量 --> <constant name="struts.custom.i18n.resources" value="resource"/> <constant name="struts.i18n.encoding" value="GBK"/> <constant name="struts.devMode" value="true"/> <package name="default" extends="struts-default"> <!-- 定义全局Result映射 --> <global-results> <!-- 定义sql、root两个异常对应的视图页 --> <result name="business">/WEB-INF/content/error.jsp</result> <result name="root">/WEB-INF/content/error.jsp</result> <!-- 定义login逻辑视图对应的视图资源 --> <!--<result name="login">/WEB-INF/content/login.jsp</result>--> </global-results> <!-- 定义处理登录系统的Action --> <action name="processLogin" class="cn.tmen.action.LoginAction"> <result name="input">/content/login.jsp</result> <result name="stu">/content/student/index.jsp</result> <result name="tea">/content/teacher/index.jsp</result> <result name="admin">/content/administrator/index.jsp</result> <result name="error">/content/login.jsp</result> </action> </package> </struts> struts2的404,第一个是有没有把路径配好,第二就是tomcat启动时有没有报错,再不行,看你的web.xml有没有加struts2的filter WebService的一个问题 如何用Java程序向DLL程序发出通信消息呢? 关于向数据库加入数据的问题。 怎么在tomcat下使用log4j AXIS做web service,出现错误~ 100分 求解 关于struts-config.xml 请高手来讲解! struts初学,关于配置,请大侠们指点迷津,struts能成功运行到底靠什么 有无把xml转化为excel文档的java的api,或其它实现方法? 每次启动tomcat都打开class.class文件,且tomcat没有启动成功 jsp的监听 ServletActionContext 和 getServletContext 报错
package cn.tmen.action;import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;import cn.tmen.action.base.UserBaseAction;
import cn.tmen.domain.Administrator;
import cn.tmen.domain.Student;
import cn.tmen.domain.Teacher;
import cn.tmen.service.*;public class LoginAction extends UserBaseAction {
//定义一个常量作为学生登录成功的Result名
private final String STU_RESULT = "stu";
//定义一个常量作为教师登录成功的Result名
private final String TEA_RESULT = "tea";
//定义一个常量作为管理员登录成功的Result名
private final String ADMIN_RESULT = "admin";
private Student stu;
private Teacher tea;
private Administrator admin;
//处理登录后的提示信息
private String tip;
public Student getStu() {
return stu;
} public void setStu(Student stu) {
this.stu = stu;
} public Teacher getTea() {
return tea;
} public void setTea(Teacher tea) {
this.tea = tea;
} public Administrator getAdmin() {
return admin;
} public void setAdmin(Administrator admin) {
this.admin = admin;
} public String getTip() {
return tip;
} public void setTip(String tip) {
this.tip = tip;
} public String execute() throws Exception {
ActionContext ctx = ActionContext.getContext();
String name = (String) ctx.getSession().get("name");
String pass = (String) ctx.getSession().get("pass");
int result = user.validLogin(name, pass);
if(result==1){
setTip("您已经成功登录系统");
return STU_RESULT;
}
else if(result == 2){
setTip("您已经成功登录系统");
return TEA_RESULT;
}
else if(result == 3){
setTip("您已经成功登录系统");
return ADMIN_RESULT;
}
else {
setTip("用户名与密码不匹配");
return ERROR;
} }}
<?xml version="1.0" encoding="GBK"?>
<!-- 指定Struts2配置文件的DTD信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
"http://struts.apache.org/dtds/struts-2.1.7.dtd">
<!-- Struts2配置文件的根元素 -->
<struts>
<!-- 配置了系列常量 -->
<constant name="struts.custom.i18n.resources" value="resource"/>
<constant name="struts.i18n.encoding" value="GBK"/>
<constant name="struts.devMode" value="true"/>
<package name="default" extends="struts-default">
<!-- 定义全局Result映射 -->
<global-results>
<!-- 定义sql、root两个异常对应的视图页 -->
<result name="business">/WEB-INF/content/error.jsp</result>
<result name="root">/WEB-INF/content/error.jsp</result>
<!-- 定义login逻辑视图对应的视图资源 -->
<!--<result name="login">/WEB-INF/content/login.jsp</result>-->
</global-results>
<!-- 定义处理登录系统的Action -->
<action name="processLogin"
class="cn.tmen.action.LoginAction">
<result name="input">/content/login.jsp</result>
<result name="stu">/content/student/index.jsp</result>
<result name="tea">/content/teacher/index.jsp</result>
<result name="admin">/content/administrator/index.jsp</result>
<result name="error">/content/login.jsp</result>
</action>
</package>
</struts>