• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Impl Front Controller Pattern on root level

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic