Install and Configure Struts 2 (Struts Forum at JavaRanch)

  • Upload
    kenni18

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 Install and Configure Struts 2 (Struts Forum at JavaRanch)

    1/4

    5/19/13 Install and configure Struts 2 (Struts forum at JavaRanch)

    www.coderanch.com/t/420341/Struts/Install-configure-Struts

    posted 10/24/2008 2:46 AM

    posted 10/24/2008 3:03 AM

    A friendly

    place for

    programming

    greenhorns!

    Big Moose Saloon Search | Java FAQ | Recent Topics

    Register / Login

    JavaRanch Java Forums Frameworks Struts

    Author Install and configure Struts 2

    Preeti YarlaRanch Hand

    Joined: Sep 08,2007Posts: 69

    This is my first application with struts 2 and have no experience w ith struts 1.

    I have Tomcat and downloaded struts 2. And I have a small app. Under Tomcat

    'webapps ' I created a new folder for the application (struts01). struts01 folder

    has 'WEB-INF' with sub-folder 'classes'. The jsp's are directly under struts01.

    web.xml is in WEB-INF and s truts.xml is in WEB-INF/classes. I configured the

    actions and results in struts.xml and registered FilterDispatcher in web.xml. Next

    I start Tomcat and the browser and invoke an action

    "http://localhost/Struts01/some_action". But Tomcat says it cannot find the

    resource. (But I can directly access the jsp's from browser.)

    Looks like the requests are not going to the struts filterdispatcher. What shouldI do?

    Thanks!

    SCJP

    Tom RispoliRanch Hand

    Joined: Aug 29,2008

    The struts2 filter processes the urls w ith the suffix you specify for it in the

    web.xml file. I'm not sure if you can set it up to run for urls with no suffix.

    http://www.coderanch.com/forumshttp://www.coderanch.com/forums/c/14/http://www.coderanch.com/forums/f-58/Strutshttp://www.coderanch.com/forums/search/filters/58http://www.coderanch.com/how-to/java/Java-FAQhttp://www.coderanch.com/forums/recentTopics/listhttp://www.coderanch.com/forums/banner/redirect/523http://www.coderanch.com/forums/banner/redirect/523http://www.coderanch.com/forums/banner/redirect/523http://www.coderanch.com/forums/banner/redirect/523http://www.coderanch.com/how-to/java/TomcatFaqhttp://www.coderanch.com/forums/f-58/Strutshttp://www.coderanch.com/forums/f-58/Strutshttp://www.coderanch.com/forums/c/14/http://www.coderanch.com/forumshttp://www.javaranch.com/http://www.coderanch.com/forums/user/loginhttp://www.coderanch.com/forums/recentTopics/listhttp://www.coderanch.com/how-to/java/Java-FAQhttp://www.coderanch.com/forums/search/filters/58http://www.coderanch.com/forums/banner/redirect/523
  • 7/27/2019 Install and Configure Struts 2 (Struts Forum at JavaRanch)

    2/4

    5/19/13 Install and configure Struts 2 (Struts forum at JavaRanch)

    www.coderanch.com/t/420341/Struts/Install-configure-Struts

    posted 10/24/2008 9:29 AM

    Posts: 349

    The standard suffix for struts2 is .action. If your web.xml is set up to use .action

    then the url would be:

    http://localhost/Struts01/some_action.action

    Post to your web.xml if you want.

    Nishan PatelRanch Hand

    Joined: Sep 07,2008Posts: 676

    I like...

    Hi..

    Please Make sure you have include s ix jar for bas ic Struts 2.0 Application.

    1 ) struts2-core-2.1.2

    2 ) xwork-2.1.1

    3 ) freemarker-2.3.12

    4 ) ognl-2.6.11

    5 ) commons-collections-3.2

    6 ) commons-logging-1.1

    And also make sure your wex.xml file looks like

    Struts2CRUD

    struts2

    org.apache.struts2.dispatcher.FilterDispatcher

    struts2

    /*

    index.jsp

    404

    /pagenotfound.jsp

    java.lang.Exception

    http://docs.oracle.com/javase/7/docs/api/java/lang/Exception.htmlhttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsdhttp://www.coderanch.com/how-to/java/BumperStickershttp://localhost/Struts01/some_action.action
  • 7/27/2019 Install and Configure Struts 2 (Struts Forum at JavaRanch)

    3/4

    5/19/13 Install and configure Struts 2 (Struts forum at JavaRanch)

    www.coderanch.com/t/420341/Struts/Install-configure-Struts

    posted 10/27/2008 6:47 PM

    posted 10/28/2008 1:25 AM

    posted 11/3/2008 4:50 PM

    /error.jsp

    Thanks,

    Nishan Patel.

    Thanks, Nishan PatelSCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog

    Preeti YarlaRanch Hand

    Joined: Sep 08,2007Posts: 69

    Tom, I did use .action extens ion for the request like

    http://localhost/Struts01/some_action.action though I did not specify that in my

    question.

    Nishan, the 6 jar files are in the struts folder I downloaded and extracted.

    Where should I include them? And my web.xml is similar to the one you put. By

    including the filterdispatcher we tell the container where the starting point for

    the requests is. But how will the container know where to look for struts files?

    (the path where I extracted struts files? Should I include it in the class path.)

    Thanks!

    Preeti YarlaRanch Hand

    Joined: Sep 08,

    2007Posts: 69

    OK. It works. I included those files in lib folder of this particular application under

    tomcat. Thanks again guys!

    Vikalp KhareGreenhorn

    Joined: Jun 18,2008Posts: 3

    hi Preeti,

    I have same problem as earlier you have. I want to know what did you do for

    solving this problem. I had a war file for deploying into tomcat server but when I

    want to run that project the Server says "resource file not found".

    I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler,we would need to run our stuff on 16 servers instead of 3.

    subject: Install and configure Struts 2

    http://www.coderanch.com/forums/banner/redirect/521http://localhost/Struts01/some_action.actionhttp://nishanpatel.wordpress.com/http://www.linkedin.com/in/nishanpatel
  • 7/27/2019 Install and Configure Struts 2 (Struts Forum at JavaRanch)

    4/4

    5/19/13 Install and configure Struts 2 (Struts forum at JavaRanch)

    www.coderanch.com/t/420341/Struts/Install-configure-Struts

    Similar Threads

    WAR file

    urgent

    Error in Eclipse Struts 2 Project

    struts 2 in eclipse

    Confusion Regarding where to put jsp in Web-application.

    All times above are in your local time zone & format.The current ranch time (not your local time) is May 19, 2013 04:37:34 .

    Contact Us | Powered by JForum | Copyright 1998-2013 Paul Wheaton

    http://www.javaranch.com/paul-wheaton.jsphttp://www.jforum.net/http://www.coderanch.com/how-to/code/ContactUshttp://www.coderanch.com/t/293191/JSP/java/Confusion-put-jsp-Web-applicationhttp://www.coderanch.com/t/452672/Struts/struts-eclipsehttp://www.coderanch.com/t/483865/Struts/Error-Eclipse-Struts-Projecthttp://www.coderanch.com/t/67835/BEA-Weblogic/http://www.coderanch.com/t/171950/java-Web-Component-SCWCD/certification/WAR-file