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<r...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org