编译的问题 也就是struts in action第一章的那个例子,编译不过,郁闷啊!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package app;import org.apache.struts.action.*;public class RegisterForm extends ActionForm { protected String username; protected String password1; protected String password2; public String getUsername () {return this.username;}; public String getPassword1() {return this.password1;}; public String getPassword2() {return this.password2;}; public void setUsername (String username) {this.username = username;}; public void setPassword1(String password) {this.password1 = password;}; public void setPassword2(String password) {this.password2 = password;};}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"); }}上面的是RegisterForm.java下面的是RegisterAction.java,都在app目录下,RegisterForm.java编译通过,而RegisterAction.java编译不通过烦恼 可能是一些目录设置的问题还有就是你的classpath的设置问题!直接这样试一试: javac RegisterForm.java RegisterAction.java 来实现同时编译处理! classpath的问题哪,没加那个 .; 我也碰到过类似的问题,在classPath里加“.”就行了,这样java编译器就会在本目录中找他需要的类 关于读取Excle的一些小问题 程序中有一条语句,想让它5秒钟之后,执行不知道是否可以。。 初级问题...求助 致在校大学生--来到了华为之后的一点感触 请大家看看我关于压缩ZIP的CODE,现在总是有Exception抛出 jbuilder2007中怎样打开UI界面,有么? applet动行后的问题,急~~~~~~~~~~~~ 实现java服务器下的程序给mfc的客服端发送excel文件 java中abstract class 与 class有何区别? 编写的脚本放到哪个盘里最好呢? 哪里有jsp基础知识的电子书下载 求一段java程序(一个随机字符串),一天内结帖
import org.apache.struts.action.*;
public class RegisterForm extends ActionForm {
protected String username;
protected String password1;
protected String password2;
public String getUsername () {return this.username;};
public String getPassword1() {return this.password1;};
public String getPassword2() {return this.password2;};
public void setUsername (String username) {this.username = username;};
public void setPassword1(String password) {this.password1 = password;};
public void setPassword2(String password) {this.password2 = password;};
}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");
}
}上面的是RegisterForm.java下面的是RegisterAction.java,都在app目录下,RegisterForm.java编译通过,而RegisterAction.java编译不通过
烦恼
javac RegisterForm.java RegisterAction.java 来实现同时编译处理!