How to pass Unicode characters as JSP/Servlet request.getParameter?

That can happen if request and/or response encoding isn’t properly set at all. For GET requests, you need to configure it at the servletcontainer level. It’s unclear which one you’re using, but for in example Tomcat that’s to be done by URIEncoding attribute in <Connector> element in its /conf/server.xml. <Connector … URIEncoding=”UTF-8″> For POST requests, … Read more

What causes “java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name ‘command’ available as request attribute”?

You’re trying to use Spring MVC’s form tag. This tag renders an HTML form tag and exposes a binding path to inner tags for binding. It puts the command object in the PageContext so that the command object can be accessed by inner tags. [..] Let’s assume we have a domain object called User. It … Read more

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 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

EL expressions not evaluated in JSP

Yes, i have doctype in web.xml <!DOCTYPE web-app PUBLIC “-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN” “java.sun.com/dtd/web-app_2_3.dtd”; > Remove that <!DOCTYPE> from web.xml and make sure that the <web-app> is declared conform Servlet 2.4 or newer and all should be well. A valid Servlet 3.0 (Tomcat 7, JBoss AS 6-7, GlassFish 3, etc) compatible web.xml look … Read more