javaweb-5-JSTL

1.JSP常用标签——JSTL标签和EL表达式

https://www.cnblogs.com/Qian123/p/5308951.html

2.(JSTL)jstl.jar和standard.jar的下载地址与使用,注意不要下载1.0版,看清引入语句taglib

http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/jakarta-taglibs-standard-1.1.2.zip 

解压这个jakarta-taglibs-standard-1.1.2.zip里面的lib目录下就是jstl用到的jstl.jar和standard.jar

在本工程的web/WEB-INF下新建一个lib目录,将jstl.jar和standard.jar放进去,我用的是Intellij iDEA

表单提交代码:

<%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 2019/11/12
  Time: 22:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>JSTL</title>
</head>
<body>
<form action="JSTLshow_EL.jsp" method="get" name="user">
    <div>姓名:<input type="text" name="username"></div>
    <div>密码:<input type="password" name="password"></div>
    <input type="submit" value="登录">
</form>
</body>
</html>

展示提交代码:

<%--
  Created by IntelliJ IDEA.
  User: Admin
  Date: 2019/11/12
  Time: 23:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Title</title>
</head>
<body>
<div>姓名:<c:out value="${param.username}"></c:out></div>
<div>密码:<c:out value="${param.password}"></c:out></div>

<%--显示0-10的平方--%>
<br/>显示0-10的平方:<br/>
<c:forEach var="x" begin="0" end="10" step="1">
    <tr>
        <td><c:out value="${x}"/></td>
        <td><c:out value="${x*x}"/></td>
    </tr>
    <br>
</c:forEach>

</body>
</html>

ERROR1:

(解决)无法在web.xml或使用此应用程序部署的jar文件中解析绝对uri:[http://java.sun.com/jsp/jstl/core]

https://blog.csdn.net/weixin_42634260/article/details/89931226

参考链接:

在Intellij Idea中使用JSTL标签库

https://www.cnblogs.com/junhuawang/p/6953177.html

发布了65 篇原创文章 · 获赞 8 · 访问量 8173

猜你喜欢

转载自blog.csdn.net/qq_25799253/article/details/103040671
今日推荐