JSTL setup

Step 1: write different web.xml base on different version of the java EE web stack(Servlet/JSP)  reference to page

The most important thing is to figure out what version of the Java EE web stack (Servlet/JSP) you are using. There are 2 aspects that factor into this:

  • What version of Java EE / servlet spec does your servlet container support?
  • What version of Java EE / servlet spec have you declared in your deployment descriptor (web.xml)?

Here’s an example of what to look for in web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 
  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
  id="WebApp_ID" version="2.5">
  <display-name>web-app-25</display-name>
...
</web-app>

You can see the ‘version=”2.5″‘ designation in here. This means that within this web application, we will be able to use JSP 2.1 and JSTL 1.2 features.

 

Step 2: download JSTL jar file from http://repo1.maven.org/maven2/javax/servlet/jstl/1.2/  and put it to WEB-INF\lib folder.

 

Step3: write JSP with JSTL

 

<%@ page contentType="text/html; charset=utf-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head>
<title>test asdf jstl</title>
</head>
<body>
<c:out value="hello JSTL"></c:out>
</body>
</html>

 

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值