el

Dynamically assigning IDs to tags using an EL variable

依然范特西╮ 提交于 2020-01-12 23:28:45
问题 I want to loop over a number of "guests" and insert an id dynanimally <ui:repeat value="#{guestList}" var="guest"> <p:inputText id="firstname_#{guest.uniqueID}" value="" label="Firstname" /> <p:message for="firstname_#{guest.uniqueID}" /> </ui:repeat> The problem is, that the <p:message /> cannot resolve firstname_#{guest.uniqueID} javax.faces.FacesException - Cannot find component "firstname_1" in view. at org.primefaces.component.message.MessageRenderer.encodeEnd(MessageRenderer.java:41) It

JavaScript variable in EL expression

丶灬走出姿态 提交于 2020-01-11 12:55:23
问题 In my servlet I'm sending many values back to JSP page by for cycle like this: protected void doGet(HttpServletRequest request, HttpServletResponse response){ for (int i = 0; i < veryBigNumber; i++){ if (something){ request.setAttribute("value" + i, "true"); else{ request.setAttribute("value" + i, "false"); } } And in JSP I would like to read them in the same way with JavaScript and EL: <script> for (var i=0; i < veryBigNumber; i++){ if ("${value + (i)}" == "true"){ doSomething; } else{

EL autocomplete / code assist with Eclipse and Spring Beans

随声附和 提交于 2020-01-11 12:23:32
问题 In Eclipse, auto-complete for JSF / EL only works for legacy @ManagedBean or CDI beans ( @Named ), at least when using the JBoss tools plugin. See also: EL proposals / autocomplete / code assist in Facelets with Eclipse or Eclipse autocomplete (content assist) with facelets (jsf) and xhtml or Content Assist for JSF2 + CDI (weld) beans + Eclipse Helios => Summing-up: - install JBoss tools JSF + CDI (http://download.jboss.org/jbosstools/oxygen/stable/updates/, JBoss Web and Java EE / JBoss

JSF call message bundle : EL in EL

泄露秘密 提交于 2020-01-11 07:18:09
问题 I am working in JSF2 and I have displayed a resource bundle to display messages from property files. The configuration seems to be great (if I call #{msg.risk} "toto" is displayed) messages.properties ... COMPANYGROWTH=E249 RISK=TOTO I would like to do this kind of thing : View <f:loadBundle basename="toto" var="msg"/> ... <p:column> <h:outputText value="#{msg.#{key}}" /> </p:column> Putting an EL in an EL like #{msg.#{key}} where key would be a declared row value in a datatable. Is there a

Passing EL expression to composite component

血红的双手。 提交于 2020-01-11 04:16:12
问题 we are still in a JSF 1.2 to 2.0 migration scenario and we are now facing a problem related to c:set or ui:param variables used inside an EL expression. Here are the facts. There is a button as composite component: <cc:interface name="button" shortDescription="A button."> ... <cc:attribute name="disabled" required="false" default="false" shortDescription="The disabled flag." /> ... </cc:interface> <cc:implementation> <ice:commandButton ... disabled="#{cc.attrs.disabled}" ... /> </cc

No access to nested property in managed bean within p:columns

自作多情 提交于 2020-01-11 02:10:12
问题 I have following two simple POJOs: class Person { String name Address address; //and of course the getter/setter for the attributes } class Address { String city; //also getter/setter for this attribute } And a backing bean: @ManagedBean @RequestScoped class PersonController { private List persons; private List<String> columns = Arrays.toList("name", "address.city"); //of course getter/setter } Now I want to create a dataTable. <p:dataTable var="person" value="#{personController.persons}"

el表达式跟ognl表达式的区别

岁酱吖の 提交于 2020-01-09 19:40:45
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.区别 用法区别: OGNL是通常要结合Struts 2的标志一起使用,如<s:property value="#xx" /> struts页面中不能单独使用,el可以单独使用 ${sessionScope.username} 页面取值区别: 用于按request > session > application顺序访问其属性(attribute) #attr.userName相当于按顺序在以上三个范围(scope)内读取userName属性,直到找到为 2.ognl讲解 OGNL 是 Struts 2默认的表达式语言。是Object Graphic Navigation Language(对象图导航语言)的缩写,它是一个开源项目。 1.#符号的用途一般有三种。 1)访问非根对象属性,例如示例中的#session.msg表达式,由于Struts 2中值栈被视为根对象,所以访问其他非根对象时,需要加#前缀。实际上 ,#相当于ActionContext.getContext(); ;#session.msg表达式相当于ActionContext.getContext().getSession(). getAttribute(”msg”) 。 2)用于过滤和投影(projecting)集合,如示例中的persons.

intellij not resolving el variables within JSP code inspection or autocomplete

£可爱£侵袭症+ 提交于 2020-01-09 09:11:46
问题 To summarize the answer shown here Code assist in (jsp /jstl) view for Spring MVC model objects in Eclipse is not working for me at all, is there a setting that I need to change ? I have just downloaded the sample spring-mvc-showcase on github, and it doesn't work out of the box on that project (with either 11.1.3 or EAP 12 version both full enterprise editions), see below (I have no idea where it gets formBean from) : Here is an example from my own project,the screen shot below (bottom frame

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

Need help Using EL in javascript to get value from model

荒凉一梦 提交于 2020-01-07 03:58:08
问题 I have a an object stored in the model called "domain", which has two methods, getDescriptionEn() and getDescriptionFr(). I need the description depending on the current locale. Here is my problem, I have the following: var locale = "${currentLocale}"; // This returns either "En" or "Fr" var method = "{domain.getDescription".concat(locale).concat("}"); // This is "{domain.getDescriptionEn}" or "{domain.getDescriptionFr}" var expr = "$".concat(method); // This is going to be "${domain