里面的beanForm不是
应该是:
package mvc.form;import org.apache.struts.action.*;
import javax.servlet.http.*;public class loginForm extends ActionForm {
private String name;
private String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
/**@todo: finish this method, this is just the skeleton.*/
ActionErrors errors=new ActionErrors();
if((name==null)||(name.length()<1)){
errors.add("name",new ActionError("login.form.name.error"));
}
if((password==null)||(password.length()<1)){
errors.add("password",new ActionError("login.form.password.error"));
}
return errors;
}
public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
name=null;
password=null;
}
}
应该是:
package mvc.form;import org.apache.struts.action.*;
import javax.servlet.http.*;public class loginForm extends ActionForm {
private String name;
private String password;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public ActionErrors validate(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
/**@todo: finish this method, this is just the skeleton.*/
ActionErrors errors=new ActionErrors();
if((name==null)||(name.length()<1)){
errors.add("name",new ActionError("login.form.name.error"));
}
if((password==null)||(password.length()<1)){
errors.add("password",new ActionError("login.form.password.error"));
}
return errors;
}
public void reset(ActionMapping actionMapping, HttpServletRequest httpServletRequest) {
name=null;
password=null;
}
}
解决方案 »
- jsp中action怎么提交到Servlet
- netbeans + JBoss 开发 java ee!自动部署的问题!
- ejb高手进
- Hibernate级联保存,多方外键不能自动保存
- Axis1.2 还是Nullpointer的问题
- 能在EL表达式里写将一个集合转换成类对象的代码吗?请高手指教
- 急!Constants.DATASOURCE_KEY这个常量属于那个类
- 谁能给我个登陆页代码...
- tomcat5的连接池问题
- 楼下那位“ apan_bj ”大哥把你的实战EJB2。0(中文)也给我发一份吧
- 一个问题:关于struts 和datasource的
- 如何在JBuilder X中创建Struts应用?
Struts论坛:http://www.javawebstudio.com/