请教一个struts初级问题

blue_xjf 03-04-07

请教各位高手:

我写了一个struts应用程式:sampleForm.java、SampleAction.java,但在编绎时无法通过,具体我的环境是:
f:\xjf\WEB-INF\sample下存放sampleForm.java、SampleAction.java原代码
f:\xjf\WEB-INF\lib下存放了 struts的tld、struts.jar、servlet.jar

编绎时用的命令为:
F:\xjf\WEB-INF\sample>javac -classpath f:\xjf\WEB-INF\lib\servlet.jar;f:\xjf\WEB
-INF\lib\struts.jar SampleForm.java

出现的错误好象是不能找到相关struts.jar中的类

我的sampleForm.java为:
package sample;

  import org.apache.struts.action.ActionForm;

  public class SampleForm extends ActionForm
  {
  protected String theName;
  protected String thePassword;
  public SampleForm()
  {
  }
  public String getTheName()
  {
  return theName;
  }
  public void setTheName(String theName)
  {
  this.theName = theName;
  }
  public String getThePassword()
  {
  return thePassword;
  }
  public void setThePassword(String thePassword)
  {
  this.thePassword = thePassword;
  }
  }

我的SampleAction源代码为:
package sample;
  import javax.servlet.ServletRequest;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  import org.apache.struts.action.*;
  // Referenced classes of package com.ilovejsp.action.form:
  // SampleForm
  public class SampleAction extends Action
  {
  public SampleAction()
  {
  }
  public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
  {
  if(form instanceof SampleForm)
  {
  SampleForm theForm = (SampleForm)form;
  String user = theForm.getTheName();
  String password = theForm.getThePassword();
  request.setAttribute("user", user);
  request.setAttribute("password", password);
  return mapping.findForward("play");
  }
  else
  {
  return null;
  }
  }
  }

hzlinux
2003-04-18 12:37

学习使用 ant
http://ant.apache.org