小弟刚学Struts2,在用Eclipse配置Struts时出现的问题可谓是层出不穷啊, 所以想请知道怎么配的大虾给俺讲讲,谢过了....

解决方案 »

  1.   

    第一,把所需要的jar包复制到lib目录中去。
    第二,在web.xml文件中加入以下内容,一般是不会变的:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">    <display-name>Struts Blank</display-name>    <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        </filter>    <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>    <welcome-file-list>
            <welcome-file>index.html</welcome-file>
        </welcome-file-list></web-app>
    第三是:在src目录中建立struts.xml文件,内容可以去参考struts2给的实例。
    接下来就是写你的action了,新手的话就多看看帮助文档,有很多好处的,弄懂了就好了,很好学的,努力吧。