解决方案 »
- 为什么Java的date 插入MySQL会报这样的错?
- 关于JSP调用存储过程的问题!~在线等!!!急
- dwr.engine为空或不是对象
- 请问使用Struts框架开发安全性要求高的项目需要注意什么?
- 本人要用struts写个新闻管理系统,请各位推荐一下那里有源码?
- 新人求助:关于servlet
- 请问杭州的同行
- 如何在JSP页面中显示框架
- tomcat连接池
- 请指教!!!用Io流读取PDF文件后,页面无显示
- java实现邮箱激活验证问题
- sping Ibatis 出现Invalid property 'sqlMapClient' of bean class [com.yh.dao.UserDao
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;public class LoginAction extends ActionSupport
{
private String username;
private String password;
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String execute() throws Exception
{
if (getUsername().equals("crazyit.org")
&& getPassword().equals("leegang") )
{
ActionContext.getContext().getSession()
.put("user" , getUsername());
return SUCCESS;
}
else
{
return ERROR;
}
}
}
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- struts2核心过滤器配置结束 -->
检查下你的JSP页面,//在struts页面上是需要带入.action的,配置文件不要,还有你的名称空间加上
还有就是你的<s:form action="login.action" namescapace="/" >