You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nick J <ni...@gmail.com> on 2008/10/02 20:04:05 UTC

Struts2 static content

I am using struts2.
I don't want .action or .do on the end of the url's, so I set
struts.action.extension='' (empty string)

Now this leaves me with a bit of a problem serving static content, since
struts swallows up all of my requests, and nothing gets through to the
default servlet.

How can I set up an action to serve static content?
-- 
View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p19784601.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts2 static content

Posted by Paweł Wielgus <po...@gmail.com>.
Hi,
have You tried doing nothing to achieve adresses like
http://my.server.com/myNameSpace/myAction
it works for me on S2.1.2

Best greetings,
Paweł Wielgus.

2008/10/3 Nick J <ni...@gmail.com>:
>
> Oh well, no one's answered me yet, but I have found a way, but it's not very
> satisfactory.
> The problem (as well as the action extension being set to empty string) was
> I had an action in the default namespace as <action name="*"...> so it would
> intercept all remaining requests.
>
> For static content, I needed these additional packages-
> not ideal, because the namespaces are not hierarchical I need a separate
> namespace for each static content folder. Can anyone think of a better way?
>
>    <package name="static" extends="struts-default" namespace="/static">
>        <action name="*">
>            <result>/{1}</result>
>        </action>
>        </package>
>
>    <package name="static-css" extends="struts-default"
> namespace="/static/css">
>        <action name="*">
>            <result>/css/{1}</result>
>        </action>
>        </package>
>
>    <package name="static-js" extends="struts-default"
> namespace="/static/js">
>        <action name="*">
>            <result>/js/{1}</result>
>        </action>
>        </package>
>
>
>
> Nick J wrote:
>>
>> I am using struts2.
>> I don't want .action or .do on the end of the url's, so I set
>> struts.action.extension='' (empty string)
>>
>
> --
> View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p19795669.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Struts2 static content

Posted by Al Sutton <al...@alsutton.com>.
Nick,

The way I do it is to have a web server front end backing off to a 
servlet engine and serve the static content from the web server.

