开发者

Resolving a view that is outside the application container

开发者 https://www.devze.com 2023-01-13 18:11 出处:网络
I\'m building a Java Spring app, and I\'m working around a few constraints in the production environment, due to the fact that content is being published from a CMS. I have my images, js, css and jsp

I'm building a Java Spring app, and I'm working around a few constraints in the production environment, due to the fact that content is being published from a CMS. I have my images, js, css and jsp views residing in a static folder. I'm running a Tomcat app server, and i've set up Virtual directory mappings in the server.xml to map the images, css and js, which is working:

<Context debug="1" docBase="/home/content/images" path="/images" reloadable="true"/>
<Context debug="1" docBase="/home/content/css" path="/css" reloadable="true"/>
<Context debug="1" docBase="/home/content/js" path="/js" reloadable="true"/>
<Context debug="1" docBase="/home/content/view" path="/view" reloadable="true"/>

I've run into a problem resolving my jsp views, though. I'm using a Sprin开发者_开发百科g URIBasedViewResolver, configured as below:

<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/view/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

The views aren't being found and I am getting 404 errors. Is it possible to resolve views outside the container? All of the examples and tutorials I can find have the views located within the /WEB-INF folder.

Thanks in advance! Kate


Yes it will be, but for the life of me I cannot remember how. You will probably need to use either a different view resolver or write a custom one. It should not be too hard.

0

精彩评论

暂无评论...
验证码 换一张
取 消