I can't insert a basic HTML whitespace without getting an error. Is there any other way?
Asked Answered
C

4

13

I have my implementation with spring, js, and other technologies, whenever i try to use a &nsbp; for white space it gives me the following error:

Caused by: org.apache.jasper.JasperException: /WEB-INF/views/entrada/list.jspx(94,67) The entity "nbsp" was referenced, but not declared.

at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
    at org.apache.jasper.compiler.JspDocumentParser.parse(JspDocumentParser.java:216)
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:239)
    at org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:120)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
    at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:650)
    at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:644)
    at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
    ... 106 more

My code:

</td>
        <td>
            <c:forEach items="${entrada.tags}" var="tag">
            <spring:url value="/find/ByTags?tags=${tag.id}" var="buscarTag"/>
                <a href="${buscarTag}">${tag}</a> &nbsp;
            </c:forEach>
        </td>
         <td><input type="hidden" class="horasIn" value="${entrada.horas}"/>
         ${fn:substring(entrada.horas, 0, 10)}
         <c:set var="totalHoras" value="${totalHoras+ entrada.horas }"></c:set>bs
Cost answered 4/12, 2010 at 0:10 Comment(0)
U
37

Try referring to it as the entity number for non-breaking space, &#160;

&#160; is a numeric character reference and works across HTML and XML. &nbsp; is a character entity reference that is defined in HTML but not XML. You could think of the character reference as an alias to the numeric representation of the character, and in this case (XML) it happens that the alias is not defined.

"160" is the number of the Unicode code point for non-breaking space. You could also write the numeric character reference as &#x00a0; (same thing, but in hex)

Umbrageous answered 4/12, 2010 at 1:37 Comment(2)
This looks likely to be right. As I understand it jspx requires well formed XML. nbsp is not defined in XML.Amethyst
It worked, but can you example me what does &#160; mean? It isn't declared neither anywhere or yes?Toots
K
4

You misspelled nbsp:

Caused by: org.apache.jasper.JasperException: /WEB-INF/views/entrada/list.jspx(94,67) The entity "nsbp" was referenced, but not declared. at ...

Keratose answered 4/12, 2010 at 0:22 Comment(0)
A
0

Have you tried wrapping it in another tag?

<span>&nbsp;</span>
Alit answered 4/12, 2010 at 0:18 Comment(0)
D
0

In my case only <c:out> tag works properly to put space between JSTL-variables. For example:

<c:set var="newVar" >
    <c:out value="${varOne} ${varTwo}" />
</c:set>

Hope it will help someone.

Downstroke answered 9/7, 2014 at 7:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.