el

Difference between <%= foo %> and ${ foo }

北战南征 提交于 2019-12-12 16:26:08
问题 Coding in JSP for the first time, I need to render a variable's value to HTML. It looks like there are various ways to do this; what is the difference between these (given that I have a variable named foo )? <%= foo %> and ${ foo } 回答1: This, using an old fashioned output scriptlet which is discouraged since a decade, <%= foo %> does basically the same as the following in a regular scriptlet : <% out.println(foo); %> which in turn does basically the same as the following in a normal Java

Passing a Enum value as a parameter from JSF (revisited)

跟風遠走 提交于 2019-12-12 16:18:32
问题 Passing a Enum value as a parameter from JSF This question already deals with this issue, however the proposed solution has not worked for me. I define the following enumeration in my backing bean: public enum QueryScope { SUBMITTED("Submitted by me"), ASSIGNED("Assigned to me"), ALL("All items"); private final String description; public String getDescription() { return description; } QueryScope(String description) { this.description = description; } } Then I use it as a method parameter

Eclipse reports syntax error in JSP file, but application works

≡放荡痞女 提交于 2019-12-12 15:54:06
问题 I am inspecting codebase of one JAVA project, and I found that Eclipse shows error at the following lines: <c:if test="${not empty queryClauses && ((activeRole eq 'ROLE_ADMIN' && querySearch.project.isPublic()) or (not querySearch.project.isPublic()))}"> <div class="control-btns"> <input class="btn btn-primary" type="button" id="updateQuery" value="<spring:message code="query.updateQuery" />"/> <input class="btn btn-primary" type="button" id="deleteQuery" value="<spring:message code="query

javax.el.ELException: Error reading 'foo' on type com.example.Bean

寵の児 提交于 2019-12-12 13:26:39
问题 I am reading the following tutorial: The expression used in the h:dataTable/@value normally specifies a property name for which a getter was defined, which means that in the controller BookController class a property books is defined (optional) as well as a method named getBooks (this is mandatory). In this particular case it is just sufficient to define the getBooks method since there is no need of the books property in the controller class I have been trying to work such an idea in my

Issue in getting context path inside jsp?

浪尽此生 提交于 2019-12-12 10:44:10
问题 My jsp lies at below location http://myApp.com/myWebApp/customer/images/customer.jsp My image(accessed thru customer.jsp) lies at http://myApp.com/myWebApp/images/customer.gif In image tag i am making the absoulte path as below src="${param.contextPath}images/customer.gif" just for info i am using param here becoz this is how we access request params in EL. I was expecting that ${param.contextPath} will return /myWebApp/ but it is returning /myWebApp/customer/. Is there a way i can get just

char comparison in EL expression [duplicate]

老子叫甜甜 提交于 2019-12-12 10:39:57
问题 This question already has an answer here : How to compare a char property in EL (1 answer) Closed 3 years ago . I want to do something like this: <c:if test="${somestring.charAt(0)=='1'}"> tadaaaam </c:if> when somestring is "11011" but it doesn't work. I can print it with ${somestring.charAt(0)} and it is '1' but comparison above fails. The following comparison: if(somestring.charAt(0)=='1') worx (condition is true) in pure Java. Any ideas? 回答1: EL seems to have trouble with char. Here is

Can I access the values of an enum class from a JSP using EL?

*爱你&永不变心* 提交于 2019-12-12 08:36:17
问题 I have an enum class USState . I would like to iterate through the states in a JSP. Is it possible to access a list of USState s without first setting such a list as an attribute? It seems that something as static as an enum should always be available, but I can't figure out how to do it. Here's what I'm looking for: (except working) <c:forEach var="state" items="${USState.values}" > <option value="${state}">${state}</option> </c:forEach> 回答1: You can also consider to wrap it in a Javabean

JSF leaking memory through EL and composite components

╄→尐↘猪︶ㄣ 提交于 2019-12-12 07:59:25
问题 Note: I'm using mojarra 2.1.20 and rich faces 4.2.2. I've analyzed a heapdump and I've noticed that EL expressions reside in LRUMap in the session. Does anyone know why and what to do to avoid it? The problem I have is related to a composite component containing following line: <rich:select ... valueChangeListener="#{cc.listValuesChangeListener}" with backing bean my.package.MultiComboSelection. Obviously my.package.MultiComboSelection has a method defined named listValuesChangeListener. The

Illegal Syntax for Set Operation

断了今生、忘了曾经 提交于 2019-12-12 07:13:41
问题 I have a problem in connecting My xhtml page to the managed bean, the action on the commandButton works but when it comes to passing values it doesn't work. here is my jsf code: <h:form id="form" class="form-signin"> <p:panel id="panel" header=" Authentification" style="" > <h:panelGrid columns="2" rowClasses="3"> <h:outputLabel for="login" value="Nom d'utilisateur :" styleClass=""/> <p:inputText id="login" value=" #{authenticationBean.profil.login }" required="true" label="login" > <f

JSF returns blank/unparsed page with plain/raw XHTML/XML/EL source instead of rendered HTML output

萝らか妹 提交于 2019-12-12 05:29:49
问题 I have some Facelets files like below. WebContent |-- index.xhtml |-- register.xhtml |-- templates | |--userForm.xhtml | `--banner.xhtml : Both pages are using templates from /templates directory. My /index.xhtml opens fine in browser. I get the generated HTML output. I have a link in /index.xhtml file to /register.xhtml file. However, my /register.xhtml is not getting parsed and returns as plain XHTML / raw XML instead of its generated HTML output. All EL expressions in form of #{...} are