struts2真的配好了么,和1的配置不一样的啊

解决方案 »

  1.   


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="main" extends="struts-default" >
    <action name="login" class="controller.Login" >
    <result name="success">/index.jsp</result>
    <result name="input">/Login.jsp</result>
    </action>


    </package>
    </struts>    
    这是struts.xml
      

  2.   


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="main" extends="struts-default" >
    <action name="login" class="controller.Login" >
    <result name="success">/index.jsp</result>
    <result name="input">/Login.jsp</result>
    </action>


    </package>
    </struts>    
    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
      

  3.   


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="main" extends="struts-default" >
    <action name="login" class="controller.Login" >
    <result name="success">/index.jsp</result>
    <result name="input">/Login.jsp</result>
    </action>


    </package>
    </struts>    
    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
      

  4.   


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="main" extends="struts-default" >
    <action name="login" class="controller.Login" >
    <result name="success">/index.jsp</result>
    <result name="input">/Login.jsp</result>
    </action>


    </package>
    </struts>    
    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
      

  5.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html
      

  6.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧
      

  7.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
      

  8.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
    你为什么不通过action去访问呢?
      

  9.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
    你为什么不通过action去访问呢?
    因为 要先提交信息啊而且报错 
    加上过滤器的那几行代码后 jsp都打不开了。。
      

  10.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
    你为什么不通过action去访问呢?
    因为 要先提交信息啊而且报错 
    加上过滤器的那几行代码后 jsp都打不开了。。
    你项目部署成功没,tomcat有没有报错,还是有你的项目名称是Website吗?
      

  11.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
    你为什么不通过action去访问呢?
    因为 要先提交信息啊而且报错 
    加上过滤器的那几行代码后 jsp都打不开了。。
    你项目部署成功没,tomcat有没有报错,还是有你的项目名称是Website吗?
    项目部署成功了啊,项目名称也是对的啊。。网页本来可以有显示的,这说明是部署成功的啊。。就是加了几行代码就报错了不晓得为什么呜呜呜。
      

  12.   

    应该是包倒错了,配置2.3struts2,导入jar包
     
    配置struts出现404错误,可能是jar包问题,可能是版本问题,也可能是路径问题,需要多次测试
      

  13.   

    已经导入Mycelipse的struts2.1 了,仍然需要2.3的这些包吗?是要单独倒到bin里的么?
      

  14.   

    已经导入Mycelipse的struts2.1 了,仍然需要2.3的这些包吗?是要单独倒到bin里的么?噗。。是lib哈。。
      

  15.   

    已经导入Mycelipse的struts2.1 了,仍然需要2.3的这些包吗?是要单独倒到bin里的么?噗。。是lib哈。。
    他这次不是404 了,还是页面一片空白。。就是简单的显示jsp文件,没有加action.....
      

  16.   

    已经导入Mycelipse的struts2.1 了,仍然需要2.3的这些包吗?是要单独倒到bin里的么?
    可能是jar问题,你把jar包删除掉,重新导入试下。
    另外,最好不要用自带的jar包吧。
      

  17.   

    你在Myeclipse是添加的struts支持,还是手动配置的?应该会不一样,你添加的的2.1版本,加入jar包时用2.3的肯定不行
      

  18.   

    2.1是Myeclipse自己的,2.3是手动配置的。。“你添加的的2.1版本,加入jar包时用2.3的肯定不行”这句话什么意思?
     你看一个图,黑色框里的是自己添加的,红色那个是导入Myeclipse 的
      

  19.   

    六月 03, 2014 2:53:35 下午 org.apache.catalina.core.StandardContext filterStart
    严重: Exception starting filter struts2
    Unable to load configuration. - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:428)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)



    Caused by: Unable to load configuration. - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
    ... 19 more
    Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    ... 21 more
    Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:30:124 - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
    ... 24 more
    六月 03, 2014 2:53:35 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Error filterStart
    六月 03, 2014 2:53:35 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [/Website] startup failed due to previous errors
    六月 03, 2014 2:53:35 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["http-bio-8080"]
    六月 03, 2014 2:53:35 下午 org.apache.coyote.AbstractProtocol start
    信息: Starting ProtocolHandler ["ajp-bio-8009"]
    六月 03, 2014 2:53:35 下午 org.apache.catalina.startup.Catalina start
    信息: Server startup in 2705 ms
    六月 03, 2014 2:53:45 下午 org.apache.catalina.startup.HostConfig checkResources
    信息: Reloading context [/Website]
    六月 03, 2014 2:53:46 下午 org.apache.catalina.startup.TaglibUriRule body
    信息: TLD skipped. URI: /struts-tags is already defined
    六月 03, 2014 2:53:46 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
    信息: Parsing configuration file [struts-default.xml]
    六月 03, 2014 2:53:47 下午 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
    严重: Dispatcher initialization failed
    Unable to load configuration. - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72

    。Caused by: Unable to load configuration. - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
    at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
    ... 19 more
    Caused by: Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)
    at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
    at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
    at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
    ... 21 more
    Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name struts has already been loaded by bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:30:124 - bean - jar:file:/E:/JSP/.metadata/.me_tcat7/webapps/Website/WEB-INF/lib/struts2-core-2.3.16.3.jar!/struts-default.xml:40:72
    at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
    ... 24 more
    六月 03, 2014 2:53:47 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Error filterStart
    六月 03, 2014 2:53:47 下午 org.apache.catalina.core.StandardContext startInternal
    严重: Context [/Website] startup failed due to previous errors
    这一大堆的错误。。
      

  20.   

    应该是导包的问题吧,你去官网下载struts2的开发包,里面包含有个apps的文件夹,放的是几个简单的例子。基本的jar,配置都可以参考里面的 。
      

  21.   

    导入这些后直接 报错。。degug 
    这个错是为什么啊
      

  22.   

    在Myeclipse中添加struts支持,不用手动添加jar包
      

  23.   

    在Myeclipse中添加struts支持,不用手动添加jar包怎么添加支持?
      

  24.   

    你先到tomcat下看看有没有冲突的包吧,比如你的struts2.1与2.3
      

  25.   


    选中项目-----右击选择Myeclipse
      

  26.   

    你的Myeclipse是什么版本的,我这是8.6的,可能配置不一样,不能添加struts支持,就手动添加呗,jar包就是我先前给的那几个,配置struts.xml文件正确,应该没问题
      

  27.   


    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
    <struts>
    <package name="main" extends="struts-default" >
    <action name="login" class="controller.Login" >
    <result name="success">/index.jsp</result>
    <result name="input">/Login.jsp</result>
    </action>


    </package>
    </struts>    
    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    result是执行aciton返回结果执行页面跳转,是请求路径吧
      

  28.   

    这是struts.xml
    404就是请求路径错了,你请求的URL是什么
    路径不是和action返回的字符串然后在result里匹配么?action里和result里是对应的。。
    现在是我加上过滤器就一片空白了不加过滤器action 肯定不会显示的吧。。
    你在浏览器地址栏中输入的是什么
    localhost:8080/Website/index.html不明白你想请求什么?项目中有index.html吗?
    应该是localhost:8080/Website/login.action吧粘错了。嗯嗯那个是写错的超链接。
    http://localhost:8080/Website/Login.jsp 就会显示上面图片那个错误。
    你为什么不通过action去访问呢?
    因为 要先提交信息啊而且报错 
    加上过滤器的那几行代码后 jsp都打不开了。。
    <action name="login" class="....." method="方法(比如login)">
    没有指定方法 你的要执行的代码只能写在execute()方法有效
      

  29.   

    谢谢大家啦!struts.xml  刚开始可能没有写对,还有一些错误的工程没有删除导致的,还有一些css文件myeclipse 好像不能识别也报错很多错跑到一起就有点头疼了不过还好,已经解决啦~