jsp

Is it good to use JSF and JSP in same time [duplicate]

不羁的心 提交于 2020-08-10 20:12:05
问题 This question already has answers here : What is the need of JSF, when UI can be achieved with JavaScript libraries such as jQuery and AngularJS (8 answers) What is the difference between creating JSF pages with .jsp or .xhtml or .jsf extension (2 answers) Closed 4 days ago . Im begginer at programming and im trying to create one simple site for booking movie tickets. So i created JSP pages for admin home page, user home page, login page and register page. I just want to know, because I want

Iterating over an ArrayList with c:foreach (JSP/JSTL), Variable doesn't work

只谈情不闲聊 提交于 2020-08-05 05:32:18
问题 There are countless examples out there for my problem, I know, but I went through a lot of them and can't figure out where my mistake is. I am iterating over an ArrayList(TestSzenario). The class TestSzenario contains a String Variable called name with proper getters and setters. Here's my code: <td><select name="selectSzenario" id="selectSzenario" size="1"> <c:forEach items="<%=testszenario.getSzenariosForSummary() %>" var="szenario"> <option>${szenario.name}</option> </c:forEach></select><

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

JSTL c:if does not recognize String inside ${} and causes EL syntax error

让人想犯罪 __ 提交于 2020-07-27 03:28:52
问题 Why are the "POST" and "submit" parts of this code highlighted in a different color in my IDE? Also the syntax highlighter here doesn't highlight them in same color. <c:if test="${"POST".equalsIgnoreCase(pageContext.request.method) && pageContext.request.getParameter("submit") !=null}"> </c:if> Does that mean that EL does not recognize the string and so gives me an EL syntax error? How can I solve this? 回答1: Inside the <c:if> , your test attribute is a also a string, which is set with double

JSTL c:if does not recognize String inside ${} and causes EL syntax error

若如初见. 提交于 2020-07-27 03:28:10
问题 Why are the "POST" and "submit" parts of this code highlighted in a different color in my IDE? Also the syntax highlighter here doesn't highlight them in same color. <c:if test="${"POST".equalsIgnoreCase(pageContext.request.method) && pageContext.request.getParameter("submit") !=null}"> </c:if> Does that mean that EL does not recognize the string and so gives me an EL syntax error? How can I solve this? 回答1: Inside the <c:if> , your test attribute is a also a string, which is set with double

Sending data from servlet to jsp?

梦想与她 提交于 2020-07-16 07:56:10
问题 I have a form in a jsp from which i am retrieving data to servlet via doPost method, suppose username and password now there is an empty textarea field inside the same form where i want to send the username from servlet,how do i do it? 回答1: I don't really understand your case. But there're 2 common ways to send data from servlet to JSP: Request attributes : you can use this if data is transferred along a same request. request.setAttribute("username",obj); request.getRequestDispatcher("url")

Sending data from servlet to jsp?

大城市里の小女人 提交于 2020-07-16 07:56:05
问题 I have a form in a jsp from which i am retrieving data to servlet via doPost method, suppose username and password now there is an empty textarea field inside the same form where i want to send the username from servlet,how do i do it? 回答1: I don't really understand your case. But there're 2 common ways to send data from servlet to JSP: Request attributes : you can use this if data is transferred along a same request. request.setAttribute("username",obj); request.getRequestDispatcher("url")