Many may have missed that one of the cool new things in CFMX is that it allows integration of JSPs and servlets, meaning (for
one thing) that you can actually place them within the CFMX environment and run them, as well as pass control to them, share variables, andmore.
For instance, (in the Enterprise Edition only), you can place a JSP page in your CFMX web application directories right alongside your CF templates and calling it with a URL just like CFM page (using .jsp for the extension of course in the file name and the URL).
And servlets can be run as well, by placing them in the WEB-INF\classes directory and then calling them with:
http://yourdomain[:port]/servlet/ServletClassName
Those familiar with Servlets may know that sometimes you don't want to use the /servlet/ approach. You can create a virtual mapping instead by editing the file
[CFusionMXhome]\runtime\servers\default\SERVER-INF\default-web.xml.
To create a mapping for a servlet named SimpleServlet residing in the cfusionmx\wwwwroot\WEB-INF\classes directory, for instance, so that it could be called as /simple, just put the following in between the <web-app> element tags of that file:
<servlet>
<servlet-name>SimpleServlet</servlet-name>
<servlet-class>SimpleServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SimpleServlet</servlet-name>
<url-pattern>/Simple</url-pattern>
</servlet-mapping>
For more details on this sort of configuration, as well as on how to write and compile JSPs and servlets, see any good JSP/servlet book (including the fine JRun docs at livedocs.macromedia.com).
Those familiar with mapping virtual paths for servlets may also know that you can disabling the "servletinvoker". That's done by editing the file cfusionmx\runtime\servers\default\SERVER-INF\default-web.xml and commenting out the servlet definition for the ServletInvoker servlet.
One interesting aside is that while the Professional edition of CFMX specifically prevents execution of JSPs, it does not prevent execution of Servlets (of course, under the covers, CFML templates get converted to servlets in CFMX, so it may seem like there's no choice but that it should support them). But my reading of a few CFMX documents and the "edition comparison" suggests that running JSPs and servlets is an Enterprise-only feature. Be aware if running on Pro. Don't make any design/architecture decisions based solely on the fact that it "works", if it's against the license. I've reported this observation to Macromedia and am awaiting word.
Friday, September 13, 2002
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment