How do I pass current item to Java method by clicking a hyperlink or button in JSP page?

Simplest way: just let the link point to a JSP page and pass row ID as parameter: <a href=”delete.jsp?id=1″>delete</a> And in delete.jsp (I’m leaving obvious request parameter checking/validating aside): <% dao.delete(Long.valueOf(request.getParameter(“id”))); %> This is however a pretty poor practice (that was still an understatement) and due to two reasons: HTTP requests which modifies the data … Read more

How to internationalize/localize a JSP/Servlet web application?

In case of a basic JSP/Servlet webapplication, the basic approach would be using JSTL fmt taglib in combination with resource bundles. Resource bundles contain key-value pairs where the key is a constant which is the same for all languages and the value differs per language. Resource bundles are usually properties files which are loaded by … Read more

How to reference constants in EL?

EL 3.0 or newer If you’re already on Java EE 7 / EL 3.0, then the @page import will also import class constants in EL scope. <%@ page import=”com.example.YourConstants” %> This will under the covers be imported via ImportHandler#importClass() and be available as ${YourConstants.FOO}. Note that all java.lang.* classes are already implicitly imported and available … Read more

javax.el.PropertyNotFoundException: Property ‘foo’ not found on type com.example.Bean

javax.el.PropertyNotFoundException: Property ‘foo’ not found on type com.example.Bean This literally means that the mentioned class com.example.Bean doesn’t have a public (non-static!) getter method for the mentioned property foo. Note that the field itself is irrelevant here! The public getter method name must start with get, followed by the property name which is capitalized at only … Read more

Java / Jakarta EE web development, where do I start and what skills do I need? [closed]

(Updated Apr 2021) First of all, “Java EE” has since Sep 2019 been renamed to “Jakarta EE“, starting with version 8. Historically, there was also the term “J2EE” which covered versions 1.2 until 1.4. The “Java EE” covered versions 5 until 8. See also Java Platform, Enterprise Edition, History on Wikipedia. What exactly do I … Read more

How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved

org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application That URI is for JSTL 1.0, but you’re actually using JSTL 1.2 which uses URIs with an additional /jsp path (because JSTL, who invented EL expressions, was since version 1.1 integrated as part of JSP 2.0 … Read more