To give you an example of one of my sites (andappstore.com), I have 
Apache at the front end which connects to Tomcat at the back end via 
mod_jk & ajp13, this means that the dynamic parts of the site are under 
a path (e.g. http://andappstore.com/AndroidPhoneApplications/apps/) and 
the static content is served by Apache without involving Tomcat (e.g. 
http://andappstore.com/images/defaulticon.jpg)

This may be overkill for your app, but I've found that using Apache as a 
front end gives me more flexibility over bother dynamic and static 
content than trying to serve everything from an appserver.

Al.

Nick J wrote:
> Oh well, no one's answered me yet, but I have found a way, but it's not very
> satisfactory.
> The problem (as well as the action extension being set to empty string) was
> I had an action in the default namespace as <action name="*"...> so it would
> intercept all remaining requests.
>
> For static content, I needed these additional packages-
> not ideal, because the namespaces are not hierarchical I need a separate
> namespace for each static content folder. Can anyone think of a better way? 
>
>     <package name="static" extends="struts-default" namespace="/static">
>         <action name="*">
>             <result>/{1}</result>
>         </action>    
> 	</package>
>
>     <package name="static-css" extends="struts-default"
> namespace="/static/css">
>         <action name="*">
>             <result>/css/{1}</result>
>         </action>    
> 	</package>
>
>     <package name="static-js" extends="struts-default"
> namespace="/static/js">
>         <action name="*">
>             <result>/js/{1}</result>
>         </action>    
> 	</package>
>
>
>
> Nick J wrote:
>   
>> I am using struts2.
>> I don't want .action or .do on the end of the url's, so I set
>> struts.action.extension='' (empty string)
>>
>>     
>
>   


-- 
Al Sutton

W: www.alsutton.com
B: alsutton.wordpress.com
T: twitter.com/alsutton


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


Re: Struts2 static content

Posted by Nick J <ni...@gmail.com>.
Oh well, no one's answered me yet, but I have found a way, but it's not very
satisfactory.
The problem (as well as the action extension being set to empty string) was
I had an action in the default namespace as <action name="*"...> so it would
intercept all remaining requests.

For static content, I needed these additional packages-
not ideal, because the namespaces are not hierarchical I need a separate
namespace for each static content folder. Can anyone think of a better way? 

    <package name="static" extends="struts-default" namespace="/static">
        <action name="*">
            <result>/{1}</result>
        </action>    
	</package>

    <package name="static-css" extends="struts-default"
namespace="/static/css">
        <action name="*">
            <result>/css/{1}</result>
        </action>    
	</package>

    <package name="static-js" extends="struts-default"
namespace="/static/js">
        <action name="*">
            <result>/js/{1}</result>
        </action>    
	</package>



Nick J wrote:
> 
> I am using struts2.
> I don't want .action or .do on the end of the url's, so I set
> struts.action.extension='' (empty string)
> 

-- 
View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p19795669.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


RE: Struts2 static content

Posted by Martin Gainty <mg...@hotmail.com>.
ive heard that too
TC supports Cache-Control, Expires and Last-Modified for cache control
// Required Cache Control Headers
String maxage = "86400"; // One day in Seconds
response.setHeader("Cache-Control", "max-age="+ maxage);

long relExpiresInMillis = System.currentTimeMillis() + (1000 * Long.parseLong(maxage));
response.setHeader("Expires", getGMTTimeString(relExpiresInMillis));

response.setHeader("Last-Modified", getGMTTimeString(file.lastModified()));but Apache seems to implement caching primarily thru the expires module (except what the browser caches)
http://httpd.apache.org/docs/2.0/mod/mod_expires.html
http://www.websiteoptimization.com/speed/tweak/cache
<Directory "/home/website/public_html">
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    ExpiresDefault A300
    <FilesMatch "\.html$">
        Expires A86400
    </FilesMatch>
    <FilesMatch "\.(gif|jpg|png|js|css)$">
        Expires A2592000
    </FilesMatch>
</Directory>
300 second is default caching for all files...1 day caching for html files...30 days for pics and js

the question i have is what happens with bascially static JS files (such as Dojo)
typical Apache Server happily downloads untouched static JS files for each and every access (except for FilesMatch excps)
i think component plugins such as Struts-dojo plugin a better option to cache static JS files on the TC side 

thanks,
Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Tue, 23 Jun 2009 09:29:11 -0700
> Subject: Re: Struts2 static content
> From: musachy@gmail.com
> To: user@struts.apache.org
> 
> this sounds like a good topic for Myth Buster
> 
> /geek_out
> 
> On Tue, Jun 23, 2009 at 9:25 AM, Wes Wannemacher<we...@wantii.com> wrote:
> > On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher<we...@wantii.com> wrote:
> >> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso<mu...@gmail.com> wrote:
> >>> Struts adds overhead for serving static content. Not that I have ever
> >>> done any benchmarking on it, but I know that at my company(large
> >>> online retailer), just suggesting to serve static content thru tomcat
> >>> instead of apache is a big offense.
> >>>
> >>> musachy
> >>>
> >>
> >> I had a similar experience at a large online content provider. At the
> >> time, we were bouncing back and forth between tomcat and resin. We
> >> used mod_jk and mod_caucho for integration between httpd and the app
> >> servers. I hate it when rules exist, but there is no data to backup
> >> the rule's existence.
> >>
> >
> > To follow that up, check out Chapter 4 of Tomcat: The Definitive
> > Guide, the author goes into detail load testing Tomcat and HTTPD -
> >
> > http://oreilly.com/catalog/9780596101060/chapter/index.html
> >
> > The author does a good job of covering the tools, which I think is
> > important since everyone should test for themselves.
> >
> > -Wes
> >
> > --
> > Wes Wannemacher
> > Author - Struts 2 In Practice
> > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> > http://www.manning.com/wannemacher
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

_________________________________________________________________
Bing™  brings you maps, menus, and reviews organized in one place.   Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1

Re: Struts2 static content

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, Jun 23, 2009 at 12:29 PM, Musachy Barroso<mu...@gmail.com> wrote:
> this sounds like a good topic for Myth Buster
>
> /geek_out
>

Only if they do it in true MythBuster form and the servers blow up.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: Struts2 static content

Posted by Musachy Barroso <mu...@gmail.com>.
this sounds like a good topic for Myth Buster

/geek_out

On Tue, Jun 23, 2009 at 9:25 AM, Wes Wannemacher<we...@wantii.com> wrote:
> On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher<we...@wantii.com> wrote:
>> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso<mu...@gmail.com> wrote:
>>> Struts adds overhead for serving static content. Not that I have ever
>>> done any benchmarking on it, but I know that at my company(large
>>> online retailer), just suggesting to serve static content thru tomcat
>>> instead of apache is a big offense.
>>>
>>> musachy
>>>
>>
>> I had a similar experience at a large online content provider. At the
>> time, we were bouncing back and forth between tomcat and resin. We
>> used mod_jk and mod_caucho for integration between httpd and the app
>> servers. I hate it when rules exist, but there is no data to backup
>> the rule's existence.
>>
>
> To follow that up, check out Chapter 4 of Tomcat: The Definitive
> Guide, the author goes into detail load testing Tomcat and HTTPD -
>
> http://oreilly.com/catalog/9780596101060/chapter/index.html
>
> The author does a good job of covering the tools, which I think is
> important since everyone should test for themselves.
>
> -Wes
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: Struts2 static content

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher<we...@wantii.com> wrote:
> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso<mu...@gmail.com> wrote:
>> Struts adds overhead for serving static content. Not that I have ever
>> done any benchmarking on it, but I know that at my company(large
>> online retailer), just suggesting to serve static content thru tomcat
>> instead of apache is a big offense.
>>
>> musachy
>>
>
> I had a similar experience at a large online content provider. At the
> time, we were bouncing back and forth between tomcat and resin. We
> used mod_jk and mod_caucho for integration between httpd and the app
> servers. I hate it when rules exist, but there is no data to backup
> the rule's existence.
>

To follow that up, check out Chapter 4 of Tomcat: The Definitive
Guide, the author goes into detail load testing Tomcat and HTTPD -

http://oreilly.com/catalog/9780596101060/chapter/index.html

The author does a good job of covering the tools, which I think is
important since everyone should test for themselves.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: Struts2 static content

Posted by mu...@aol.com.
 I would think this is even more expensive that just doling out static content from Tomcat as Struts 2
is also creating a whole bunch of objects for the request cycle.
Chris


 


 

-----Original Message-----
From: Wes Wannemacher <we...@wantii.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Tue, Jun 23, 2009 12:11 pm
Subject: Re: Struts2 static content










On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso<mu...@gmail.com> wrote:
> Struts adds overhead for serving static content. Not that I have ever
> done any benchmarking on it, but I know that at my company(large
> online retailer), just suggesting to serve static content thru tomcat
> instead of apache is a big offense.
>
> musachy
>

I had a similar experience at a large online content provider. At the
time, we were bouncing back and forth between tomcat and resin. We
used mod_jk and mod_caucho for integration between httpd and the app
servers. I hate it when rules exist, but there is no data to backup
the rule's existence.

A SysAdmin that I was good friends with and I sat down and performed a
series of benchmarks in our dev lab. The results were not something
that can easily be generalized (we were testing many different
parameters, not just serving static content, things like "hello world"
through SSI vs JSP), but we found that even under heavy load, Tomcat
and Resin were capable of keeping up with httpd. The biggest factor
was JSP compilation (obviously). In our case, we solved that by
crawling sites as part of deployment. On particularly heavy traffic
sites, we would deploy to the app server, crawl it, then open up
traffic from the load balancers.

Even after the benchmarks, we never changed the way sites were
deployed. I think the argument went something like the following -
protagonist - "I don't see any reason to put httpd out in front of
that app, it will only add unnecessary configuration overhead."
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."
protagonist - "That's not necessarily true, we have data that
indicates that tomcat/resin are just as fast with static content,
which sort of makes sense considering how easy it is to find a
resource then serve it, I mean, what advanced techniques do you think
httpd employs?"
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."

That being said, I generally put the app servers behind a copy of
httpd for configuration not performance. I can't say whether httpd has
more options than Tomcat or vice versa. I have been using httpd so
long, and writing CGI long before writing JSP, so I am just more
familiar with httpd's advanced configuration options (host header
based vhosting, bandwidth throttling, etc.).

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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




 


Re: Struts2 static content

Posted by Wes Wannemacher <we...@wantii.com>.
On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso<mu...@gmail.com> wrote:
> Struts adds overhead for serving static content. Not that I have ever
> done any benchmarking on it, but I know that at my company(large
> online retailer), just suggesting to serve static content thru tomcat
> instead of apache is a big offense.
>
> musachy
>

I had a similar experience at a large online content provider. At the
time, we were bouncing back and forth between tomcat and resin. We
used mod_jk and mod_caucho for integration between httpd and the app
servers. I hate it when rules exist, but there is no data to backup
the rule's existence.

A SysAdmin that I was good friends with and I sat down and performed a
series of benchmarks in our dev lab. The results were not something
that can easily be generalized (we were testing many different
parameters, not just serving static content, things like "hello world"
through SSI vs JSP), but we found that even under heavy load, Tomcat
and Resin were capable of keeping up with httpd. The biggest factor
was JSP compilation (obviously). In our case, we solved that by
crawling sites as part of deployment. On particularly heavy traffic
sites, we would deploy to the app server, crawl it, then open up
traffic from the load balancers.

Even after the benchmarks, we never changed the way sites were
deployed. I think the argument went something like the following -
protagonist - "I don't see any reason to put httpd out in front of
that app, it will only add unnecessary configuration overhead."
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."
protagonist - "That's not necessarily true, we have data that
indicates that tomcat/resin are just as fast with static content,
which sort of makes sense considering how easy it is to find a
resource then serve it, I mean, what advanced techniques do you think
httpd employs?"
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."

That being said, I generally put the app servers behind a copy of
httpd for configuration not performance. I can't say whether httpd has
more options than Tomcat or vice versa. I have been using httpd so
long, and writing CGI long before writing JSP, so I am just more
familiar with httpd's advanced configuration options (host header
based vhosting, bandwidth throttling, etc.).

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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


