You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paweł Wielgus <po...@gmail.com> on 2010/06/01 20:47:03 UTC

Re: Struts2 empty action extension help request

Hi Phil,
why You want to use struts2 if You are dropping one of the main parts
of it - actions?
It looks like You are trying to write one servlet (action) and catch
all that is coming in. If this is correct i strongly suggest to
rethink struts2 as a framework.
As to the problem of blank action extension, it just works, no need to
add anything. But when You call for the gif file You are probably
requesting for http://myapp.com/action/picture.gif which has an
extension and it should be accessible without an action and the file
picture.gif should placed action catalog in your app folder to work.
If You want to have access to action name in action which is kind of
pointless normally because You are in this action, then add
RequestAware or get ActionInvocation object where this info is
accessible.

Best greetings,
Paweł Wielgus.

2010/5/31 Phil Davis <te...@gmail.com>:
> Correction, when the extension is blank, it does not find the image.  It
> seems that I was getting a cached version.
>
> So, it seems that blank extensions do NOT completely work... That is, they
> don't work with other resource types (images, css, etc)
>
> I still would appreciate your response, and still looking for answer to the
> first question.... how to determine the URL.
>
> Thanks again!
>
> Phil
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2 empty action extension help request

Posted by Phil Davis <te...@gmail.com>.
Thanks for your response Pawel,

I am still having problems, so I have included a sample setup.  I am using
Eclipse and GlassFish v3.  The files in my WAR are:

  /images/logo.gif
  /META-INF/MANIFEST.MF
  /WEB-INF/classes/com/example/actions/MainSite.class
  /WEB-INF/classes/struts.xml
  /WEB-INF/lib/commons-logging-1.1.jar
  /WEB-INF/lib/freemarker-2.3.8.jar
  /WEB-INF/lib/ognl-2.6.11.jar
  /WEB-INF/lib/struts2-core-2.0.11.jar
  /WEB-INF/lib/xwork-2.0.4.jar
  /WEB-INF/sun-web.xml
  /WEB-INF/web.xml

the contents of the four important files are:

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
    <display-name>Example</display-name>

    <filter>
        <filter-name>struts2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>com.example.actions</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>


struts.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" >
<struts>
    <constant name="struts.devMode" value="true"/>
    <constant name="struts.action.extension" value="action"/>

    <package name="default" extends="struts-default">
        <action name="example" class="com.example.actions.MainSite">
            <result name="SUCCESS">/MainSite.jsp</result>
        </action>
    </package>
</struts>

MainSite.java:
package com.example.actions;

public class MainSite
{
    private String msg;

    public String execute()
    {
        setMsg( "Fred was here");
        return( "SUCCESS");
    }

    public String getMsg()
    {
        return msg;
    }

    public void setMsg( String msg)
    {
        this.msg = msg;
    }
}

MainSite.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Insert title here</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
    <img src="images/logo.gif"/>
    <br/>
    The Message is: <s:property value="msg"/>
</body>
</html>


and the results are:

http://localhost:8080/Example/example.action
    <<logo>>
    The Message is: Fred was here

http://localhost:8080/Example/example
    404

http://localhost:8080/Example
    404

http://localhost:8080/Example/images/logo.gif
    <<logo>>

This works as expected!

So, I change the struts.xml file action name to star:
    <action name="*" class="com.example.actions.MainSite">

and ran again, and I get the same results, except I can also go to
asdf.action, foobar.action and get the same results as example.action


So, I change action name back to "example" and change extension to ""
    <constant name="struts.action.extension" value=""/>
    ....
    <action name="example" class="com.example.actions.MainSite">

and the results are:

http://localhost:8080/Example/example.action
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name
example.action
....

http://localhost:8080/Example/example
    The Message is: Fred was here

http://localhost:8080/Example
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name .
 ....

http://localhost:8080/Example/images/logo.gif
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name
logo.gif.
 ....


Please notice that the logo does not show up on Example/example nor in
Example/images/logo.gif


and finally, I change both lines in the struts.xml file:
<constant name="struts.action.extension" value=""/>
<action name="*" class="com.example.actions.MainSite">

http://localhost:8080/Example/example.action
    The Message is: Fred was here

http://localhost:8080/Example/example
    The Message is: Fred was here

