开发者

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

开发者 https://www.devze.com 2023-01-29 06:57 出处:网络
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:

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


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)


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


Have you tried wrapping it in another tag?

<span>&nbsp;</span>


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号