Re: Struts2 static content

Posted by Musachy Barroso <mu...@gmail.com>.
Struts adds overhead for serving static content. Not that I have ever
done any benchmarking on it, but I know that at my company(large
online retailer), just suggesting to serve static content thru tomcat
instead of apache is a big offense.

musachy

On Tue, Jun 23, 2009 at 8:25 AM, rtd<rt...@mailinator.com> wrote:
>
>
> Musachy Barroso wrote:
>>
>> serving static content with struts 2 is probably not a good idea
>> (performance and security wise)
>>
> Can you expand upon that thought?  At first blush, it strikes me as an
> over-generalization, but I'm always interested in learning.
> --
> View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p24167321.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: Struts2 static content

Posted by rtd <rt...@mailinator.com>.

Musachy Barroso wrote:
> 
> serving static content with struts 2 is probably not a good idea
> (performance and security wise)
> 
Can you expand upon that thought?  At first blush, it strikes me as an
over-generalization, but I'm always interested in learning.
-- 
View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p24167321.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts2 static content

Posted by rtd <rt...@mailinator.com>.

Musachy Barroso wrote:
> 
> serving static content with struts 2 is probably not a good idea
> (performance and security wise)
> 
Can you expand upon that thought?  At first blush, it strikes me as an
over-generalization, but I'm always interested in learning.
-- 
View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p24167320.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Struts2 static content

