zoukankan      html  css  js  c++  java
  • 20151120 jsp相关

    jsp 声明表示、代码片段及引用
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    
    <jsp:include page="test.jsp"></jsp:include>
    
    <%@include file="test.jsp" %>
    
    显示汉字!!!
    
    </body>
    </html>
    Jsp 动作--包含文件
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    
    <jsp:forward page="index.jsp"/>
    
    </body>
    </html>
    Jsp 动作--请求转发
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    
    <form action="test5.jsp">        
    用户ID:
    <input name="id" type="text" width="30 "/>
    
    <input type="submit" value="提交"/>
    
    </form>
    
    </body>
    </html>
    jsp--内置对象--页面请求 - 主页面
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <%
    
    String id = request.getParameter("id");
    //通过传过来的 name 的 id 来获取收到的信息
    if ( id == null)        // 检查传过来的 name 是否是 id 这个名字    
    {
        id = "空";
    }
    else if(id == "")        //id内 内容是否为空  是否是空字符串
    {
        id = "空字符串";
    }
    
    %>
    </head>
    <body>
    
    获取到的ID:<%=id %>
    
    </body>
    </html>
    jsp--内置对象--页面请求 - 跳转到的页面

  • 相关阅读:
    selenuim
    selenium
    selenium
    selenium
    【OSG】 报错:丢失osg100-osgDB.dll
    无法启动此程序,因为计算机中丢失 zlibd.dll【OSG】
    无法打开mfc120.lib
    jquery中的$("#id")与document.getElementById("id")的区别
    arcgis api for javascript 各个版本的SDK下载
    ajax与servlet交互(通过JSON),JAVA的arraylist传到前端的方法
  • 原文地址:https://www.cnblogs.com/name-hanlin/p/4982385.html
Copyright © 2011-2022 走看看