熟悉了下JSP裏面的Java代碼

概述:基礎知識仍是比較薄弱啊,今天在作項目都有點不記得了,仍是寫下來以防萬一吧html

<%@ page import="java.io.IOException" %>java

<%--ajax

  Created by IntelliJ IDEA.瀏覽器

  User: Administrator微信

  Date: 15-1-19異步

  Time: 上午11:31ide

  To change this template use File | Settings | File Templates.this

--%>url

<%@ page contentType="text/html;charset=UTF-8" language="java" %>spa

<%

    String header = (String)request.getAttribute("mpHeader");

    String id = (String)request.getAttribute("id");

    if(header.indexOf("MicroMessenger")==-1){//判斷是不是微信瀏覽器

        try {

            response.sendRedirect("mp_ajax_vcf.html?id="+id);//若是是就異步跳轉,若是不是就執行接下去

        } catch (IOException e) {

            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.

        }

    }

%>

<html>

<head>

    <title>通信錄</title>

<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">

</head>

<body style="background:url(<%=request.getContextPath()%>/p_w_picpaths/weixintype.jpg) top right no-repeat rgba(0,0,0,.8);background-size: 290px;" >

//<%=request.getContextPath()%>獲取項目根目錄

</body>

</html>

相關文章
相關標籤/搜索