el

Custom tag that evaluates its body based on the variables of the tag

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-07 03:24:25
问题 Ok, now this is something for the hard core JSTL wizards I guess ;-) I would like to have a tag whose body does not substitute the variables of the surrounding page. It should only take the variables into account that have been specified in the body of the tag or in the tag itself like this: <c:set var="outsideVar" value="outside value"/> <a:component> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <div data-component-id="9"> <c:set var="componentId" value="9"/> <c:set

JSP 2.2 EL it keyword in Jersey Viewable - where is it documented?

爱⌒轻易说出口 提交于 2020-01-05 08:17:15
问题 I've found out that if I have a Viewable (jersey) passing a model to a JSP, then the way to access it is by prefixing the map key with it e.g. index.jsp <html> <body> <h2>Hello World ${it.foo}!</h2> </body> </html> The JAX-RS resource method: @GET @Path("index") public Viewable index(@Context HttpServletRequest request) { System.out.println("/INDEX called"); HashMap<String, String> model = new HashMap<String, String>(); model.put("foo","bar"); return new Viewable("/index.jsp", model); } I was

Assigning a Java Set to a Javascript array using EL

大兔子大兔子 提交于 2020-01-05 07:12:41
问题 So, I am trying to pass a Set into a .jsp page using Spring and JSP EL, and then assign the members of the set to a Javascript array to use later in client-side scripts. For example, if I have the Java Set exampleSet: { "A", "B", "C"} I pass it to the client side as part of a spring ModelandView object. In the client-side JSP, I can use EL to output the set as ${model.exampleSet} , which gets parsed into [A, B, C] by JSP. What I want to do is assign the contents of exampleSet to an array of

Trying to nest JSF expression strings

▼魔方 西西 提交于 2020-01-05 04:50:14
问题 I'd like to know whether it is possible to adapt the ExtendedBeanELResolver from the question nesting-jsf-expression-strings as well to handle this nested EL expression: #{controllerBean.getBean('userProfileBean', component).street}* whereby controllerBean.getBean returns the bean userProfileBean . I'll get with the ExtenedBeanELResolver following exception: SCHWERWIEGEND: javax.el.PropertyNotFoundException: /WEB-INF/templates/modification/userProfile.xhtml @35,196 value="#{controllerBean

JSTL Access Integer/Long key in Hash Map

橙三吉。 提交于 2020-01-05 03:18:20
问题 I am facing some problem in using EL in JSTL and not able to access Java Hash Map as I would like. I am aware that in EL the key, if Integer gets accessed as Long. I have following hash map definition that I am trying to access in JSTL - Map<Long, Object> testMap = new HashMap<Long, Object>(); In JSP page, I need to check if the map contains a specific key or not. I attempt to do that by checking if not empty as following - <c:if test='${ ! empty testMap[currObj.currVal]}'> I also access the

JSF NumberFormatException with f:setPropertyActionListener

核能气质少年 提交于 2020-01-05 02:58:05
问题 I'm getting this error with f:setPropertyActionListener and i can't figure out why: HTTP Status 500 - For input string: "selectedItem" exception: javax.servlet.ServletException: For input string: "selectedItem" javax.faces.webapp.FacesServlet.service(FacesServlet.java:667) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause: java.lang.NumberFormatException: For input string: "selectedItem" java.lang.NumberFormatException.forInputString(Unknown Source) java.lang

How to get a value of an object's property when the property name is a variable itself in JSP? [duplicate]

99封情书 提交于 2020-01-04 13:27:53
问题 This question already has an answer here : How to get value of bean property when property name itself is a dynamic variable (1 answer) Closed 3 years ago . HI, Here's my dilemma. The below code is obviously wrong but it give you the idea on what I need to accomplish. <c:forEach var="object1" items="${model.listofObjects1}"> <tr> <c:forEach var="object2" items="${model.listofObjects2}"> <td>${object1.${object2}}</td> </c:forEach> </tr> </c:forEach> Any ideas on how to make this look up? 回答1:

How to get a value of an object's property when the property name is a variable itself in JSP? [duplicate]

有些话、适合烂在心里 提交于 2020-01-04 13:27:41
问题 This question already has an answer here : How to get value of bean property when property name itself is a dynamic variable (1 answer) Closed 3 years ago . HI, Here's my dilemma. The below code is obviously wrong but it give you the idea on what I need to accomplish. <c:forEach var="object1" items="${model.listofObjects1}"> <tr> <c:forEach var="object2" items="${model.listofObjects2}"> <td>${object1.${object2}}</td> </c:forEach> </tr> </c:forEach> Any ideas on how to make this look up? 回答1:

EL in a JSP stopped evaluating

一笑奈何 提交于 2020-01-04 06:32:09
问题 In a JSP page(index.jsp): ${requestContext.requestURL} is the URL just shows the expression itself. It used to be evaluated to something like "http://.../somerset/" I created the Maven project with maven-archetype-webapp archetype in Eclipse. The Jetty version is jetty-6.1.14. My web.xml is simple: <web-app> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>SomersetServlet</servlet-name> <display-name>SomersetServlet</display-name> <description><

How to get boolean property with expression language?

醉酒当歌 提交于 2020-01-03 19:34:33
问题 If I have a class like this: class Person { private int age; public int getAge() { return age; } public boolean isAdult() { return age > 19; } } I can get the age with EL like this: ${person.age} But, I cannot figure out how to get the isAdult() . How can I get this? 回答1: Do it like ${person.adult} It will invoke isAdult() It works on java bean specifications. 回答2: Doing ${person.adult} should work, unless you are using a very old version of JSP, in which case you may need to change your