1.jsp基本构成:指令标签,HTML标记语言,注释,嵌入java代码,jsp动作标签;
详:https://blog.youkuaiyun.com/napoay/article/details/50754362
2.动态导入和静态导入
使用动作标签jsp:include page=”modifyBox.jsp” flush=”true”/>动态导入;
若page=”.html”,生成一个servlet;以req,res相连;
若page=”.jsp”,生成两个servlet;以req,res相连;
动态导入时,被包含的jsp页面中的3个指令标签(page,include,taglib)不起任何作用;
使用编译指令<%@include file=”..home/include.jsp” %>静态导入
file=”.html”或者file=”.jsp”,都只生成一个文件;故被包含的jsp页面中不要使用,标签,另外变量名和方法名不要冲突;
静态导入时,引用的3个编译指令(page,include,taglib)会起作用;
注:jsp页面引入jsp,css,js 目录的路径 webapp下面的路径平级 WEB-INF 和static平级;
详:https://blog.youkuaiyun.com/zfl589778/article/details/56494523
3.动作标签
4.九大内置对象
九大内置对象,四大作用域:http://blog.youkuaiyun.com/zhangzeyuaaa/article/details/44560921
//servletContext对象
http://localhost:8080/news/main/list.jsp
ServletContext servletContext=FilterConfig filterConfig.getServletContext();
==(HttpServletRequest)request.getServletContext();
//pageContext对象
${pageContext.request.contextPath }==servletContext.getContextPath();
值为:/news
//request对象
request.getServletPath() /mian/list.jsp
request.getRequestURL() http://localhost:8080/news/main/list.jsp
request.getRequestURI() /news/main/list.jsp
request.getRealPath() F:\Tomcat 6.0\webapps\news\test
本文详细介绍了JSP的基本构成元素,包括指令标签、HTML标记语言等,并对比了动态导入与静态导入的区别及应用场景。同时,文章还探讨了JSP页面中九大内置对象及其作用范围。
9204

被折叠的 条评论
为什么被折叠?



