el

Difference between client id generated by component.clientId and p:component()

柔情痞子 提交于 2019-12-21 20:17:59
问题 I am trying to retrieve the client id of a h:panelGroup that is within a p:dataList. I tried 2 approaches: 1.Using component.clientId e.g: <h:panelGroup id="listItem"> <h:outputText value="#{component.clientId}" /> </h:panelGroup> 2.Using p:component() e.g: <h:panelGroup id="listItem"> <h:outputText value="#{p:component('listItem')}" /> </h:panelGroup> Please note that this panel group is within a datalist. Now, the client ids generates in both the cases is different. (1) does not have the

Combining a string with the value of a variable to be the name of another variable in EL

泄露秘密 提交于 2019-12-21 07:37:39
问题 I want to do something like this: <display:table name="${summary${index}}"> But it does not work throws exception: "${summary${selChrm}}" contains invalid expression(s). I would like the user to use a drop down list to choose a selection and put in the variable index. Then the table will display the corresponding list of javabean objects, ie. named summary01, summary02, etc. How can I do that? Thanks in advance. Update : Thanks guys. The problem is with the nested EL. I tried to use <display

Using && in EL results in error: The entity name must immediately follow the '&' in the entity reference

孤街醉人 提交于 2019-12-20 19:05:32
问题 I'm trying to use a conditional expression in an el expression used in jsf, but it does not work. <h:outputText value="#{(sel.description !=null) && (sel.description !='') ? sel.description : 'Empty description'} - "/> but it does not work, the compiler says: Error Traced[line: 118] The entity name must immediately follow the '&' in the entity reference. Do you have any suggestions? Thank you! 回答1: You seem to be using Facelets (which is perfectly fine). It's however a XML based view

How to retrieve value of a ui:param in the backing bean

本秂侑毒 提交于 2019-12-20 10:54:41
问题 I'm passing a parameter p1 to another page page.xhtml : <ui:include src="page.xhtml"> <ui:param name="p1" value="#{someObject}"/> </ui:include> Is this possible to evaluate #{p1} inside @PostConstruct method of the backing bean of page.xhtml ? Using the following piece of code, #{p1} cannot resolve: FacesContext currentInstance = FacesContext.getCurrentInstance(); currentInstance.getApplication().evaluateExpressionGet(currentInstance, "#{p1}", String.class); Why do I need this? I'm using an

Check if parameter exists in Expression Language [duplicate]

╄→尐↘猪︶ㄣ 提交于 2019-12-20 09:12:45
问题 This question already has answers here : Evaluate empty or null JSTL c tags (8 answers) Closed 3 years ago . <c:if test="${param.username}" > </c:if> How do I check if param.username exists?? 回答1: Use the not empty check. <c:if test="${not empty param.username}" > </c:if> Edit: If you have a parameter of the form ?username (no value), it is safer to use ${param.username ne null} 回答2: If you want to check if parameter exists, just test if it is not null, in your case: <c:if test="${param

Parameters in EL methods

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-20 07:12:53
问题 I want to use a method in JSP using EL that has a parameter. But EL doesn't support parameters in methods. Actually I want to show a table, which has a field that output a list of values in one cell. For every cell this list will be different, it depends on parameter. How can I do this using EL? I have tried this, but is says that it can not cast Integer to String in <c:set var="group" value="${entrant.idGroup}" /> where entrant.idGroup return int value <c:forEach var="entrant" items="${bean

Parameters in EL methods

限于喜欢 提交于 2019-12-20 07:09:02
问题 I want to use a method in JSP using EL that has a parameter. But EL doesn't support parameters in methods. Actually I want to show a table, which has a field that output a list of values in one cell. For every cell this list will be different, it depends on parameter. How can I do this using EL? I have tried this, but is says that it can not cast Integer to String in <c:set var="group" value="${entrant.idGroup}" /> where entrant.idGroup return int value <c:forEach var="entrant" items="${bean

Using <c:when> with an enumeration

♀尐吖头ヾ 提交于 2019-12-20 05:25:08
问题 I have a JSP portlet that needs to display different markup according to the value of a bean's property which is of an enumeration type public enum State { CANCELED, COMPLETED } I used the following code to do the switch <c:choose> <c:when test="#{item.state == 'COMPLETED'}"> <img src="ok.gif" /> </c:when> <c:when test="#{item.state == 'CANCELED'}"> <img src="ko.gif" /> </c:when> </c:choose> but it doesn't work. Interestingly enough, it returns false in both cases. The item object (inside an

java.lang.NoSuchMethodError:javax.servlet.jsp.PageContext.getELContext()Ljavax/el/ELContex

谁说我不能喝 提交于 2019-12-20 04:12:56
问题 i have this code which is not working. <jsp:useBean id="abbreviationlist" class="AbbreviationListType"/> <jsp:setProperty name="abbreviationlist" property="id"/> <table> <c:forEach items="${abbreviationlist.list}" var="abbreviation"> </c:forEach> </table> and i have the class AbbreviationListType with set and get methods for the list- get singnature is = public List<AbbreviationType> getList() can someone please point out what i am doing wrong ? cause this doesnt work and i get this stack

Error using JSTL XML taglib - attribute xml does not accept any expressions

我的梦境 提交于 2019-12-20 04:11:45
问题 I'm getting the following error when I try to use the JSTL XML taglib: /server-side-transform.jsp(51,0) According to TLD or attribute directive in tag file, attribute xml does not accept any expressions I'm looking into the tlds etc, but if anyone knows what this is an can save me some time, it'd be appreciated! If it helps, I get this error running the example code <c:set var="xml"> <paragraph> This document uses <bold>unusual</bold> markup, which we want to replace with <bold>HTML</bold>. <