Note that there are some explanatory texts on larger screens.

plurals
  1. PONumberFormatException using <c:url in jsp
    primarykey
    data
    text
    <p>In my web app,I have an Item class with </p> <pre><code>public class Item { private Long item_id; private String name; ... } ... &lt;servlet-mapping&gt; &lt;servlet-name&gt;edititemservlet&lt;/servlet-name&gt; &lt;url-pattern&gt;/edititem&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; ... </code></pre> <p>While listing the items,I tried to use <pre><code>&lt;a href="&lt;c:url value="editItem?itemId=${item.item_id}" /&gt;" &gt;${item.name}&lt;/a&gt; </code></pre> <p>This works .But, when I tried the following to use </p> <pre><code>&lt;c:url value="editItem" var="editItemurl"&gt; &lt;c:param name="itemId" value="${item.item_id}" /&gt; &lt;/c:url&gt; &lt;c:forEach var="item" items="${items}" varStatus="itemslistCount"&gt; &lt;tr&gt;&lt;td&gt;${itemslistCount.count} &lt;/td&gt; &lt;td&gt;&lt;a href="${editItemurl}" &gt;${item.name}&lt;/a&gt;&lt;/td&gt; </code></pre> <p>I expected to get the same result. But this causes NumbeFformatException .</p> <pre><code>java.lang.NumberFormatException: For input string: "" java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) java.lang.Long.parseLong(Long.java:424) </code></pre> <p>I tried to print ${editItemurl} and it displays an empty string.</p> <p>Any idea how I can correct this?</p> <p>thanks</p> <p>mark</p> <p>p.s: here is the stack trace</p> <pre><code>java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:424) at java.lang.Long.parseLong(Long.java:461) at myshop.servlets.ItemEditServlet.doGet(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) 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.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:619) </code></pre>
    singulars
    1. This table or related slice is empty.
    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