File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Impl Front Controller Pattern on root level Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Impl Front Controller Pattern on root level" Watch "Impl Front Controller Pattern on root level" New topic
Author

Impl Front Controller Pattern on root level

Ray Lim
Greenhorn

Joined: Jan 10, 2002
Posts: 15
I have implented the Front Controller pattern from the J2EE blueprints.
http://developer.java.sun.com/developer/technicalArticles/J2EE/despat/
However, it looks like I have to keep all the jsp files under /sample_app folder, which I don't like. Is there a way to implement the controller on jsp's at the root level(/)?
the web.xml for this is below
<web-app>
<!-- the web.xml file of the web component of the sample application -->
<!-- all other specs -->
<servlet>
<servlet-name>CentralEntryPoint</servlet-name>
<servlet-class>FrontControllerImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CentralEntryPoint</servlet-name>
<!-- The following forces all web page requests of this
application to be routed through the front controller -->
<url-pattern>/sample_app/*</url-pattern>
</servlet-mapping>
<!-- all other specs -->
</web-app>
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
So is your question can you map the URL for your front controller servlet to "/"?
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Ray Lim
Greenhorn

Joined: Jan 10, 2002
Posts: 15
I think so, Yes. I have jsp files at the application root (http://localhost:8080/myapp/test.jsp) but they are not running the front controller. Only the jsp under the http://localhost:8080/myapp/sampleapp/ directory run the front controller. How do I make all jsp under the webapp run the front controller? I tried putting the servlet mapping to "/*" but then I got an endless redirect when the front controller forwards to the target.
[ January 11, 2002: Message edited by: Ray Lim ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Impl Front Controller Pattern on root level