1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tomcat with struts

Discussion in 'General Discussion' started by kipper3d, Dec 6, 2002.

  1. kipper3d

    kipper3d Member

    Joined:
    Jul 14, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    Im checking to see if any of you guys who successfully got tomcat working were able to use the struts framework.

    Thanks in advance!

    -John
     
  2. dgbaker

    dgbaker Moderator

    Joined:
    Sep 20, 2002
    Messages:
    2,776
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    You would have a very hard time I would think, because the Tomcat 4.0 web connector is still under development for struts.
     
  3. kipper3d

    kipper3d Member

    Joined:
    Jul 14, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    Can you explain to me what is required to get struts to work?
    Im not a jsp developer, but ive worked with tomcat on server in the past so.. if you can guide me in the right direction id appreciate it!

    -John
     
  4. dgbaker

    dgbaker Moderator

    Joined:
    Sep 20, 2002
    Messages:
    2,776
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    Since I haven't got it working with 4.0.3 either, the best suggestion would be to look at sites like http://www.jguru.com/forums/Struts & http://jakarta.apache.org/struts/

    They say it will work with 4.0 (not sure on 4.0.3) using the src of struts but I keep running in to compile issues with struts GenericConnection.java

    So if you find out let us all know. :)
     
  5. kipper3d

    kipper3d Member

    Joined:
    Jul 14, 2002
    Messages:
    52
    Likes Received:
    0
    Trophy Points:
    6
    My customer's comments:

    You don't have to have struts installed as a globally available framework. Struts is nothing but a set of classes, which can be very well something I developed with my classes. So, everything can be bundled together under one webapp. There is no need for a webconnector specially designed for struts. Struts does not use any proprietery technology. As long as we can call up servlets (not just jsp pages), we should be fine.

    Does this shed some light on the subject?

    -John
     
  6. dgbaker

    dgbaker Moderator

    Joined:
    Sep 20, 2002
    Messages:
    2,776
    Likes Received:
    5
    Trophy Points:
    38
    Location:
    Toronto, Ontario Canada
    Not really cause with 4.0.3 when you try to deploy the war files it does unpack them BUT, the tomcat-apache.conf file that is suppossed to be created does not get created and hence you cannot make the necessay changes to apache (required). Here is all of the install info for struts from their install doc.

    TOMCAT 3.1 (OR LATER) WITH APACHE
    ---------------------------------

    * These instructions assume you have successfully integrated
    Tomcat with Apache according to the Tomcat documentation.

    * Copy &struts-documentation.war& and &struts-example.war&
    to your $TOMCAT_HOME/webapps directory

    * Restart Tomcat if it is already running

    * Tomcat will generate a file &$TOMCAT_HOME/conf/tomcat-apache.conf&
    that will be used by Apache. This file is regenerated every time
    you start Tomcat, so copy this file to a safe place (such as
    your Apache configuration directory; on Unix systems this is usually
    &/usr/local/apache/conf&.

    * If you are running Tomcat 3.1, Tomcat will not have generated the
    entries for your new applications. Add the following lines to the
    &tomcat-apache.conf& file that you have saved, replacing
    $TOMCAT_HOME with the path to your Tomcat home directory:

    Alias /struts-documentation &$TOMCAT_HOME/webapps/struts-documentation&
    &Directory &$TOMCAT_HOME/webapps/struts-documentation&
    Options Indexes FollowSymLinks
    &/Directory&
    ApJServMount /struts-documentation/servlet /struts-documentation
    &Location &/struts-documentation/WEB-INF/&&
    AllowOverride None
    deny from all
    &/Location&

    Alias /struts-example &$TOMCAT_HOME/webapps/struts-example&
    &Directory &$TOMCAT_HOME/webapps/struts-example&
    Options Indexes FollowSymLinks
    &/Directory&
    ApJServMount /struts-example/servlet /struts-example
    &Location &/struts-example/WEB-INF/&&
    AllowOverride None
    deny from all
    &/Location&

    * On all versions of Tomcat, the generated file above does not
    know anything about extension mappings defined in a web.xml file,
    so the &*.do& URIs that go to the controller servlet will not be
    recognized. To fix this, add the following line to the saved
    version of &tomcat-apache.conf&, after the corresponding line
    for the .jsp extension:

    AddHandler jserv-servlet .do

    * Ensure that the saved version of &tomcat-apache.conf& is referenced
    in your Apache &httpd.conf& configuration file. A typical use would
    have the following line at the bottom of &httpd.conf&:

    Include /usr/local/apache/conf/tomcat-apache.conf

    * In order to recognize &index.jsp& as a default page for web
    applications, search in your &httpd.conf& for a &DirectoryIndex&
    directive. If you have one, add &index.jsp& to the end of the
    list, so that it might look like this:

    DirectoryIndex index.html index.jsp

    If you do not have such an entry, add one like this:

    DirectoryIndex index.jsp

    * Restart Apache to make it aware of the new applications. You should
    now be able to access the applications from a browser like this:

    http://localhost/struts-documentation
    http://localhost/struts-example



    Best I can do for you, as this does not work on 4.0.3 as certain things do not happen as the are suppossed to.
     
  7. casey

    casey Active Member

    Joined:
    Jan 17, 2003
    Messages:
    2,334
    Likes Received:
    0
    Trophy Points:
    36
    Location:
    If there is trouble, it will find me
    I don't know about any new advancements since this thread, but I used the code in the following thread to enable .do files, and my customer is happy as can be.
    http://forums.cpanel.net/showthread.php?s=&threadid=11576&highlight=struts

    I didn't do anything except put that code in his virtualhost entry and he did all else himself. I can't swear that it works flawlessly, because I haven't and don't want to ask. As long as he's happy I'm happy.
     
  8. jsteel

    jsteel Member

    Joined:
    Jul 4, 2002
    Messages:
    649
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Atlanta, GA
    Struts works just fine on Tomcat 4.0. It's as application framework, not a server framework, so each user must have their own jars.

    The one big problem I see here is directions for mod_jserv are being posted and everyone seems to be failing to realize they are probably using mod_jk.

    Pass the right mount directives and you're all set.
     

Share This Page