刚开始学习struts,知道例子对学习的重要性,所以想先把struts环境架起来,可是看了好多文章没弄成功,请高手答复一下配置struts环境必须的有哪些,以及软件的下在地址,小弟分不多,配成马上结帐。。 

解决方案 »

  1.   

    <?xml version="1.0" encoding="UTF-8" ?> 
      <!DOCTYPE struts-config (View Source for full doctype...)> 
    - <struts-config>
      <data-sources /> - <form-beans>
    //注意  从这开始配置你的Form 
    //name="loginForm" name这个参数呢,是你给这个Form起的名字,就像你生下来你父母给你起的 名字一样,以后用这个名字,就知道是指谁了
     //type="com.langsin.struts.form.LoginForm" type指这个class的相对地址了 
      <form-bean name="loginForm"  type="com.langsin.struts.form.LoginForm" /> 
      </form-beans>
      <global-exceptions /> 
      <global-forwards /> 
    - <action-mappings>
    //这呢,是将你的Form和 Action连接起来
    //input="/login.jsp" 是指你进来的 那个页面,当验证失败后还回到那个页面
    // name="loginForm" 这个很熟悉把,就是刚才起名字的那个,
    //path="/login" 这个很重要,是你jsp页面提交响应的路径或是标识
    //scope="request"  这个该知道把,就是响应的范围,跟jsp里面一样,只不过这里只有俩现则,request,session 至于俩者区别看书呀 !
    //type 跟上面一样
      <action attribute="loginForm" input="/login.jsp" name="loginForm" path="/login" scope="request" type="com.langsin.struts.action.LoginAction" /> 
      </action-mappings>
      <message-resources parameter="com.langsin.struts.ApplicationResources" /> 
      </struts-config>
    哦,这个文件的名字你知道把,,
    struts-config.xml
      

  2.   

    jsp页面
    代码要注意的 地方,,
    <html> 
    <head>
    <title>JSP for LoginForm form</title>
    </head>
    <body>
    //下面一行注意,,
    //action="/login"
    // /login 这个地方很注意,,这跟你 path="/login"的 地方要一致 
    <html:form action="/login">
    userName : <html:text property="userName"/><html:errors property="userName"/><br/>
    userPwd : <html:text property="userPwd"/><html:errors property="userPwd"/><br/>
    <html:submit/><html:cancel/>
    </html:form>
    </body>
    </html>
      

  3.   

    sky_ccy 你好,您上面所说的配置文件里面的内容我是懂的,我的web.xml和struts-config.xml也配置好了,现在我的问题是
    1、将Struts目录的lib/struts.jar拷贝到web应用的WEB-INF/lib目录。 
    2、将Struts目录的lib/struts*.tld拷贝到web应用的WEB-INF目录。 
    3、在编译我们的web应用的java程序时,要在CLASSPATH中包含struts.jar文件。 
    除了以上三步以外,还有什么要做的吗,我的web.xml和strut-config.xml都已经配置好了;还有就是上面的第3步struts.jar文件应该怎样加入到CLASSPATH中,是把struts.jar在web应用的WEB-INF/lib目录中的位置加进CLASSPATH中呢,还是怎样加?是直接加到CLASSPATH的最后面呢,还是加到中间的某个地方? 之所以会问这个问题,是因为我之前可以运行的一个Struts应用现在不能运行了,所以我想检查一下我的配置哪里出了错误,请高手们不要不屑于这种问题,因为它困扰了我几天时间,急死我了!!!
    还有就是夏晰的视频是叫什么名字的来着,可否有下载地址,或者下载地址也可以发到我邮箱([email protected]
      

  4.   

    你还是用 myeclipse 它搞这个很好的 
      

  5.   

    为Struts 2.0做好准备 
    http://www.blogjava.net/max/category/16130.html
    去这个网站看看,写的很不错的,所有的基础的都有的。搭建的环境都有截图的。