How to access at request attributes in JSP?
EL expression: ${requestScope.Error_Message} There are several implicit objects in JSP EL. See Expression Language under the “Implicit Objects” heading.
EL expression: ${requestScope.Error_Message} There are several implicit objects in JSP EL. See Expression Language under the “Implicit Objects” heading.
Use <f:convertDateTime>. You can nest this in any input and output component. Pattern rules are same as java.text.SimpleDateFormat. <h:outputText value=”#{someBean.dateField}” > <f:convertDateTime pattern=”dd.MM.yyyy HH:mm” /> </h:outputText>
You can use <c:set> for this: <c:set var=”myVar” value=”#{myBean.data.something.very.long}” scope=”request” /> This EL expression will then be evaluated once and stored in the request scope. Note that this works only when the value is available during view build time. If that’s not the case, then you’d need to remove the scope attribtue so that it … Read more
Ignore it. Eclipse is a jerk. You can tone it by setting Window > Preferences > Web > JavaServer Faces Tools > Validation > Type Assignment Problems > Method expression signature incompatibility to Warning or Ignore (it defaults to Error). Image borrowed from this blog in all courtesy. The reason is, Eclipse expect the action … Read more
#{} are for deferred expressions (they are resolved depending on the life cycle of the page) and can be used to read or write from or to a bean or to make a method call. ${} are expressions for immediate resolution, as soon as they are encountered they are resolved. They are read-only. You can … Read more
Using java string concatenation works better. #{var1 == 0 ? ‘hi’ : ‘hello’.concat(var2)} The benefit here is you can also pass this into a function, for instance #{myCode:assertFalse(myVar == “foo”, “bad myVar value: “.concat(myVar).concat(“, should be foo”))}
Initial answer (EL 2.1, May 2009) As mentioned in this java forum thread: Basically autoboxing puts an Integer object into the Map. ie: map.put(new Integer(0), “myValue”) EL (Expressions Languages) evaluates 0 as a Long and thus goes looking for a Long as the key in the map. ie it evaluates: map.get(new Long(0)) As a Long … Read more
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 need to either escape it, which is ugly: rendered=”#{beanA.prompt == true && beanB.currentBase != null}” or to use the and keyword instead, which is preferred … Read more
You cannot invoke static methods directly in EL. EL will only invoke instance methods. As to your failing scriptlet attempt, you cannot mix scriptlets and EL. Use the one or the other. Since scriptlets are discouraged over a decade, you should stick to an EL-only solution. You have basically 2 options (assuming both balance and … Read more
From EL 2.2 specification (get the one below “Click here to download the spec for evaluation”): 1.10 Empty Operator – empty A The empty operator is a prefix operator that can be used to determine if a value is null or empty. To evaluate empty A If A is null, return true Otherwise, if A … Read more