I've been looking for good URL management of web resources in the
struts2-freemarker integration, but that doesn't seem to exist. I'm aware of
the struts2 url tag, which is good for referencing and linking actions, but
I'd like to define, for example, a "resource" directory where I could do:

< img src="${resources}/images/logo.jpg" />

To imitate this, I create a Freemarker template that defines resource
locations and imports them, like:

<#import "config.ftl" as config>
< img src="${config.resdir}/images/logo.jpg" />

First of all, is this proper convention?

One thing I need in order to complete this solution is the context-path of
my application. I imagine this is what the built-in "base" variable is for
(documented in http://struts.apache.org/2.x/docs/freemarker.html). This way,
in "config.ftl", I can:

<#assign resdir = "${base}/resources">

However, ${base} does not seem to be resolving (meanwhile, ${action}
displays information). Is my understanding of how this works incorrect?

-------

As an aside, I don't seem to be receiving any error messages or reports as
to what happens when my struts2 application is faulty. It just fails in
Tomcat; e.g. if there's something wrong with my struts.xml or, in this case,
when ${base} doesn't seem to resolve, and I deploy the application, I just
receive 404 errors from Tomcat. There's even less description in the Tomcat
logs. This is in contrast to when the configuration and templates are
well-formed, and I, for example, visit an unknown action. In this case, I
will receive a nice struts2 report of what happened. With struts.devMode set
to true, shouldn't I receive some sort of report in the former case? If not,
how can I develop these components in a more efficient way?
-- 
View this message in context: 
http://www.nabble.com/Freemarker-Built-in-Variables-Missing%2C-Error-Reporting-tp17995407p17995407.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to