当前页面: 开发资料首页 → Eclipse 专题 → org.apache.struts.action does not exit,是为什么呀,应该处理
org.apache.struts.action does not exit,是为什么呀,应该处理
摘要: org.apache.struts.action does not exit,是为什么呀,应该处理
package app;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import java.io.*;
public class RegisterAction extends Action {
public ActionForward perform (ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res) {
// ①Cast the form to the RegisterForm
RegisterForm rf = (RegisterForm) form;
String username = rf.getUsername();
String password1 = rf.getPassword1();
String password2 = rf.getPassword2();
// ②Apply business logic
if (password1.equals(password2)) {
try {
// ③Return ActionForward for success
UserDirectory.getInstance().setUser(username,password1);
return mapping.findForward("success");
} catch (UserDirectoryException e) {
return mapping.findForward("failure");
}
}
// ④Return ActionForward for failure
return mapping.findForward("failure");
}
}
struts lib下的全部文件复制到web-inf/lib下了啊
struts-cfg.xml里配置什么样的信息呢
下的是struts-1.2.9-bin
eclipse下,tomcat插件有了,开发struts还要其他插件吗
现在是copy的代码, eclipse除了建tomcat项目外,其他什么都没用上呢
UserDirectory.getInstance().setUser(username,password1);
不知道你怎么配置的,本来很简单的问题搞到复杂化了,加个struts框架,struts-config配置就能手工配置了,何必麻烦...看下你的struts-config文件哦
查资料说添加框架为
eclipse File->new->others,打开新建向导对话框,找到Amateras->Struts->Add Struts Support,选中点击next按钮
现在eclipse里找不到amateras
汉化的菜单下有 简单->文件,文件夹,项目,但没有struts
现在eclipse的plugin下有com.cross.easystruts.eclipse_0.6.4插件,并且我把Eclipse安装目录删除eclipse/configuration/org.eclipse.update,重新启动还是找不到
struts-config文件
<?xml version="1.0" encoding="ISO-8859-1" ?> struts-config PUBLIC"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN""http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<form-beans>
<form-bean name="registerForm" type="app.RegisterForm"/>
</form-beans>
CLASSPATH的值为
.;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar;%TOMCAT_HOME%/common/lib/servlet-api.jar