PDA

View Full Version : /* servlet mapping issue


sbirnie
Apr 26th, 2007, 10:55 AM
I posted about this earlier and got some help from mdeinum, but I still haven't been able to find a good solution.

I'm working on an application that would take any incoming request to a web server. For example - here's a jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
</jboss-web>

And the web.xml:
<servlet-mapping>
<servlet-name>sample</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>


After I process the request, I want to send back a page. I tried using JstlView, but I believe that is causing a forward of the '/WEB-INF/jsp/whatever.jsp' back to the server. Which then causes it to go through the controller again causing a loop or an error.

I tried using mdeinum's advice and forwarding to a specific url that would call a different controller, but the same issue applies when I return a JstlView from that controller. I thought maybe that if I used a TilesJstlView that it might not forward back to the server again, but it seems that it does.

I think that I could probably output the html directly from the controller and return null, but I don't like that approach.

Does any one come across this and found a solution?

sbirnie
Apr 26th, 2007, 12:00 PM
I FINALLY found out the answer to my issue. The problem with the JstlView and TilesJstlView is that they extend from InternalResourceView. Within it's renderMergedOutputModel method, it will always perform a RequestDispatcher.forward.

While I'm not familiar with Velocity, I was able to change the application to use VelocityView, which does not extend from InternalResourceView, and that rendered the html without forwarding.