http://localhost:8080/Example
    The Message is: Fred was here

http://localhost:8080/Example/images/logo.gif
    The Message is: Fred was here


Please notice that the logo does not show up in any page


I believe I have done a thorough job in testing this.  My conclusion is that
empty extension does not work as required as it blocks all requests for
files.  Instead, it calls the action.  This is kinda expected, as I am
telling it to process all files by calling the MainSite action.  However, I
need it to process regular files, such as the logo.gif and css files, etc.


As a side note, I also tested /Example/images and got the unhandled
exception error

Phil



2010/6/1 Paweł Wielgus <po...@gmail.com>

> Hi Phil,
> why You want to use struts2 if You are dropping one of the main parts
> of it - actions?
> It looks like You are trying to write one servlet (action) and catch
> all that is coming in. If this is correct i strongly suggest to
> rethink struts2 as a framework.
> As to the problem of blank action extension, it just works, no need to
> add anything. But when You call for the gif file You are probably
> requesting for http://myapp.com/action/picture.gif which has an
> extension and it should be accessible without an action and the file
> picture.gif should placed action catalog in your app folder to work.
> If You want to have access to action name in action which is kind of
> pointless normally because You are in this action, then add
> RequestAware or get ActionInvocation object where this info is
> accessible.
>
> Best greetings,
> Paweł Wielgus.
>
> 2010/5/31 Phil Davis <te...@gmail.com>:
> > Correction, when the extension is blank, it does not find the image.  It
> > seems that I was getting a cached version.
> >
> > So, it seems that blank extensions do NOT completely work... That is,
> they
> > don't work with other resource types (images, css, etc)
> >
> > I still would appreciate your response, and still looking for answer to
> the
> > first question.... how to determine the URL.
> >
> > Thanks again!
> >
> > Phil
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Struts2 empty action extension help request

Posted by Phil Davis <te...@gmail.com>.
As far as using one action.... why would I want 30 actions that are
identical?   Since the page is populated by the database?

I agree that it does not utilize one of the best features of struts to its
full extent... but it does use it, and many other features.

On Jun 3, 2010 4:34 AM, "Paweł Wielgus" <po...@gmail.com> wrote:

