el

how can I concate jstl or EL value to form a complete attribute value

孤街浪徒 提交于 2019-12-12 05:25:48
问题 I have <a href> tag in html My model has a java list list1 as model attribute. I am trying to construct <a href="pathvalue/namevalue"> <c:forEach var="obj" items="${list}"> <a href="${obj.path}+"/"+${obj.name}".../> </c:forEach> I want to know how can I insert "/". I can directly concate two El value ${obj.path}${obj.name} but how to get that "/" is below line correct to get a output "pathvalue/namevalue"? <c:out value="${obj.path+'/'+obj.name}" /> 回答1: You can't concatenate it because "+"

Expression Language Other way to invoke method

主宰稳场 提交于 2019-12-12 02:44:18
问题 I have the following code and I'm searching for an other way to do this. public static RequestContextData getRequestContextData() { FacesContext fc = FacesContext.getCurrentInstance(); ExpressionFactory ef = fc.getApplication().getExpressionFactory(); MethodExpression me = ef.createMethodExpression( fc.getELContext(), "#{requestContextData.getRequestContextData}", String.class, new Class[0]); Object o = me.invoke(fc.getELContext(), null); RequestContextData request = (RequestContextData) o;

Concatenation of property name (EL) in JSF

会有一股神秘感。 提交于 2019-12-12 02:15:51
问题 How can I concatenate the name of a property using the EL? This is what I tried: <ui:repeat value="#{someBean.getParts()}" var="part"> <h:inputTextarea value="#{someOtherBean.result}#{part}" /> </ui:repeat> But it didn't work. The bean has the four property resultA, resultB, resultC and resultD. getParts() returns "A", "B", "C", and "D". 回答1: I don't think that can be made to work without changing the design. It's generally a bad idea in Java to have a design that requires you to access

EL syntax to check if a set contains a specific Enum value

只愿长相守 提交于 2019-12-12 01:43:11
问题 I have an Item object, which has a field that is a Set of ItemTypes: public class Item { EnumSet<ItemType> itemTypeSet; ... public Set<ItemType> getItemTypeSet(){ return this.itemTypeSet; } } ItemType is of course a simple Enum. public Enum ItemType { BOLD, THIN, COOL, ROUND; } In my JSP I would like to use JSTL to see if an item has a specific ItemType, I tried to use the following three snippets but I get no errors and no results. I'm not sure why all 3 are failing. Could somebody explain,

JSF EL i18n in CSS files

回眸只為那壹抹淺笑 提交于 2019-12-12 01:26:32
问题 In my html pages I use the Spring message bean like so: #{ms.my_text_label} ms is of type ReloadableMessageSourceBundle and will translate my_text_label by looking in some resource bundle files. Can I make it possible to use this in my CSS files as well? 回答1: Disclaimer: I'm ignoring the Spring WebFlow part in the question and do as if the JSF project doesn't use any Spring artifacts. You can just use EL in CSS files the usual way if you load the CSS file via <h:outputStylesheet> instead of

EL expression not evaluated

时光毁灭记忆、已成空白 提交于 2019-12-12 01:23:21
问题 Here is my test servlet ; public class EventListServlet extends javax.servlet.http.HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException,

How do I use static methods within EL?

时光总嘲笑我的痴心妄想 提交于 2019-12-12 00:52:41
问题 I'm working in a jsp. bean.getConfigurationActionButtonBar() returns a list of button objects. WebUtils.getActionButtonBar(List buttonList) takes that list and returns generated html. Very simple. Now, for some reason this doesn't work: <td colspan="2"> ${WebUtils.getActionButtonBar(bean.getConfigurationActionButtonBar())} </td> The button list is set. Something's wrong with the call to static WebUtils.getActionButtonBar . That call is simply never made. Any idea? 回答1: You need to declare it

java.lang.NoSuchMethodException: java.util.ArrayList.get(java.lang.Long)

陌路散爱 提交于 2019-12-12 00:01:30
问题 This EL expression: ${ModelHelper:adults(dossier).get(0).creationDate} Throws the below exception: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/jspbo/users/dossier-list-paginee.jsp at line 52 49: <c:forEach var="dossier" items="${dossiers}"> 50: <tr> 51: <td><a href="/lottery/bo/dossier/${dossier.id}/summary" class="capit">${dossier.id}</a></td> 52: <td data-title="

Implicit expression language object “component” not working in jsf 2.2.6

可紊 提交于 2019-12-11 22:22:12
问题 I'm migrating a jsf 2.0 application to jsf 2.2.6. There is a extensive use of implicit EL object component as styleClass="#{component.valid?'':'err'}". In jsf 2.2.6 (jsf-impl-2.2.6-jbossorg-4.jar) valid is not recognized, throwing "ServletException: The class 'javax.faces.component.html.xxx' does not have the property 'valid". Is this functionality deprecated in jsf 2.x.x? Can be related to JBoss EL? 回答1: It seems that you trying the component.valid on element that does not support it at all,

JSF/Bean #{} not rendered/parsed

≯℡__Kan透↙ 提交于 2019-12-11 18:23:21
问题 i have a problem with rendering #{} inside JSF page. I'm using Mojarra 2.1.5 and JBoss 7 Example: JSF Page <h:inputText value="#{bean.name}"/> faces-config.xml <managed-bean> <managed-bean-name>bean</managed-bean-name> <managed-bean-class>com.Bean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> HTML Output #{bean.name} Question Why i don't see proper values from bean ? Why i'm getting string instead of nothing ? UPDATED web.xml content: <?xml version="1.0