Problem: The SPRINGMVC framework accesses the JSP file under Web-inf, as follows: Using SPRINGMVC, you will typically use the Springmvc view resolver, which is probably configured
<property name= "prefix" value= "/web-inf/jsp/" ></property><property name= "suffix" value= ". jsp" > </property>
When my control returns
return new Modelandview ("Admin/index");
The actual access is/web-inf/jsp/admin/index.jsp this page, then placed under Web-inf can only be accessed by the server to ensure security. If there is such a code in INDEX.JSP
, top.jsp and index.jsp are all in the admin directory, so access to index will be 404.
At this time tangled: 1, top.jsp if must and index.jsp in the same directory, will add a control, add a control for a connection is not worth. 2, if not in the same directory under the Webroot root directory, index.jsp and top.jsp is not the same place, maintenance time is not very convenient, 3, another situation SPRINGMVC view parser path modified to <property name= "prefix "Value="/jsp/"></property> is in the project root directory, so that the client can also directly access this directory, there is no security, how to do it?
The following solutions are available through Internet collation:
=================1 Building =====================
<mvc:view-controller path= "/left" view-name= "left"/>
=================2 Building =====================
What I did was--I had to add a controller. The idea is to do the following
[List=1]
- Get a directory of publicly available JSPs, such as/web-inf/jsp/public.
- There's a control,spring, and there's a redirect. or write yourself a. Inside fixed to the top of the catalogue. Of course, it can be implemented with flexible points such as parameter configuration.
Become
Like this.
[/list]
The purpose of doing this is basically to answer your question.
1. JSP Unified put together--/web-inf/jsp/.
2. Use one and only one controller to control the JSP that needs to be exposed.
About the JSP file under SPRINGMVC framework access Web-inf