jstl

JSTL标签之<c:choose><c:when><c:otherwise>标签

夙愿已清 提交于 2020-01-11 13:24:38
假设是JSTL1.1版本号,使用<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 否则的话,假设是JSTL1.0版本号,使用<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>,另外须要在项目中导入JSTL和standard两个jar包。 <c:choose>、<c:when>和<c:otherwise>标签的使用必须符合下面语法规则: <c:when>和<c:otherwise>不能单独使用。它们必须位于<c:choose>父标签中。 在<c:choose>标签中能够包括一个或多个<c:when>标签。 在<c:choose>标签中能够不包括<c:otherwise>标签。 在<c:choose>标签中假设同一时候包括<c:when>和<c:otherwise>标签,那么<c:otherwise>必须位于<c:when>标签之后。 假设须要推断session中的某个对象是否非空<c:when test="${!empty session.user}"> 同理。假设要推断空<c:when test="${empty session.user}"> 来源: https://www.cnblogs.com/llguanli/p/8888712

Java进阶-11.JSP、EL、JSTL

半城伤御伤魂 提交于 2020-01-11 06:32:22
一、JPS 1.java 服务器页面 jsp全称java server pages(java服务器页面),本质是一个servlet。它是在传统的网页HTML文件(*.htm,*.html)中插入Java程序段(Scriptlet)和JSP标记(tag),从而形成JSP文件,后缀名为(*.jsp)。将内容的生成和显示进行分离,用JSP技术,Web页面开发人员可以使用HTML或者XML标识来设计和格式化最终页面,并使用JSP标识或者小脚本来生成页面上的动态内容。 2.jsp脚本 <%....%> java代码片段 <%=..%> 输出表达式,相当于out.print() <%!...%> 声明成员变量 3.jsp指令 格式:<%@ 指令名称 属性="值" 属性="值"%>,用于指示JSP执行某些步骤,用于指示JSP表现特定行为。 例如:<%@page language="java" import="java.util.*" pageEncoding="utf-8"%> jsp指令的分类: page -声明jsp页面的一些属性、 include -静态包含、 taglib -导入标签库。 注意:一个页面中可以出现多个指令,指令可以放在任意位置,一般都放在jsp页面最上面。 1)page指令 重要属性: contentType:设置响应流的编码,及通知浏览器用什么编码打开

row counter for html table row

对着背影说爱祢 提交于 2020-01-11 02:08:07
问题 I have HTML table in JSF web application. I am generating rows dynamically using <ui:repeat> . I want a counter for each row. How can I get this? Any help? Ssimilar to rowKeyVar in rich faces dataTable. 回答1: Since you are using richfaces, you can do it with its iteration tag ( <a4j:repeat> ), which is a bit more appropriate than using <c:forEach> , and which is like an extension to <ui:repeat> <table> <a4j:repeat value="#{bean.list}" var="item" rowKeyVar="idx"> <tr> <td><h:outputText value="#

JSP doesn't open CSS, Images and JS

99封情书 提交于 2020-01-10 04:35:11
问题 I'm trying to put CSS, JS and IMGs on my JSP, but doesn't work, it's strange because I use c:url and "jstl/core" I'm use JSP, jstl and servlet, no frameworks. <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>clientes atuantes</title> <link rel="stylesheet"

How to set a Map value in h:inputText

笑着哭i 提交于 2020-01-10 04:12:23
问题 I'm struggling to implement a fairly trivial functionality with JSF which involves dynamically displaying the content of a nested map on a page and editing capabilities for its values. But it has turned out that the MappedValueExpression$Entry that you get when iterating over a map with c:forEach is not writable! <c:forEach items='#{inflectionBean.word.inflectionalForms}' var="number" > <p:fieldset legend="#{number.key}"> <c:forEach items="#{number.value}" var="case" > <p:panel header="#{case

Accessing java-based DOM tree directly from JSF/richfaces

﹥>﹥吖頭↗ 提交于 2020-01-10 04:10:08
问题 Based on this question I have a couple of other questions: 1) the map in this question which is made available to jsf is actually one of a number, so i'm now not sure what the backing bean method's return type should now be. if i modify it's current Array<String> return type to Array<Map Integer, Map<String, String[]>>> (or ArrayList<Map Integer, Map<String, String[]>>> ?) would it just be a case of further nesting the iterator on the jsf side? Trouble is an Array/ArrayList isn't a Map and I

How to use JSTL in a GWT project?

∥☆過路亽.° 提交于 2020-01-09 11:12:19
问题 i am building a GWT project, with GWT-2.0.3 and eclipse plugin. well, first i tried, JSTL1.2 and servlet 2.5, i do add jstl-1.2.jar to war/WEB-INF/lib in web.xml, i use: <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" 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"> in the jsp page, i use: <

Jstl for each loop items attribute use another variable not working

允我心安 提交于 2020-01-07 09:15:10
问题 getResults is list case 1 : <c:forEach items="${getResults} var="s1"> ${s1} </c:forEach> case 2 : <c:set var="res" value="getResults" /> <c:forEach items="${res} var="s2"> ${s2} </c:forEach> In above code case (1) is printing list of results fine but in case (2) just res is printing Iam trying to print results using case 2 please help me out that is need for my project 回答1: <c:set var="res" value="getResults" /> This sets the res variable to the string "getResults". If you want it to be a

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be res

大憨熊 提交于 2020-01-07 09:05:13
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be res... 看网上的解决方案,有的说是jstl的版本问题,1.0版本引入使用的时候加的uri不带有jsp路径的,1.2的带有/jsp路径,还有的说是依赖冲突的问题,最后尝试了都不行。 后来试着: 去maven的本地仓库中找到jstl的jar包,复制到tomcat的lib文件夹下面 ,就可以了。 来源: oschina 链接: https://my.oschina.net/u/2763509/blog/1808346

Custom tag that evaluates its body based on the variables of the tag

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-07 03:24:25
问题 Ok, now this is something for the hard core JSTL wizards I guess ;-) I would like to have a tag whose body does not substitute the variables of the surrounding page. It should only take the variables into account that have been specified in the body of the tag or in the tag itself like this: <c:set var="outsideVar" value="outside value"/> <a:component> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <div data-component-id="9"> <c:set var="componentId" value="9"/> <c:set