el

Item value in JSTL foreach loop not working in Portlet

寵の児 提交于 2019-12-06 07:41:24
Given the following Portlet Code: ArrayList nameList = new ArrayList(); nameList.add("Willi Willisch"); nameList.add("Seppi Seppisch"); renderRequest.setAttribute("names", nameList); And the following JSP Code: <c:forEach var="aName" items="${names}"> <tr> <td>${aName} </td> </tr> </c:forEach> Prints out: ${aName} ${aName} I don't have any clue why a $(aName) isn't evaluated. The forEach loops works, because ${aName} is printed out twice .... <c:out value="${aName}"/> works!! But shouldn't ${aName} work aswell? Thus, "EL in template text" doesn't work? That can have one or more of the

Using EL in attribute of composite component

醉酒当歌 提交于 2019-12-06 06:32:35
My JSF custom component code: <composite:interface name="translation"> <composite:attribute name="fieldName"/> <composite:attribute name="required" default="true" /> </composite:interface> <composite:implementation> <h:inputText required="#{cc.attrs.required}" requiredMessage="Please enter #{cc.attrs.fieldName} in english"/> </composite:implementation> This works fine if I specify the required attribute as follows: <comp:translation fieldName="myTranslation" required="true" /> But does not work if I give EL in required attribute of my composite component: <comp:translation fieldName=

How to use square bracket in EL JSF

浪尽此生 提交于 2019-12-06 06:26:26
问题 I have seen people using square bracket in JSF, and I am not sure if I understand its use correctly. So maybe an JSF guru can help me understand it 1.So let say I have this #{bean.x} and x is a two dimensional array (x[][]), how do I display x[0] using EL? I would imagine that I need to use square bracket in this case. I think I use #{bean.x[0]} , but I got exception. 2.The second scenario is from BalusC code Pass Argument to a composite-component action attribute <composite:interface>

Thymeleaf: Can I use messages inside expressions

不想你离开。 提交于 2019-12-06 05:51:32
I am using Thymeleaf 3 within a Spring Boot application. Currently I am in a situation where I want to use a message expression inside an EL expression (Spring EL). First use case: trim the message data:title="${#{message.key}.trim()} Second use case: conditionally create an attribute with a message as its value data:title="${condition ? #{message.key} : ''} Both examples will produce a syntax error, because #{ is not an allowed start of an expression. Any ideas how to achieve what I want? In both cases you'll want to use the #messages utility object. data:title="${#messages.msg('key').trim()}

NumberFormatException when accessing collection in JSP EL

坚强是说给别人听的谎言 提交于 2019-12-06 05:21:47
I'm using spring MVC and I want to access to my Employe's roles from my jsp file but i have this error. Here is my controller and my jsp file and also my entities : AdminStockController : @RequestMapping(value="/saveEmploye") public String enregistrerE(@Valid Employe e,BindingResult bindingResult,Model model, @RequestParam(value="roleEmploye") Long idR){ if(bindingResult.hasErrors()){ model.addAttribute("employes", metier.getAllEmployes()); return "adminEmploye"; } metier.addEmploye(e); metier.addRoleToEmploye(e.getIdEmploye(), idR); model.addAttribute("employe", new Employe()); model

Backbone - this.$el vs $(this.el)?

梦想的初衷 提交于 2019-12-06 03:49:42
I've been using this.$el all over my backbone app like so: render: function() { this.$el.html(this.template); }, then I saw code online that uses: render: function() { var dict = this.model.toJSON(); var html = this.template(dict); $(this.el).append(html); } What is the difference between the two? If you call $(this.el), your just keep executing the jquery selector to get the same jquery object. '$el' is the cached version of $(this.el) 来源: https://stackoverflow.com/questions/19013531/backbone-this-el-vs-this-el

How to get id of current component in EL

独自空忆成欢 提交于 2019-12-06 03:06:42
I'm working with JSF and PrimeFaces, but I need to get the value of the id of a component. Because I'm building dinamycally panels with diferent id, to show a the panel I need to compare if is the current panel, then show it. For example if I've the next panel <p:outputPanel id="#{bean.getID}" autoUpdate="true" renderer=#{@this.id == bean.currentPanel} > </p:outputPanel> And Bean public class Bean(){ private int numberPanels =0; private int currentPanel = 0; public int getID(){ //...a process that return different ID } // getter's and setters } Obviously, @this.id doesn't work. So, how to get

How to put “new line” in JSP's Expression Language?

天涯浪子 提交于 2019-12-06 02:54:46
问题 What would be right EL expression in JSP to have a new line or HTML's <br/> ? Here's my code that doesn't work and render with '\n' in text. <af:outputText value="#{msg.TCW_SELECT_PART_ANALYSIS}\n#{msg.TCW_SELECT_PART_ANALYSIS2}"/> 回答1: Since you want to output <br /> , just do: <af:outputText value="#{msg.TCW_SELECT_PART_ANALYSIS}<br />#{msg.TCW_SELECT_PART_ANALYSIS2}" escape="false" /> The attribute escape="false" is there to avoid the <br /> being HTML-escaped. You can even display the two

How to programmatically evaluate EL in a managed bean

一世执手 提交于 2019-12-06 00:03:34
I would like to add a simple template language to my application based on Seam / JSF to let the users compose their own email. Since I don't want to create a new parser, I would like to use the Unified Expression Language setting the context all by myself. How can I do that? If you're sitting inside the JSF context, then just use Application#evaluateExpressionGet() to programmatically evaluate a string containing EL expressions. String unevaluatedString = convertMailTemplateToStringSomehow(); FacesContext context = FacesContext.getCurrentInstance(); String evaluatedString = context

Access raw expression of ValueExpression attribute to taglib component

倖福魔咒の 提交于 2019-12-05 21:49:31
Can I access the expression string of a ValueExpression passed as attribute value to my taglib component? My goal is to programmatically derive missing attribute values from it. In this case I'm trying to avoid having to repeat an attribute as a literal. now: <a:columnText title="name" value="#{entity.name}" sortBy="entity.name" /> desired: <a:columnText title="name" value="#{entity.name}" /> -taglib.xml <tag> <tag-name>columnText</tag-name> <source>column-text.xhtml</source> <attribute> <name>value</name> <required>true</required> </attribute> <attribute> <name>title</name> <required>false<