File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Impl Front Controller Pattern on root level

 
Ray Lim
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So is your question can you map the URL for your front controller servlet to "/"?
Kyle
 
Ray Lim
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic