el

Get rid of hard-coding the context path of web apps in external JavaScript files

。_饼干妹妹 提交于 2019-12-19 03:47:07
问题 I have several WebSockets endpoints such as, wss://localhost:8181/ContextPath/Push All of such endpoint URLs are hard-coded in separate, external JavaScript files ( .js ). These JavaScript files are included in respective XHTML files as and when required. The host name and the context path should be evaluated programmatically instead of hard-coding all over the place where they are required. The host name ( localhost:8181 ) can be obtained in JavaScript using document.location.host but there

Passing enum value as parameter to bean method from JSF pages fail after migrating to tomcat

回眸只為那壹抹淺笑 提交于 2019-12-19 03:38:14
问题 I recently migrated my JSF app(using primefaces) from glassfish 3.1 to tomcat7 server. Previously passing the enum value as string to managed bean methods through actionlistener attribute worked(without the need for a converter to convert string to enum) but now it fails with javax.el.MethodNotFoundException . JSF page: <h:form> <h:outputLabel value="Title"/><br/> <p:inputText value="#{lobController.current.title}"/> <p:commandButton action="#{lobController.create('CAR')}" value="Post"/> </h

JSP EL ${stuff} syntax not working

痞子三分冷 提交于 2019-12-19 03:17:08
问题 I have two problems. The first one is that I'm using JSP and that I can't solve. The second one is that I'm getting an odd behavior. When I put this in the doGet() method of my servlet req.setAttribute("test", "SARASA"); req.getRequestDispatcher("WEB-INF/main.jsp").forward(req, resp); And this in "WEB-INF/main.jsp": <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%= request.getAttribute("test") %> <c:out value="${test}"/> The output is: SARASA ${test} I don't know what I'm

The function getMessageData must be used with a prefix when a default namespace is not specified [duplicate]

不打扰是莪最后的温柔 提交于 2019-12-19 02:48:07
问题 This question already has answers here : org.apache.jasper.JasperException: The function test must be used with a prefix when a default namespace is not specified (3 answers) Closed 6 years ago . I am getting this error /WEB-INF/jsp/account/index.jsp(6,0) The function getMessageData must be used with a prefix when a default namespace is not specified <c:set var="messageData" scope="session" value="${usermap.getMessageData()}"/> <c:set var="scheduleData" scope="session" value="${usermap

ManagedBean property not found

最后都变了- 提交于 2019-12-18 18:09:49
问题 In my webapp, when I click on the login link, the Tomcat webserver throws the following exception: exception javax.servlet.ServletException: /aluno_jsf.xhtml: Property 'logout' not found on type br.com.aluno.controller.LoginMB javax.faces.webapp.FacesServlet.service(FacesServlet.java:422) root cause javax.el.ELException: /aluno_jsf.xhtml: Property 'logout' not found on type br.com.aluno.controller.LoginMB [...] Here's my @ManagedBean: package br.com.aluno.controller; import java.io

convert timestamp value in EL to date time in jsp

柔情痞子 提交于 2019-12-18 17:56:07
问题 2014-02-26 18:27:24 jsp page <html> timestamp is : ${timestamp} Date is : <b> date </b> //display date Time is : <b> time </b> //display time </html> how to convert date and time from timestamp (EL)? 回答1: You can use JSP Standard Tag Library Formatting Tags that provides a set of tags for parsing and formatting locale-sensitive numbers and dates. If you have Date String then parse it into Date Object. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <c:set value="2014-02-26 18

JSP - Help in generating fixed number of link in pagination

放肆的年华 提交于 2019-12-18 17:04:56
问题 my pagination works good but I'm not able to understand how generate a fixed number of links to the pages. For example, I need to have 5 fixed links in this way: 1 - 2 - 3 - 4 - 5 > if I click on the third page I will see always 5 links: < 3 - 4 - 5 - 6 -7 > Now with my algorithm I'm only able to generate all the links, but I have no idea how create what I have explained above. This is my code(only for href generation): <div class="pageBoxRight"> <c:if test="${param.pageNumber > 1}"> <a href=

javax.el.PropertyNotFoundException when trying to resolve Boolean properties in EL

六月ゝ 毕业季﹏ 提交于 2019-12-18 15:05:11
问题 I have the following tree node class: public abstract class DocumentTreeNode extends TreeNodeImpl implements javax.swing.tree.TreeNode { private Boolean isToC; ... public Boolean isToC() { return isToC; } public void setToC(Boolean isToC) { this.isToC = isToC; } } This is a simple check box indicating whether the document is to be included in whatever or not. However, when trying to reference this from within JSF 2 EL ... <h:selectBooleanCheckbox value="#{node.isToC}" /> ... I get an

Should I choose == or eq for comparing string in EL?

为君一笑 提交于 2019-12-18 10:47:12
问题 == and eq give the same result using EL to do my string comparison tests: <c:if test="${person.sokande_i == 'endast_usa'}">Endast USA</c:if> <c:if test="${person.sokande_i == 'alla'}">Alla länder</c:if> <c:if test="${person.sokande_i == 'alla_utom_usa'}">Alla utom USA</c:if> Should I use eq instead? Is == for integers only? But it works also for strings. AFAIK == test whether hashCodes are equal and eq means "meaningfully different". Another question says == and eq do the same thing. Is there

Why there is a need of pageContext in JSP?

元气小坏坏 提交于 2019-12-18 10:22:51
问题 When we can access all the implicit variables in JSP, why do we have pageContext ? My assumption is the following: if we use EL expressions or JSTL, to access or set the attributes we need pageContext . Let me know whether I am right. 回答1: You need it to access non -implicit variables. Does it now make sense? Update : Sometimes would just like to access the getter methods of HttpServletRequest and HttpSession directly. In standard JSP, both are only available by ${pageContext} . Here are some