博文

目前显示的是标签为“jsp”的博文

javax.servlet.jsp.el.ELException: Unable to find a value for "name" in object of class "java.lang.String" using operator "."

This is piece of jstl problem that is difficult to identify. A. When using <c:forEach> tag you sometimes get a error message like this: javax.servlet.jsp.el.ELException: Unable to find a value for "name" in object of class "java.lang.String" using operator "." Before knocking your head on the wall, check if there is trailing space(s) in the attribute like this one:  items="${orderList} _ " (I mark it as underscore so you easily see it.) And that's the problem! B. Suppose you have an inner class with default package access. Now you have a model attribute in your controller, which is having member of this inner class type, and in the jsp you find you can not refer to it using . operator with expression language. In such case you must declare the inner class as public. That's because even in your controller you can access the inner class, but the bean is not in "same package" when you access with jstl.

Escaping in JSP for JSP and JS

Escaping for JSP A JSP page will eventually rendered as HTML content in browser. In that case, lots of character like <, &, > need to be escaped before directly display them on the HTML page. This is when we need the escape for xml for html for JPS page. To escape, you could use this in JSP page <%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> ${fn:escapeXml(myString)} or <c:out value="${myString}"/> Escaping for Javascript Sometimes in JSP page we write Javascript code. The javascript code has its own understand of character like single quote ' and double quote ", this is when we need escape in JSP but for the javascript usage. The best way to do that is create a utility tag libary <?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation...

404.jsp cause ClientAbortException on Tomcat

2009-09-29 11:29:10,425 [http-443-Processor23] WARN org.apache.catalina.core.ContainerBase.[Catalina].[localhost] - Exception Processing ErrorPage[errorCode=404, location=/error/notfound.jsp]  ClientAbortException: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error  at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:366)  ...  Caused by: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error  ...  Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error  at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)  ...  Caused by: java.net.SocketException: Connection reset by peer: socket write error  ......