We said that the Web-inf directory has *.xml classes lib directories and files, they are generally not let direct access.
Description of this directory is safe, we recall why not JSP, HTML and other page files into it.
Will it be safer? It's a good guess, it's safe (you can do this with a filter),
There is a path problem that needs to be resolved, using page entry issues, if the paging file is placed in the Web-inf directory, the user accesses
Web-inf Directory page file will be unable to find the page, users how to access the site page.
If the liandong.jsp is placed in the web-inf/jsp directory, the Web context-root is: Liandong so
1. We can create a new index.jsp under Webroot, where the code is:
<jsp:forward page= "web-inf/jsp/liandong.jsp" ></jsp:forward>
2. We can configure code in Struts-config.xml:
<action path= "/test" scope= "Request"
Type= "Org.springframework.web.struts.DelegatingActionProxy" >
<forward name= "Liandong" path= "/web-inf/jsp/liandong.jsp" ></forward>
</action>
The code in the action is:
@Override
Public Actionforward Execute (actionmapping mapping, Actionform form,
HttpServletRequest request, HttpServletResponse response)
Throws Exception {
TODO auto-generated Method Stub
Method 2
Return Mapping.findforward ("Liandong");
}
index.jsp code is: <a href= "Test.do" >link-->liandong</a>
3. We can write code in action:
@Override
Public Actionforward Execute (actionmapping mapping, Actionform form,
HttpServletRequest request, HttpServletResponse response)
Throws Exception {
TODO auto-generated Method Stub
System.out.println ("BBB");
RequestDispatcher rd = Request.getrequestdispatcher ("web-inf/jsp/liandong.jsp");
Rd.forward (Request,response);
return null;
}
index.jsp code is: <a href= "Test.do" >link-->liandong</a>
Struts-config.xml Configuration Code:
<action path= "/test" scope= "Request"
Type= "Org.springframework.web.struts.DelegatingActionProxy" >
<forward name= "Liandong" path= "/web-inf/jsp/liandong.jsp" ></forward>
</action>
4.action Medium
@Override
Public Actionforward Execute (actionmapping mapping, Actionform form,
HttpServletRequest request, HttpServletResponse response)
Throws Exception {
TODO auto-generated Method Stub
System.out.println ("BBB");
return new Actionforward ("/web-inf/jsp/liandong.jsp");
}
index.jsp code is: <a href= "Test.do" >link-->liandong</a>
Struts-config.xml Configuration Code:
<action path= "/test" scope= "Request"
Type= "Org.springframework.web.struts.DelegatingActionProxy" >
<forward name= "Liandong" path= "/web-inf/jsp/liandong.jsp" ></forward>
</action>
Another problem is that cascading style files, JS script files, picture file paths
1. Page Access pictures
Background-image:url ('/liandong/images/bg.bmp ')
2. Page access cascading style files
<link rel= "stylesheet" href= "/liandong/css/liandong.css" type= "Text/css" ></link>
3. Page Access JS script file
<script type= "Text/javascript" src= "/liandong/js/liandong.js" ></script>