el

null check in jsf expression language

安稳与你 提交于 2019-12-03 03:25:53
问题 Please see this Expression Language styleClass="#{obj.validationErrorMap eq null ? ' ' : obj.validationErrorMap.contains('key')?'highlight_field':'highlight_row'}" Even if the map is null, highlight_row style is getting applied. So I changed to styleClass="#{empty obj.validationErrorMap ? ' ' : obj.validationErrorMap.contains('key')?'highlight_field':'highlight_row'}" Even then, highlight_row is getting applied. if the map is empty OR null I dont want any style to be applied. Any help? and

Error : javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null [duplicate]

岁酱吖の 提交于 2019-12-03 02:41:21
This question already has answers here : Identifying and solving javax.el.PropertyNotFoundException: Target Unreachable (13 answers) I got this error below when I was running my JSF page. javax.el.PropertyNotFoundException: Target Unreachable, 'null' returned null.. Warning: /createStaff.xhtml @33,125 value="#{staffBean.staff.firstName}": Target Unreachable, 'null' returned null javax.el.PropertyNotFoundException: /createStaff.xhtml @33,125 value="#{staffBean.staff.firstName}": Target Unreachable, 'null' returned null I don't get why I will run into the error when I use value= "#{staffBean

How to use && in EL boolean expressions in Facelets?

佐手、 提交于 2019-12-03 02:07:48
问题 I am having a little trouble figuring out how to do and's on EL expressions in Facelets. So basically I have: <h:outputText id="Prompt" value="Fobar" rendered="#{beanA.prompt == true && beanB.currentBase !=null}" /> But I keep getting: Error Traced[line: 69] The entity name must immediately follow the '&' in the entity reference. 回答1: Facelets is a XML based view technology. The & is a special character in XML representing the start of an entity like & which ends with the ; character. You'd

Concat two String in JSF EL expression [duplicate]

折月煮酒 提交于 2019-12-03 01:03:36
This question already has an answer here : How to concatenate Strings in EL expression? (1 answer) I have the following el expression: <af:outputText value="#{viewArticle.publish ? ('Publish on ' + viewArticle.publishDate + ' by ' + viewArticle.publishFirstName + ' ' + viewArticle.publishLastName) : 'Draft version'}"/> But I am getting java.lang.NumberFormatException: For input string: "Publish on " How can I join the string? Marcio Aguiar You can use the String.concat function: <af:outputText value="#{viewArticle.publish ? 'Publish on '.concat(viewArticle.publishDate).concat(' by ').concat

What is the difference between #{expr} and ${expr} in jsf? Are there any cases when we should prefer ${expr}? [duplicate]

爱⌒轻易说出口 提交于 2019-12-02 23:23:33
This question already has an answer here: Difference between JSP EL, JSF EL and Unified EL [closed] 2 answers I've read some time ago about the difference in 'Core JSF' but now I can't find that place. Nevertheless I don't remember that there was a word about cases when we should use ${expr} in jsf. So I'm just curious what is the difference (in a chestnut) and if there a case to use ${expr} in JSF application? To summarize in clear language: ${expression} does only get , while #{expression} can do both get and set . This is because the ${expression} is evaluated only once (immediate), while

How to use EL with p:panel header?

ぃ、小莉子 提交于 2019-12-02 23:20:43
问题 I want to put a dynamic string inside a p:panel header just like using it with p:inputText for example value="#{object.property}" is it possible to do that ? 回答1: Just use <f:facet name="header"> facet within your <p:panel> : <p:panel> <f:facet name="header"> <p:inputText value=#{object.property} /> ... </f:facet> ... </p:panel> Or, if you want to output some text there, you can use <p:panel header="#{object.property}" ... > . 来源: https://stackoverflow.com/questions/16531511/how-to-use-el

JSTL conditional check

核能气质少年 提交于 2019-12-02 20:44:40
On my current page I am using JSTL to check if data is available for my form. Problem I am facing is "if there is no data I am not seeing the text fields either". I can solve it using and tags but that would entail lot of if else if else kind of code all through the page. Can anyone suggest me a better cleaner solution to this problem? <c:if test="${salesData!=null}"> <c:if test="${fn:length(salesBundle.salesArea) > 0}"> <input type="text" id="sales_area" class="salesManagerStyle"> </c:if> </c:if> You can have multiple conditions in a test . <c:if test="${salesData != null && fn:length

“Property not found on type” when using interface default methods in JSP EL

社会主义新天地 提交于 2019-12-02 19:12:31
Consider the following interface: public interface I { default String getProperty() { return "..."; } } and the implementing class which just re-uses the default implementation: public final class C implements I { // empty } Whenever an instance of C is used in JSP EL scripting context: <jsp:useBean id = "c" class = "com.example.C" scope = "request"/> ${c.property} -- I receive a PropertyNotFoundException : javax.el.PropertyNotFoundException: Property 'property' not found on type com.example.C javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:268) javax.el.BeanELResolver

null check in jsf expression language

浪子不回头ぞ 提交于 2019-12-02 16:57:30
Please see this Expression Language styleClass="#{obj.validationErrorMap eq null ? ' ' : obj.validationErrorMap.contains('key')?'highlight_field':'highlight_row'}" Even if the map is null, highlight_row style is getting applied. So I changed to styleClass="#{empty obj.validationErrorMap ? ' ' : obj.validationErrorMap.contains('key')?'highlight_field':'highlight_row'}" Even then, highlight_row is getting applied. if the map is empty OR null I dont want any style to be applied. Any help? and reasons for this behaviour? Use empty (it checks both nullness and emptiness) and group the nested

EL syntax error on <c:if>

╄→гoц情女王★ 提交于 2019-12-02 16:04:38
问题 I am trying to create a condition for a link where if the length is not = 0 then show the description but I am getting a syntax error the code is: <c:if test="#{fn:length(#{pqfn:format('ACTUAL_LINK')}) != 0}"> <h:outputLink id="link1" value="#{pqfn:format('LINK_DESCRIPTION')}"/> </c:if> The error I am receiving is: Caused by: org.apache.el.parser.ParseException: Encountered " <ILLEGAL_CHARACTER> "{ "" at line 1, column 14. Was expecting one of: "." ... ")" ... "[" ... "," ... ">" ... "gt" ...