刚学JSP页面开发,把知识点整理一下。

-----------------------------------------------------------------------

JSP语法
http://www.runoob.com/jsp/jsp-syntax.html

<% 代码片段 %>
<% out.println("Hello World!"); %>

<%! 变量声明 %>
<%! int i = 0; %>

<%= 表达式 %>
<%= i %>

<%-- 注释 --%>
<%-- 注释内容不会被发送至浏览器 --%>

三种JSP指令
<%@ page ... %> 定义页面依赖属性
<%@ include ... %> 包含其他文件
<%@ taglib ... %> 声明要使用的标签库

EL表达式
http://www.runoob.com/jsp/jsp-expression-language.html
${expr}

JSP标准标签库(JSTL)
http://www.runoob.com/jsp/jsp-jstl.html

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<table>
<c:forEach var="user" items="${users}">
<tr>
<td>${user.id}</td>
<td>${user.name}</td>
</tr>
</c:forEach>
</table>

Spring’s JSP Tag Library
https://docs.spring.io/spring/docs/5.1.5.RELEASE/spring-framework-reference/web.html#mvc-view-jsp-tags
https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/spring-tld.html
新版文档不太好看,可以参考老版的。

<spring:url value="/users/${user.id}" var="userUrl" />
<spring:url value="/users/${user.id}/delete" var="deleteUrl" />
<spring:url value="/users/${user.id}/update" var="updateUrl" />

<button class="btn btn-danger" onclick="this.disabled=true;post('${deleteUrl}')">Delete</button>

Spring’s form tag library
https://docs.spring.io/spring/docs/5.1.5.RELEASE/spring-framework-reference/web.html#mvc-view-jsp-formtaglib
https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/html/spring-form-tld.html

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<form:form modelAttribute="user" action="/users">
<table>
<tr>
<td>id:</td>
<td><form:input path="id"/></td>
</tr>
<tr>
<td>name:</td>
<td><form:input path="name"/></td>
</tr>
<tr>
<td colspan="2">
<input type="submit" value="Save Changes"/>
</td>
</tr>
</table>
</form:form>

JSP页面开发知识点整理的更多相关文章

  1. 170820-关于JSP页面的知识点

    1.JSP [1] 简介 > HTML - HTML擅长显示一个静态的网页,但是不能调用Java程序. > Servlet - Servlet擅长调用Java程序和后台进行交互,但是它不擅 ...

  2. BBS 页面搭建知识点整理

    表关系图及建表 from django.db import models # Create your models here. from django.contrib.auth.models impo ...

  3. JSP页面开发规范案例

    添加 <%@ page language="java" contentType="text/html; charset=utf-8" pageEncodi ...

  4. MyEclipse开发平台下如何将新建的JSP页面的默认编码格式设置为UTF-8--JSP

    新建的JSP页面原始的编码格式是ISO-8859-1(测试的MyEclipse版本为2014),它是不支持中文,在预览JSP页面时会出现乱码的现象.当然自己手动改一下编码格式就好了,但是那太过麻烦,每 ...

  5. 网站开发进阶(三十七)JSP页面跳转问题解决

    JSP页面跳转问题解决 PS:本篇博文质量欠佳,仅供个人学习之用. 前言 在做Web开发时,对别人的应用(jsp+servlet)进行服务器部署时出现了页面跳转无效的情况.但是项目在本地未出现此状况. ...

  6. 网站开发进阶(三十五)JSP页面中的pageEncoding和contentType两种属性

    JSP页面中的pageEncoding和contentType两种属性 本文介绍了在JSP页面中经常用的两种属性,分别是pageEncoding和contentType,希望对你有帮助,一起来看. 关 ...

  7. web开发jsp页面遇到的一系列问题

    一:web总结 1.jsp页面知识点巩固 1.1字符串数字格式化转换 <%@ taglib prefix="fmt" uri="http://java.sun.co ...

  8. 网站开发进阶(十一)如何将一个jsp页面嵌套在另一个页面中

    如何将一个jsp页面嵌套在另一个页面中 这个在做网页中常要用到,有些通用的内容可集中放在一个页面文件中,其它要用到这些内容的页面只需要包含(引用)这个通用文件即可.这样便于维护,如果有很多网页,当通用 ...

  9. JSP页面传递参数乱码问题整理

    1.JSP页面之间传递中文参数乱码 (1).a.jsp中正常传递参数,b.jsp 中 <% String projectName = new String(request.getParamete ...

随机推荐

  1. Binary Watch二进制时间

    [抄题]: A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the b ...

  2. Code First 之类继承

    关于Entity Framework 的code first 模式,相信大家都不陌生了.本文就来看看实体继承在 codefirst里的用法. 第一步  添加 code first 的环境 这里为了方便 ...

  3. 使用mybatis提供的各种标签方法实现动态拼接Sql。这里演示where标签和if标签实现使用姓名的模糊查询和性别查询用户列表,当用户没有选择姓名以及性别时查询出所有的记录。

    1.需求: 使用姓名的模糊查询和性别查询用户列表,当用户没有选择姓名以及性别时查询出所有的记录. 2.在UserMapper接口中定义方法: public List<User> findU ...

  4. dwz监听日期变化,dwz日期控件onchange不起作用,dwz框架时间控件不支持onchange事件

    转载自:http://blog.csdn.net/sp308036654/article/details/50638348 <input type="text" class= ...

  5. Java Thread系列(九)Master-Worker模式

    Java Thread系列(九)Master-Worker模式 Master-Worker模式是常用的并行设计模式. 一.Master-Worker 模式核心思想 Master-Worker 系统由两 ...

  6. wmi收集系统信息 发送到服务器打印

    #include "WMIManager.h" #include <vector> #include <string> #include <boost ...

  7. ASP.Net Web API 输出缓存(转)

    出处:http://www.cnblogs.com/ajilisiwei/p/6112078.html 原文的转载地址:http://www.strathweb.com/2012/05/output- ...

  8. Oracle 11g PL/SQL Developer登入时候报ORA-12638: 身份证明检索失败的解决办法(安装了6遍,吐血之作)

    1.报这个错的时候会弹出一个对话框,先点击终止 2.然后汇报出这个是错误的窗口,然后点击确认,但是不要关这个安装窗口也不要其他不必要操作,窗口最小化 3.找到product文件夹,一般在app文件里 ...

  9. SDWebImage从缓存中获取图片

      if ([[SDImageCache sharedImageCache] imageFromKey:sort.imageUrl]) {         [cell.photoImageView s ...

  10. 关于wcf配置未启动net.tcp监控导致无法访问wcf

    在服务里面启动NetTcpActivator和NetTcpPortSharing服务