Hi Phil,
i see your point,
when action is configured to catch all requests like that it will
catch all *.gif requests,
maybe add namespace to your action and that will solve your problem,
then You will call any action but in /Example/mynamespace/* and You
will store your images in /images directory,
don't forget to not to use realative address for your image file - do
it like this < img src="/images/logo.gif" />
Still, if You want to use one action in struts,
it's pointles to use struts - but that's just my point of view.

Best greetings,
Paweł Wielgus

2010/6/3 Phil Davis <te...@gmail.com>:

> Thanks for your response Pawel,
>
> I am still having problems, so I have included a sample setup....

---------------------------------------------------------------------
To unsubscribe, e-mail: user-u...

Re: Struts2 empty action extension help request

Posted by Phil Davis <te...@gmail.com>.
Thanks for the rezsponse.  And I am sorry for the multiple posts of the last
message.

Unfortunately, when I create a newnamespace, I still have the same problem.
I think the reason is it is looking for an action named "logo.for" in the
namespace "images", and since the only action is "fred" it doesn't find
one.  So, according to the documentation, it goes to the default namespace.
So, what I got was the main action without a logo.

It just occurred to me... maybe I need a different namespace for "/", the
main action will be caught.  Then, I also need a namespace for "/images".
Since the /images/logo.for won't map to an action in neither the "/images"
namespace nor the default namespace, it will just be a regular file....
i'll try this tonight.

On Jun 3, 2010 4:34 AM, "Paweł Wielgus" <po...@gmail.com> wrote:

Hi Phil,
i see your point,
when action is configured to catch all requests like that it will
catch all *.gif requests,
maybe add namespace to your action and that will solve your problem,
then You will call any action but in /Example/mynamespace/* and You
will store your images in /images directory,
don't forget to not to use realative address for your image file - do
it like this < img src="/images/logo.gif" />
Still, if You want to use one action in struts,
it's pointles to use struts - but that's just my point of view.

Best greetings,
Paweł Wielgus

2010/6/3 Phil Davis <te...@gmail.com>:

> Thanks for your response Pawel,
>
> I am still having problems, so I have included a sample setup....

---------------------------------------------------------------------
To unsubscribe, e-mail: user-u...

Re: Struts2 empty action extension help request

Posted by Paweł Wielgus <po...@gmail.com>.
Hi Phil,
i see your point,
when action is configured to catch all requests like that it will
catch all *.gif requests,
maybe add namespace to your action and that will solve your problem,
then You will call any action but in /Example/mynamespace/* and You
will store your images in /images directory,
don't forget to not to use realative address for your image file - do
it like this < img src="/images/logo.gif" />
Still, if You want to use one action in struts,
it's pointles to use struts - but that's just my point of view.

Best greetings,
Paweł Wielgus

2010/6/3 Phil Davis <te...@gmail.com>:
> Thanks for your response Pawel,
>
> I am still having problems, so I have included a sample setup.  I am using
> Eclipse and GlassFish v3.  The files in my WAR are:
>
>  /images/logo.gif
>  /META-INF/MANIFEST.MF
>  /WEB-INF/classes/com/example/
> actions/MainSite.class
>  /WEB-INF/classes/struts.xml
>  /WEB-INF/lib/commons-logging-1.1.jar
>  /WEB-INF/lib/freemarker-2.3.8.jar
>  /WEB-INF/lib/ognl-2.6.11.jar
>  /WEB-INF/lib/struts2-core-2.0.11.jar
>  /WEB-INF/lib/xwork-2.0.4.jar
>  /WEB-INF/sun-web.xml
>  /WEB-INF/web.xml
>
> the contents of the four important files are:
>
> web.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
> http://java.sun.com/xml/ns/javaee" xmlns:web="
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
> http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
> version="2.5">
>    <display-name>Example</display-name>
>
>    <filter>
>        <filter-name>struts2</filter-name>
>
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
>        <init-param>
>            <param-name>actionPackages</param-name>
>            <param-value>com.example.actions</param-value>
>        </init-param>
>    </filter>
>
>    <filter-mapping>
>        <filter-name>struts2</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
> </web-app>
>
>
> struts.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" >
> <struts>
>    <constant name="struts.devMode" value="true"/>
>    <constant name="struts.action.extension" value="action"/>
>
>    <package name="default" extends="struts-default">
>        <action name="example" class="com.example.actions.MainSite">
>
>            <result name="SUCCESS">/MainSite.jsp</result>
>        </action>
>    </package>
> </struts>
>
> MainSite.java:
> package com.example.actions;
>
> public class MainSite
> {
>    private String msg;
>
>    public String execute()
>    {
>        setMsg( "Fred was here");
>        return( "SUCCESS");
>    }
>
>    public String getMsg()
>    {
>        return msg;
>    }
>
>    public void setMsg( String msg)
>    {
>        this.msg = msg;
>    }
> }
>
> MainSite.jsp:
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <%@ taglib prefix="s" uri="/struts-tags"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
> http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
>    <title>Insert title here</title>
>    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
> </head>
> <body>
>    <img src="images/logo.gif"/>
>    <br/>
>    The Message is: <s:property value="msg"/>
> </body>
> </html>
>
>
> and the results are:
>
> http://localhost:8080/Example/example.action
>    <<logo>>
>    The Message is: Fred was here
>
> http://localhost:8080/Example/example
>    404
>
> http://localhost:8080/Example
>    404
>
> http://localhost:8080/Example/images/logo.gif
>    <<logo>>
>
> This works as expected!
>
> So, I change the struts.xml file action name to star:
>
>    <action name="*" class="com.example.actions.MainSite">
>
> and ran again, and I get the same results, except I can also go to
> asdf.action, foobar.action and get the same results as example.action
>
>
> So, I change action name back to "example" and change extension to ""
>
>    <constant name="struts.action.extension" value=""/>
>    ....
>    <action name="example" class="com.example.actions.MainSite">
>
> and the results are:
>
> http://localhost:8080/Example/example.action
> Struts Problem Report
> Struts has detected an unhandled exception:
> Messages: * There is no Action mapped for namespace / and action name
> example.action
> ....
>
> http://localhost:8080/Example/example
>    The Message is: Fred was here
>
> http://localhost:8080/Example
> Struts Problem Report
> Struts has detected an unhandled exception:
> Messages: * There is no Action mapped for namespace / and action name .
>  ....
>
> http://localhost:8080/Example/images/logo.gif
> Struts Problem Report
> Struts has detected an unhandled exception:
> Messages: * There is no Action mapped for namespace / and action name
> logo.gif.
>  ....
>
>
> Please notice that the logo does not show up on Example/example nor in
> Example/images/logo.gif
>
>
> and finally, I change both lines in the struts.xml file:
> <constant name="struts.action.extension" value=""/>
> <action name="*" class="com.example.actions.MainSite">
>
> http://localhost:8080/Example/example.action
>    The Message is: Fred was here
>
> http://localhost:8080/Example/example
>    The Message is: Fred was here
>
> http://localhost:8080/Example
>    The Message is: Fred was here
>
> http://localhost:8080/Example/images/logo.gif
>    The Message is: Fred was here
>
>
> Please notice that the logo does not show up in any page
>
>
> I believe I have done a thorough job in testing this.  My conclusion is that
> empty extension does not work as required as it blocks all requests for
> files.  Instead, it calls the action.  This is kinda expected, as I am
> telling it to process all files by calling the MainSite action.  However, I
> need it to process regular files, such as the logo.gif and css files, etc.
>
>
> As a side note, I also tested /Example/images and got the unhandled
> exception error
>
> Phil
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2 empty action extension help request

Posted by Greg Lindholm <gr...@gmail.com>.
You need to change your filter-mapping in web.xml so that static
resources like images, css, js etc do not get processed by the struts
filter.

This is what I use where all actions use the *.action extension.

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

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>*.action</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/struts/*</url-pattern>
  </filter-mapping>

If you don't want to use an extension you can use a prefix that
matches your namespace and you can have multiple filter-mapping
definitions one for each namespace.


  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/xxx/*</url-pattern>
  </filter-mapping>

  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/yyy/*</url-pattern>
  </filter-mapping>

The drawback with this is it doesn't work for the root (/) namespace
and since filter-mapping does not support any exclude pattern you
can't just exclude the images etc.

You may be able to modify the struts filter to exclude certain
patterns, assuming it doesn't already have this feature it sounds like
a nice enhancement.


On Thu, Jun 3, 2010 at 5:16 PM, Phil Davis <te...@gmail.com> wrote:
> Bummer,
>
> Even with two namespaces, "/" and "/images" it still wants to run the image
> file, "/images/logo.gif", as an action under the "/images" namespace, it
> complains that there is no action mapped....
>
> I also tried a single namespace for "/" and got the same error.
>
> So, I think this is a bug... one that probably will not occur very often,
> because I am not using struts in a "normal" way, but it does not provide the
> functionality that I need.  There should be a way to specify URLs and files
> that are NOT actions, at least when using a blank extension.
>
> I absolutely need blank extension... I hate extensions!  and no one will
> know what extension to goto to start the page.... the default page should be
> www.example.com, which is usually a static page, but I don't want a static
> page... I want to use some type of action.  Sure I could do a redirect....
> yuck!
>
> One more thing to try.... separate projects....
>
> OK, when I create a separate project "/images" and change the URL in the JSP
> file to the absolute path "/images/logo.gif" ... it works!  This is a
> separate project, not a namespace or anything within the defined project!!!!
>
> This is a HACK, but I can live with it for now!
>
> I still think it is a bug that empty extensions cause regular files to cease
> to work.
>
> Phil
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts2 empty action extension help request

Posted by Phil Davis <te...@gmail.com>.
Bummer,

Even with two namespaces, "/" and "/images" it still wants to run the image
file, "/images/logo.gif", as an action under the "/images" namespace, it
complains that there is no action mapped....

I also tried a single namespace for "/" and got the same error.

So, I think this is a bug... one that probably will not occur very often,
because I am not using struts in a "normal" way, but it does not provide the
functionality that I need.  There should be a way to specify URLs and files
that are NOT actions, at least when using a blank extension.

I absolutely need blank extension... I hate extensions!  and no one will
know what extension to goto to start the page.... the default page should be
www.example.com, which is usually a static page, but I don't want a static
page... I want to use some type of action.  Sure I could do a redirect....
yuck!

One more thing to try.... separate projects....

OK, when I create a separate project "/images" and change the URL in the JSP
file to the absolute path "/images/logo.gif" ... it works!  This is a
separate project, not a namespace or anything within the defined project!!!!

This is a HACK, but I can live with it for now!

I still think it is a bug that empty extensions cause regular files to cease
to work.

Phil

Re: Struts2 empty action extension help request

Posted by Phil Davis <te...@gmail.com>.
Thanks for your response Pawel,

I am still having problems, so I have included a sample setup.  I am using
Eclipse and GlassFish v3.  The files in my WAR are:

  /images/logo.gif
  /META-INF/MANIFEST.MF
  /WEB-INF/classes/com/example/
actions/MainSite.class
  /WEB-INF/classes/struts.xml
  /WEB-INF/lib/commons-logging-1.1.jar
  /WEB-INF/lib/freemarker-2.3.8.jar
  /WEB-INF/lib/ognl-2.6.11.jar
  /WEB-INF/lib/struts2-core-2.0.11.jar
  /WEB-INF/lib/xwork-2.0.4.jar
  /WEB-INF/sun-web.xml
  /WEB-INF/web.xml

the contents of the four important files are:

web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="
http://java.sun.com/xml/ns/javaee" xmlns:web="
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
    <display-name>Example</display-name>

    <filter>
        <filter-name>struts2</filter-name>

<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
        <init-param>
            <param-name>actionPackages</param-name>
            <param-value>com.example.actions</param-value>
        </init-param>
    </filter>

    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>


struts.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" >
<struts>
    <constant name="struts.devMode" value="true"/>
    <constant name="struts.action.extension" value="action"/>

    <package name="default" extends="struts-default">
        <action name="example" class="com.example.actions.MainSite">

            <result name="SUCCESS">/MainSite.jsp</result>
        </action>
    </package>
</struts>

MainSite.java:
package com.example.actions;

public class MainSite
{
    private String msg;

    public String execute()
    {
        setMsg( "Fred was here");
        return( "SUCCESS");
    }

    public String getMsg()
    {
        return msg;
    }

    public void setMsg( String msg)
    {
        this.msg = msg;
    }
}

MainSite.jsp:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Insert title here</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
    <img src="images/logo.gif"/>
    <br/>
    The Message is: <s:property value="msg"/>
</body>
</html>


and the results are:

http://localhost:8080/Example/example.action
    <<logo>>
    The Message is: Fred was here

http://localhost:8080/Example/example
    404

http://localhost:8080/Example
    404

http://localhost:8080/Example/images/logo.gif
    <<logo>>

This works as expected!

So, I change the struts.xml file action name to star:

    <action name="*" class="com.example.actions.MainSite">

and ran again, and I get the same results, except I can also go to
asdf.action, foobar.action and get the same results as example.action


So, I change action name back to "example" and change extension to ""

    <constant name="struts.action.extension" value=""/>
    ....
    <action name="example" class="com.example.actions.MainSite">

and the results are:

http://localhost:8080/Example/example.action
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name
example.action
....

http://localhost:8080/Example/example
    The Message is: Fred was here

http://localhost:8080/Example
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name .
 ....

http://localhost:8080/Example/images/logo.gif
Struts Problem Report
Struts has detected an unhandled exception:
Messages: * There is no Action mapped for namespace / and action name
logo.gif.
 ....


Please notice that the logo does not show up on Example/example nor in
Example/images/logo.gif


and finally, I change both lines in the struts.xml file:
<constant name="struts.action.extension" value=""/>
<action name="*" class="com.example.actions.MainSite">

http://localhost:8080/Example/example.action
    The Message is: Fred was here

http://localhost:8080/Example/example
    The Message is: Fred was here

http://localhost:8080/Example
    The Message is: Fred was here

http://localhost:8080/Example/images/logo.gif
    The Message is: Fred was here


Please notice that the logo does not show up in any page


I believe I have done a thorough job in testing this.  My conclusion is that
empty extension does not work as required as it blocks all requests for
files.  Instead, it calls the action.  This is kinda expected, as I am
telling it to process all files by calling the MainSite action.  However, I
need it to process regular files, such as the logo.gif and css files, etc.


As a side note, I also tested /Example/images and got the unhandled
exception error

Phil