码迷,mamicode.com
首页 > 其他好文 > 详细

EL基础 pageContext 获取当前的项目名称

时间:2017-12-06 18:13:02      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:log   sse   获取   tin   cal   elements   点击   function   tom   

礼悟:
     好好学习合思考,尊师重道存感恩。叶见寻根三返一,江河湖海同一体。
          虚怀若谷良心主,愿行无悔给最苦。读书锻炼强身心,诚劝且行且珍惜。




       javaEE:7           
       javaSE:1.8
          JSTL:1.2.2  
      server:tomcat 8.5
    browser:Chrome/Firefox
             os:windows7 x64
            ide:MyEclipse 2017

 

index.jsp

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP ‘index.jsp‘ starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <form action="${pageContext.request.contextPath}/MyJsp.jsp" method="post">
    	<input type="text" value="jizuiku" name="name"/>
    	<input type="text" value="taiji" name="hobby"/>
    	<input type="text" value="cook" name="hobby"/>
    	<input type="submit" value="提交"> 
    </form>
    
    <a href="${pageContext.request.contextPath}/MyJsp.jsp">点击超链接</a>
  </body>
</html>

 

浏览器查看该页面
技术分享图片

 

查看该页面的源代码

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="http://localhost:8081/Day12/">
    
    <title>My JSP ‘index.jsp‘ starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  <script>"undefined"==typeof CODE_LIVE&&(!function(e){var t={nonSecure:"56731",secure:"56736"},c={nonSecure:"http://",secure:"https://"},r={nonSecure:"127.0.0.1",secure:"gapdebug.local.genuitec.com"},n="https:"===window.location.protocol?"secure":"nonSecure";script=e.createElement("script"),script.type="text/javascript",script.async=!0,script.src=c[n]+r[n]+":"+t[n]+"/codelive-assets/bundle.js",e.getElementsByTagName("head")[0].appendChild(script)}(document),CODE_LIVE=!0);</script></head>
  
  <body data-genuitec-lp-enabled="false" data-genuitec-file-id="wc1-1" data-genuitec-path="/Day12/WebRoot/index.jsp">
    <form action="/Day12/MyJsp.jsp" method="post" data-genuitec-lp-enabled="false" data-genuitec-file-id="wc1-1" data-genuitec-path="/Day12/WebRoot/index.jsp">
    	<input type="text" value="jizuiku" name="name"/>
    	<input type="text" value="taiji" name="hobby"/>
    	<input type="text" value="cook" name="hobby"/>
    	<input type="submit" value="提交"> 
    </form>
    
    <a href="/Day12/MyJsp.jsp">点击超链接</a>
  </body>
</html>

 

 

 


学习资源:itcast和itheima视频库。如果您有公开的资源,可以分享给我的话,用您的资源学习也可以。
博文是观看视频后,融入思考写成的。博文好,是老师讲得好。博文坏,是 给最苦 没认真。

EL基础 pageContext 获取当前的项目名称

标签:log   sse   获取   tin   cal   elements   点击   function   tom   

原文地址:http://www.cnblogs.com/jizuiku/p/7993460.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!