el

Doubly nested EL variables?

北慕城南 提交于 2021-02-04 18:07:34
问题 I'm using Spring MVC for my controller, and JSPs are my presentation layer. Inside my Spring controller, I have: model.put("issues", dataManager.getIssues()); model.put("functions", dataManager.getFunctions()); So now inside my JSP, I have access to ${requestScope['issues']} ${requestScope['functions']} That's all well and good. But in order for my code to be extensible, I would like to store the variable name issues and functions inside the database, which will then be accessible through a

Doubly nested EL variables?

混江龙づ霸主 提交于 2021-02-04 18:07:15
问题 I'm using Spring MVC for my controller, and JSPs are my presentation layer. Inside my Spring controller, I have: model.put("issues", dataManager.getIssues()); model.put("functions", dataManager.getFunctions()); So now inside my JSP, I have access to ${requestScope['issues']} ${requestScope['functions']} That's all well and good. But in order for my code to be extensible, I would like to store the variable name issues and functions inside the database, which will then be accessible through a

Why does <jsp:getProperty> need <jsp:useBean>, but EL doesn't?

若如初见. 提交于 2021-01-29 07:10:03
问题 I have servlet with following code: protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { Person p = new Person("Mike"); req.setAttribute("person", p); RequestDispatcher view = req.getRequestDispatcher("/result.jsp"); view.forward(req, resp); } I have two choices for printing person's name inside result.jsp . Using <jsp:getProperty> or Expression language . Simple EL code: <!DOCTYPE html> <html><body> Welcome ${person.name} </body></html

empty EL expression on JSF datatable var attribute's field always false

余生颓废 提交于 2021-01-27 07:29:46
问题 I have the following EL expression which references a property on the var attribute: empty _item.addressLine1 addressLine1 is a String property on the Address bean, which is accessed via the personBean.person.addresses property which returns a Set<Address> . Here is the EL expression in context: <h:dataTable id="personBeanPersonAddresses" styleClass="data-table" value="#{forgeview:asList(personBean.person.addresses)}" var="_item"> <h:column> <f:facet name="header"> <h:outputText value=

empty EL expression on JSF datatable var attribute's field always false

假装没事ソ 提交于 2021-01-27 07:24:15
问题 I have the following EL expression which references a property on the var attribute: empty _item.addressLine1 addressLine1 is a String property on the Address bean, which is accessed via the personBean.person.addresses property which returns a Set<Address> . Here is the EL expression in context: <h:dataTable id="personBeanPersonAddresses" styleClass="data-table" value="#{forgeview:asList(personBean.person.addresses)}" var="_item"> <h:column> <f:facet name="header"> <h:outputText value=

Getting current date in JSTL EL and doing arithmetic on it

核能气质少年 提交于 2020-07-29 09:16:45
问题 Without using scriptlets, what's the correct way for doing date arithmetic in JSP? Here are examples what I'm trying to do: Get current year (YYYY) Subtract current year by one to get previous year (YYYY) Thanks! 回答1: Use <jsp:useBean> to construct new Date. Use JSTL <fmt:formatDate> to get the year out of it. Use EL to substract it. <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <jsp:useBean id="now" class="java.util.Date" /> <fmt:formatDate var="year" value="${now}"

Getting current date in JSTL EL and doing arithmetic on it

ⅰ亾dé卋堺 提交于 2020-07-29 09:14:48
问题 Without using scriptlets, what's the correct way for doing date arithmetic in JSP? Here are examples what I'm trying to do: Get current year (YYYY) Subtract current year by one to get previous year (YYYY) Thanks! 回答1: Use <jsp:useBean> to construct new Date. Use JSTL <fmt:formatDate> to get the year out of it. Use EL to substract it. <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <jsp:useBean id="now" class="java.util.Date" /> <fmt:formatDate var="year" value="${now}"

javax.el.PropertyNotFoundException when second character of property name is a capital

守給你的承諾、 提交于 2020-07-28 00:18:56
问题 I have this unusual scenario: I have a registrationVO with few properties and getter setters for that. For example city or bCity with their getter methods getCity() and getBCity() In JSP i tried to display the value of these properties using scriplets, <%=registrationVO.getCity()%> and < %=registrationVO.getBCity()%> , It works fine. But i replaced the same with expression language, ${registrationVO.city} and ${registrationVO.bCity} i got an error saying property "bCity" not found in

javax.el.PropertyNotFoundException when second character of property name is a capital

元气小坏坏 提交于 2020-07-28 00:16:07
问题 I have this unusual scenario: I have a registrationVO with few properties and getter setters for that. For example city or bCity with their getter methods getCity() and getBCity() In JSP i tried to display the value of these properties using scriplets, <%=registrationVO.getCity()%> and < %=registrationVO.getBCity()%> , It works fine. But i replaced the same with expression language, ${registrationVO.city} and ${registrationVO.bCity} i got an error saying property "bCity" not found in