Posted by Musachy Barroso <mu...@gmail.com>.
serving static content with struts 2 is probably not a good idea
(performance and security wise)

musachy

On Mon, Jun 22, 2009 at 3:13 PM, rtd<rt...@mailinator.com> wrote:
>
> It took me some time to solve this, so I thought I'd share.  My immediate
> need was to serve css, but static html, js, etc. could be done similarly.
>
> Also, I happen to have two namespaces in my struts2 app for security, which
> isn't really important here, except that it demonstrates how to serve static
> content with paths relative to two different roots.
>
> --Config--
> <struts>
>  <package name="myapp" extends="struts-default" namespace = "">
>   <!-- stuff removed -->
>
>    <action name="*.css">
>      <result>/css/{1}.css</result>
>    </action>
>  </package>
>
>  <package name="myapp-admin" extends="struts-default" namespace="/admin">
>    <!-- stuff removed -->
>
>    <action name="*.css">
>      <result>/css/admin/{1}.css</result>
>    </action>
>  </package>
> </struts>
>
> --Uses--
> <!-- note how the paths are relative to two different roots -->
>
> <!-- from an action/jsp in the myapp package -->
> <link rel="stylesheet" type="text/css" href="myapp.css" />
>
> <!-- from an action/jsp in the admin package -->
> <link rel="stylesheet" type="text/css" href="admin.css" />
>
> --
> View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p24156484.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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


