Note that there are some explanatory texts on larger screens.

plurals
  1. POException while replacing backslashes to slashes
    primarykey
    data
    text
    <p>in my application I need to prepare a path for XML file inside JSP page. I'm doing someting like this:</p> <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt; &lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %&gt; &lt;!DOCTYPE html&gt; &lt;c:set var="abs_path" value='&lt;%= getServletContext().getRealPath("").replace(" ", "%20").replace("\\", "/") %&gt;' /&gt; </code></pre> <p>But there is a problem, I get the followind exception:</p> <p>org.apache.jasper.JasperException: Unable to compile class for JSP: </p> <pre><code>An error occurred at line: 6 in the jsp file: /users.jsp String literal is not properly closed by a double-quote 3: &lt;%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt; 4: &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/xml" prefix="x" %&gt; 5: &lt;!DOCTYPE html&gt; 6: &lt;c:set var="abs_path" value='&lt;%= getServletContext().getRealPath("").replace(" ", "%20").replace("\\", "/") %&gt;' /&gt; </code></pre> <p>Apparently it's about this part: <code>.replace("\\", "/")</code> When I delete it, I don't get this exception.</p> <p>What's that about? I will be very grateful for any clue.</p> <p>EDIT:</p> <p>I use this variable in the following way:</p> <pre><code> &lt;c:import url="file:/${abs_path}/MyProject/xml/users.xml" var="inputDoc" charEncoding="UTF-8" /&gt; &lt;c:import url="xsl/users_list.xsl" var="stylesheet" charEncoding="UTF-8" /&gt; &lt;x:transform xml = "${inputDoc}" xslt = "${stylesheet}"&gt; &lt;/x:transform&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload