反编译文件重新编译出错!
-----------以下是反编译的内容-------------
//LoginForm文件再次编译通过!
package mypack;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
public class LoginForm extends ActionForm
{
public LoginForm()
{
password = null;
username = null;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public void reset(ActionMapping mapping, HttpServletRequest request)
{
password = null;
username = null;
}
public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1)
{
ActionErrors errors = new ActionErrors();
if(username == null || username.equals( " "))
errors.add( "username ", new ActionError( "error.username "));
return errors;
}
private String password;
private String username;
}
//LoginAction文件编译时出错,错误提示:找不到符号(LoginForm)
package mypack;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
// Referenced classes of package mypack:
// LoginForm
public class LoginAction extends Action
{
public LoginAction()
{
}
protected String checkUser(String username, String password)
{
String user = null;
if(username.equals( "swq ") && password.equals( "1234 "))
user = new String( "Sun weiqin ");
return user;
}
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String user = null;
String target = new String( "success ");
String username = ((LoginForm)form).getUsername();
String password = ((LoginForm)form).getPassword();
user = checkUser(username, password);
if(user == null)
{
((LoginForm)form).setUsername( "username ");
((LoginForm)form).setPassword( "password ");
target = new String( "failure ");
} else
{
request.setAttribute( "USER ", user);
}
return mapping.findForward(target);
}
}
麻烦大家帮忙找找原因!
[解决办法]
直接运行
java -d . LoginAction.java
就可以了
估计你是你没有生成包结构
[解决办法]
唉,找啥原因啊?
找不到你就给它呗,你不给它,它怎么找得到?