el

Getting variable in JSP EL by constant does not work

限于喜欢 提交于 2019-12-11 09:08:46
问题 I use GlassFish 4.1 web profile which as I understand uses EL 3.0. I did everything as was explained here - https://stackoverflow.com/a/3735006/5057736 however my implementation of this solution doesn't work. This is my constant class public class CommonKeys { public static final String TITLE = "SOME_KEY"; } This is how I set attribute: request.setAttribute(CommonKeys.TITLE, "TEST"); This is my jsp: <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java

Column.setFilterBy() and Column.setSortBy() what type of parameter should i give?

我们两清 提交于 2019-12-11 09:02:52
问题 i'm trying to set the filtering and sorting for a column of my datatable dynamically from a managed bean, but i had a problem regarding the value that i should give to those methods, here is the code i tried : /*this is the XHTML that i try to do in Java code : <p:column style="text-align:center;" width="10" id="etatCol" filterBy="#{exam.examen.studyPatientState}" filterOptions="#{examenListBean.etatExamOptions}" filterMatchMode="exact" headerText="Etat" filterStyle="dispo" sortBy="#{exam

How to pass a parameter into rendered attribute?

做~自己de王妃 提交于 2019-12-11 08:19:32
问题 I try to pass a parameter into method admin like this: <p:toolbarGroup align="right" rendered="#{loginBean.admin('dataread'}"> <h:form> <p:commandButton value="manage users" ajax="false" icon="ui-icon-document" action="/admin/manageUsers.xhtml?faces-redirect=true"/> </h:form> </p:toolbarGroup> the code in my managed Bean is like that public boolean isAdmin(String role){ FacesContext facesContext = FacesContext.getCurrentInstance(); HttpServletRequest request = (HttpServletRequest)

EL expressions are not evaluated in JBoss AS 4.2.2

删除回忆录丶 提交于 2019-12-11 08:06:58
问题 EL expressions are not evaluated in JBoss AS 4.2.2. I have web.xml declared conform the Servlet 2.4 spec. <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> What needs to be done more in order to get EL to work in JBoss AS 4.2.2? 回答1: Your web.xml root declaration looks fine. Other causes to exclude: Ensure that

Constants in EL 3.0 - Property not found

倾然丶 夕夏残阳落幕 提交于 2019-12-11 07:46:59
问题 I'm trying to reference constant with EL on my JSF page (https://java.net/projects/el-spec/pages/StaticField), but I'm stuck on this exception: javax.servlet.ServletException: /faces/signup.xhtml @18,85 maxlength="#{signUpBean.USERNAME_MAXLENGTH}": Property 'USERNAME_MAXLENGTH' not found on type com.foo.SignUpBean I'm using Tomcat 8.0.0-RC1 and here is my backing bean and input declaration: Bean: @ManagedBean @RequestScoped public class SignUpBean implements Serializable { public static final

Struts2 display image / get image url from a properties file

99封情书 提交于 2019-12-11 07:29:25
问题 In a project that I got assigned which is using Struts2 I need to do the following things, but I'm new to using Struts2. Move text from titles and most common / repeating texts to a .properties file. Change URLs from images to make the system parameterized, so they should be in the same .properties file as well. I've been able to change some of the titles, first linking Struts2 with my .properties file, following this answer. Content.properties login.logo=/resources/media/login.png login

how to display data in JSTL for list containing objetcs?

陌路散爱 提交于 2019-12-11 07:12:01
问题 In request attribute I have list of objects (say user objects) so how can I loop through it display data on my jsp page? Can I use <c:foreach> but then how I can say that it is User object and access properties of that? 回答1: JSTL/EL doesn't care about the exact type. All you need to ensure is that the object in question has a getter method for the given property so that you can just specify the property name. Imagine, public class User { private Long id; private String name; private Integer

type cast in EL expressions using Thymeleaf

大憨熊 提交于 2019-12-11 07:05:00
问题 How can I convert object types within EL expressions? Thymeleaf engine doesn't seem to understand something like this: <span th:text="${((NewObjectType)obj).amount"></span> Thanks. Update: Class hierarchy in which I store data. They are used to populate the HTML table. public class RootBase implements Serializable { ... } public class ColBase<T extends RootBase> implements Serializable { private ArrayList<T> internalList; public int getSize() { ... } public T get(int index) { return

Expression language, don't show variable value

拥有回忆 提交于 2019-12-11 06:13:09
问题 I am pretty new in Java EE, i am trying use that .war file http://community.jboss.org/wiki/ThreadDumpJSP , but it seems index.jsp file doesn't show variable, I see only ${thr.name} ${thr.state} ${thr.priority} ${thr.daemon} I am tested it on jboss and tomcat 6 edit: here is code: package org.jboss.varia.threaddump.ThreadDumpBean; import java.io.Serializable;import java.util.*; public class ThreadDumpBean implements Serializable { private final Map traces; public ThreadDumpBean() {traces = new

JSF component binding without bean property throwing conversion error

﹥>﹥吖頭↗ 提交于 2019-12-11 05:08:39
问题 In a column of a table I've tried to bind a component value to a local scoped EL variable and later on to use that variable as a paramter: <h:column> <h:outputLabel value="Enter a quantity to put into the cart" for="qty"/> <h:inputText id="qty" binding="#{qty}" converter="javax.faces.Number"/> </h:column> <h:column> <h:commandButton value="Put into cart" type="submit" action="#{shoppingCart.addToCart(product, qty)}"/> </h:column> Where product is the current element of the datatable (a list