Piero Sartini wrote:
Am Freitag, 16. November 2007 23:04:37 schrieb Brian Pontarelli:
Yep. I fall into that category. How else can you build reusable
components in Struts2?
Could you please explain why this does not work in s2? I need to build such an
application and was under the impression that it will work with JSPs (I used
smarturls before and the JSPs were under WEB-INF/content/ ... isn't it
possible to load them from a jar? )
The issue is that JSPs are controlled under the J2EE specification.
According to that specification, JSPs are compiled into Servlets by the
J2EE container. These Servlets are then mapped to specific URLs
automatically by the container based on the location of the JSP within
the web application. Some URLs are accessible to the outside world and
others aren't (i.e. /index.jsp is accessible while
/WEB-INF/content/index.jsp isn't). When a URL comes into the container
or is handled via a forward or server-side include, the J2EE container
looks in the web application for the JSPs and compiles them if they
haven't already been compiled.
There isn't anything technical that prevents the J2EE container from
looking in the classpath for either a JSP or pre-compiled JSP. In fact,
some containers do support pre-compiling your JSPs. However, this often
requires some major configuration and handling. The issue is that the
J2EE specification doesn't specifically define a mechanism for mapping
URLs to JSPs loaded from the classpath and how to handle compiling and
caching those JSPs. Therefore, most containers provide some type of
non-standard mechanism to accomplish this and most support is pretty
painful.
That is one of the main reasons why FreeMarker and Velocity were added
as engines to WebWork and Struts.
In general, it wouldn't be difficult to add the same support for JSPs.
It would mostly require a default classpath search mechanism for
locating the JSPs based on the URL. I'd even go one step further and
abstract out JSPs so that they didn't require a container and provide a
javax package to access and use them outside of containers.
Hopefully that helps clear things up somewhat. If not, feel free to ask
more questions. Oh, and as for your upcoming development around
"components", I'd go with FreeMarker. Let me know how it goes and if you
need any help.
-bp
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]