kivil 2009-12-02 00:46
浏览 256
已采纳

struts2构建问题。

环境tomcat6.0
怎么构建一个helloworld web应用
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\index.jsp 跳转
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\helloworld.jsp 显示helloworld

D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\META-INF
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\WEB-INF\web.xml
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\WEB-INF\classes\helloworld.class
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\WEB-INF\classes\helloworld.xml
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\WEB-INF\classes\struts.xml
D:\apache-tomcat-6.0.18\webapps\struts2_helloworld\WEB-INF\lib\有5个struts核心jar包

这是我的所有的目录及文件,可是运行不了 !
注意:[color=red]不用IDE[/color],怎么构建一个HelloWorld应用?最好给出[color=red]详细步骤[/color],谢谢各位哥哥姐姐。
或者邮箱联系下。谢谢了!邮箱cssiege@126.com

[b]问题补充:[/b]
web.xml
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
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">

struts2
org.apache.struts2.dispatcher.FilterDispatcher


struts2
/*


index.html
index.htm
index.jsp


[/code]
struts.xml
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">



[/code]

helloworld.xml
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">




/helloworld.jsp



[/code]
[b]问题补充:[/b]
helloworld.xml本地写的没错,还是运行不了
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">




/helloworld.jsp


[/code]
[b]问题补充:[/b]
[color=red]再次补充[/color]
java类:HelloWorld.java 编译后class是 HelloWorld.class,可能上面大小写没有仔细写上,我本地,不存在大小写的问题,统一都是这个
[color=red]tomcat启动信息[/color]如下
2009-12-2 12:59:07 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performanc
e in production environments was not found on the java.library.path: C:\Program
Files\Java\jdk1.6.0_12\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WIND
OWS;C:\Program Files\Java\jdk1.6.0_12\bin;C:\oracle\ora92\bin;C:\Program Files\O
racle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:
\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Thunder Network\
KanKan\Codecs;D:\Program Files\MySQL\MySQL Server 5.0\bin
2009-12-2 12:59:07 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-9999
2009-12-2 12:59:07 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 466 ms
2009-12-2 12:59:07 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-12-2 12:59:07 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.18
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts-default.xml]
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts-plugin.xml]
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts.xml]
2009-12-2 12:59:08 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM l
ocale
2009-12-2 12:59:08 com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory nit>
信息: Setting DefaultObjectTypeDeterminer as default ...
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts-default.xml]
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts-plugin.xml]
2009-12-2 12:59:08 com.opensymphony.xwork2.config.providers.XmlConfigurationProv
ider register
信息: Parsing configuration file [struts.xml]
2009-12-2 12:59:08 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM l
ocale
2009-12-2 12:59:09 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2009-12-2 12:59:09 org.apache.catalina.core.StandardContext start
严重: Context [/struts2_helloworldtest] startup failed due to previous errors
2009-12-2 12:59:09 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-9999
2009-12-2 12:59:09 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2009-12-2 12:59:09 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/31 config=null
2009-12-2 12:59:09 org.apache.catalina.startup.Catalina start
信息: Server startup in 2451 ms

[color=brown]index.jsp也访问不了[/color]
[b]问题补充:[/b]
[color=red]首先,index.jsp访问不了[/color]
http://localhost:9999/struts2_helloworldtest/
http://localhost:9999/struts2_helloworld/index.jsp
都不行。真不知道怎么回事,愁死了。
index.jsp上的信息:

HTTP Status 404 -

type Status report
message

description The requested resource () is not available.

Apache Tomcat/6.0.18
[b]问题补充:[/b]
上面访问是这两个
http://localhost:9999/struts2_helloworld
http://localhost:9999/struts2_helloworld/index.jsp
[b]问题补充:[/b]
[color=red]jar包:[/color]这是struts-2.0.14-all.zip里面的5个我考到lib下的
struts2-core-2.0.14.jar
xwork-2.0.7.jar
ognl-2.6.11.jar
freemarker-2.3.8.jar
commons-logging-1.0.4.jar
[b]问题补充:[/b]
[color=red]哎,我这是没用IDE自己写的目录结构,可是运行不了,还有让我看tomcat日志,这个我也看了,可是对于我这样的初学者,也看不懂什么日志啊。现在我就是想运行就运行不了啊!(启动tomcat上面也贴出出错信息了,index.jsp打不开)最好有人能给我个详细步骤。[/color]

  • 写回答

9条回答 默认 最新

  • flybar0015 2009-12-02 17:54
    关注

    我自己写了一个struts2.1.8的DEMO

    已经发到你的邮箱里了。你可以去看看,如果有问题

    可以给我发邮件

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(8条)

报告相同问题?

悬赏问题

  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3