开发者

Not able to configure Struts in my system

I have installed Eclipse Heloios3.6 and Tomcat 6.0 and jdk开发者_如何学JAVA 1.6.

Can you give the library files for struts and configuration file for struts namely struts-config.xml and web.xml?

While I tried to run struts, it shows the requested resource is not available error.


Assuming you mean Struts 2, did you have a look here: http://struts.apache.org/2.x/docs/home.html?

The core part of web.xml is this:

<filter>
 <filter-name>struts2</filter-name>
 <filter-class>
  org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
 </filter-class>

 <init-param>
  <param-name></param-name>
  <param-value></param-value>
 </init-param>
</filter>

<filter-mapping>
 <filter-name>struts2</filter-name>
 <url-pattern>/*</url-pattern>
 <dispatcher>REQUEST</dispatcher>
 <dispatcher>FORWARD</dispatcher>
</filter-mapping>

Then there's a struts.xml in your classpath, not a struts-config.xml (although you might be able to configure the lookup).


download sample applications from there official download page and run in your tomcat

It will not only give you a running example but also will help you to understand how they have packed there application what resources is going at what places,what are the required dependencies and what other configurations one need to run an application

Struts2 Sample Application Download

Download sample applications from here and you will get struts2-blank-x.x.x war file which is a standard struts2 structure with running hello world application


The jar files you need, to start with:

  • commons-logging-1.0.4.jar
  • freemarker-2.3.8.jar
  • ognl-2.6.11.jar
  • struts2-core-2.0.12.jar
  • xwork-2.0.6.jar

Your struts.xml will have this struture:

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <constant name="struts.custom.i18n.resources" value="ApplicationResources" />

    <package name="project"  extends="struts-default">
            <action name="Download" class="project.action.DownloadAction">
            <result name="success">/jsp/common/downloadPage.jsp</result>
        </action>     
    </package>

    <include file = "Admin-Config.xml"/>
</struts>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