Analysis of jsp interface inheritance or not, jsp INTERFACE ANALYSIS

Source: Internet
Author: User

Analysis of jsp interface inheritance or not, jsp INTERFACE ANALYSIS

Page Introduction
$ {PageContext. request. contextPath} is the page context path;
It can also be implemented using js;

<Script type = "text/javascript" src = "$ {pageContext. request. contextPath}/js/student_evaluation/studentInfo. js "> </script> is equivalent to: <script type =" text/javascript "id =" studentInfoJS "> </script> <script type =" text/javascript "> document. getElementById ('studentinfojs '). src = basePath + 'js/student_evaluation/studentInfo. js'; </script>

 

You can write the following code on the basic page;

Var basePath = "<% = basePath %>"; implements global PATH variables, but $ {pageContext. request. contextPath} can be replaced completely;

<% @ Page language = "java" contentType = "text/html; charset = UTF-8"
PageEncoding = "UTF-8" %>
<% @ Taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c" %>
<%
String path = request. getContextPath ();
String basePath = request. getScheme () + ": //" + request. getServerName () + ":" + request. getServerPort ()
+ Path + "/";
%>
<! DOCTYPE html>
<Html>
<Script type = "text/javascript">
Var basePath = "<% = basePath %> ";
</Script>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<Title> Student Score Information </title>
<Link rel = "stylesheet" type = "text/css"
Href = "<%= basePath %> jquery/jquery. bsgrid-1.37/builds/merged/bsgrid.all.min.css">
<Script type = "text/javascript"
Src = "<% = basePath %> jquery/jquery-1.12.3.min.js"> </script>
<Script type = "text/javascript"
Src = "<% = basePath %> jquery/jquery. bsgrid-1.37/builds/js/lang/grid. zh-CN.min.js"> </script>
<Script type = "text/javascript"
Src = "<% = basePath %> jquery/jquery. bsgrid-1.37/builds/merged/bsgrid. all. min. js"> </script>
<Script type = "text/javascript" src = "<% = basePath %> jquery/jquery. bsgrid-1.37/builds/js/util. min. js"> </script>
</Head>
<Body>

</Body>
</Html>

Use the following statement:

<jsp:include page="/view/base.jsp" flush="true" />

The critical moment should be as follows:

<script type="text/javascript">    var pp = "${pageContext.request.contextPath}";    alert(pp);</script>

However, the introduced js file does not have a value, so inheritance is necessary.

Well, write it here first. If you have any questions, please contact us!

 

 




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.