Re: Struts2 static content

Posted by rtd <rt...@mailinator.com>.
It took me some time to solve this, so I thought I'd share.  My immediate
need was to serve css, but static html, js, etc. could be done similarly.  

Also, I happen to have two namespaces in my struts2 app for security, which
isn't really important here, except that it demonstrates how to serve static
content with paths relative to two different roots.

--Config--
<struts>
 <package name="myapp" extends="struts-default" namespace = "">
   <!-- stuff removed -->

    <action name="*.css">
      <result>/css/{1}.css</result>
    </action>
 </package>
  
  <package name="myapp-admin" extends="struts-default" namespace="/admin">
    <!-- stuff removed -->

    <action name="*.css">
      <result>/css/admin/{1}.css</result>
    </action>
  </package>
</struts>

--Uses--
<!-- note how the paths are relative to two different roots -->

<!-- from an action/jsp in the myapp package -->
<link rel="stylesheet" type="text/css" href="myapp.css" />

<!-- from an action/jsp in the admin package -->
<link rel="stylesheet" type="text/css" href="admin.css" />

-- 
View this message in context: http://www.nabble.com/Struts2-static-content-tp19784601p24156484.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: struts2 , freemarker email template

Posted by Leonidas Papadakis <lp...@bluecore.gr>.
That's great . Thanks for your help.

Leon


Dave Newton wrote:
> --- On Sat, 10/4/08, Leonidas Papadakis wrote:
>   
>> I use Spring in my project. Is there an example that i can
>> have a look at ?
>>     
>
> http://static.springframework.org/spring/docs/2.5.x/reference/mail.html
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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


Re: struts2 , freemarker email template

Posted by Dave Newton <ne...@yahoo.com>.
--- On Sat, 10/4/08, Leonidas Papadakis wrote:
> I use Spring in my project. Is there an example that i can
> have a look at ?

http://static.springframework.org/spring/docs/2.5.x/reference/mail.html

Dave


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


Re: struts2 , freemarker email template

Posted by Leonidas Papadakis <lp...@bluecore.gr>.
Thanks for the reply Gabriel.

I use Spring in my project. Is there an example that i can have a look at ?

Regards

Leon

Gabriel Belingueres wrote:
> With Spring this is pretty much easy to do.
>
> 2008/10/3 Leonidas Papadakis <lp...@bluecore.gr>:
>   
>> Hi there,
>>
>> i would like to ask what is the best way to implement a mechanism that from
>> inside an action i will read a freemarker template file , set the values,
>> merge it and send it by html email ...
>>
>> Any suggestions ?
>>
>> I appreciate your answers.
>>
>> Regards,
>>
>> Leon
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>   


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


Re: struts2 , freemarker email template

Posted by Gabriel Belingueres <be...@gmail.com>.
With Spring this is pretty much easy to do.

2008/10/3 Leonidas Papadakis <lp...@bluecore.gr>:
> Hi there,
>
> i would like to ask what is the best way to implement a mechanism that from
> inside an action i will read a freemarker template file , set the values,
> merge it and send it by html email ...
>
> Any suggestions ?
>
> I appreciate your answers.
>
> Regards,
>
> Leon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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


struts2 , freemarker email template

Posted by Leonidas Papadakis <lp...@bluecore.gr>.
Hi there,

i would like to ask what is the best way to implement a mechanism that 
from inside an action i will read a freemarker template file , set the 
values, merge it and send it by html email ...

Any suggestions ?

I appreciate your answers.

Regards,

Leon

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


Re: Struts2 static content

Posted by Sébastien Domergue <se...@c-s.fr>.
Hello,

i think that you could modify your web.xml instead. In struts filter, 
you may have a wildcard to take all in struts2 filter. By modifying 
web.xml, you should be able to redirect url with .html or .jsp 
immediatly without using struts.
I don't have any exemple, sorry.

Regards

Sébastien

Nick J a écrit :
> I am using struts2.
> I don't want .action or .do on the end of the url's, so I set
> struts.action.extension='' (empty string)
>
> Now this leaves me with a bit of a problem serving static content, since
> struts swallows up all of my requests, and nothing gets through to the
> default servlet.
>
> How can I set up an action to serve static content?
>