el

Make JSF access a Map<String, ?> values from an EL instead of a bean fields?

强颜欢笑 提交于 2019-12-07 03:59:42
问题 Is there any proper way to override the way JSF accesses the beans fields from an Expression Language? The idea is to mimic this behavior in order to access a Map<String, ?> values, where the bean fields would be the map keys. In other words, is it possible anyhow to use #{beanContainingNestedMap.keyOfSaidNestedMap} , just as if keyOfSaidNestedMap were a field of the beanContainingNestedMap ? If not, what other solution may I have? Example: Holder.java public class Holder { private Map<String

JSTL Session Lookup - Key Has Periods

寵の児 提交于 2019-12-07 02:48:19
问题 I am working with some legacy code, and at some point there is a key in the session that is something like session.setAttribute("com.org.something.Object",someObject); Now trying to access this in a jsp using jstl is a bit difficult becuase if I tried it like I normally would I would do: ${sessionScope.com.org.something.Object.someFieldGetter} As most of us can imagine it will fail because there is no com object in session scope. I also tried ${sessionScope.'com.org.something.Object'

JSF component binding - some confusion

核能气质少年 提交于 2019-12-07 02:23:12
问题 From web pages like this one, http://www.jsftutorials.net/components/step5.html I understand that the binding attribute in JSF tag/view component is to bind the view component to a Java instance of the UI component in the backing bean. E.g., that's what is done in the following code: <h:inputText value="#{ myBean.someProperty}" binding="#{ myBean.somePropertyInputText}"/> But sometimes I see code like this: <h:commandButton id="t1" binding="#{foo}" value="Hello, World!" onclick="alert('I am #

package javax.el does not exist

◇◆丶佛笑我妖孽 提交于 2019-12-07 02:02:53
问题 i'm using jre6/eclipse and importing javax.el.* the error package javax.el does not exist [javac] import javax.el.*; comes up. isn't this supposed to be part of java? can anyone tell me why this might be. thanks m 回答1: EL (the Unified Expression Language) is part of the Java EE spec. You can find this library as part of any Java EE server or JSP container. Implementations are also available separately from Glassfish, Apache or JUEL. 回答2: This is usually part of the servlet container in

JSF 2.1 ValueExpression in action-attribute

五迷三道 提交于 2019-12-07 01:58:35
问题 Section 3.1.4 of the JSF 2.1 Specification says that all attributes of standard components are value expression enabled . I want to assign a value expression to the action attribute of a commandButton: <h:commandButton value="OK" action="#{myBean.valExp}" /> I also defined corresponding getValExp and setValExp methods in the bean's class. However my JSF implementation (JBoss 6) takes that expression to be a method expression and thus yields a "method not found" error because there's no valExp

How to convert an arbitrary object to String with EL + JSTL? (calling toString())

谁都会走 提交于 2019-12-06 19:26:41
问题 Is there any way to call toString() on an object with the EL and JSTL? (I need the String representation of an enum as index in a map in a JSP EL expression.) I hoped something like ${''+object} would work like in java, but EL isn't that nice, and there does not seem to be any function that does it. Clarification: I have a variable somemap that maps Strings to Strings, and I have a variable someenum that is an enumeration. I'd like to do something like ${somemap[someenum.toString()]} . (Of

How to concatenate Strings in EL? [duplicate]

你。 提交于 2019-12-06 14:52:46
问题 This question already has answers here : How to concatenate a String in EL? (5 answers) Closed 3 years ago . Apparently, you cannot use the normal + operator to append strings in jsp...at least its not working for me. Is there a way to do it? Fragment of my code that is relevant... ${fn:length(example.name) > 15 ? fn:substring(example.name,0,14) + '...' : example.name} // does not work because of + operator 回答1: EL does not know a string concatenation operator. Instead, you would just inline

how to access a EL variable and pass it as an argument to a function in EL?

倖福魔咒の 提交于 2019-12-06 14:15:41
I want to call a function on a bean with an argument passsed to it in jsp using EL. The problem is it does not allow something like: " ${teacherBean.certificationFor(${particularField}) " the thing is i want to iterate over an array and call the function certificationFor for all the values in the array passed as an argument. I am getting the values in array by: So Basically i want to do something like: ${teacherBean.certificationFor(${particularField}) but i cant do that. can i do this in any other way? I am a newbie in EL . :) Any help is appreciated. Where exactly do you want to do that and

Use an EL expression to pass a component ID to a composite component in JSF

不问归期 提交于 2019-12-06 12:27:22
Problem: I am passing an EL expression to a composite component, but the EL expression is being evaluated from inside the composite component, rather than before. The intention being that the EL expression evaluates to a string with is sent to the composite component. I have a composite component, MenuTable : <cc:interface> <cc:attribute name="model" type="nz.co.tradeintel.web.MenuTable"/> <cc.attribute name="updateId" /> </cc:interface> <cc:implementation> <h:panelGroup id="menuTable"> <table> <ui:repeat id="repeat1" value="#{cc.attrs.model.rows}" var="row"> <tr> <ui:repeat id="repeat2" value

Struts 2 Dynamic message with OGNL

最后都变了- 提交于 2019-12-06 11:53:30
In a Struts 2 project, consider below key in message resources: export.filename.accountsummary=customer ${export} The action has export filed with setter and getter. If you call the getText("export.filename.accountsummary") struts will automatically call the getExport() and fill it with correct value. (I think that struts use OGNL too lookup the resource messages that are endorse with ${} ) Is this correct ?! I try to use customer ${#sessionScope.CurrentUser.userName} an expected that struts use this OGNL expression but it did not worked. Looks like the variable sessionScope is not available