NumberFormatException error with parsing strings to doubles, from html form! (servlets) : <p>I'm having an HTTP Status 500 – Internal Server Error, to be more specific:</p>

<pre><code>Type Exception Report

Message For input string: "from"

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.lang.NumberFormatException: For input string: "from"
sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
java.lang.Double.parseDouble(Double.java:538)
java.lang.Double.valueOf(Double.java:502)
servlets.Servlet2.doGet(Servlet2.java:31)
javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Note The full stack trace of the root cause is available in the server logs.
</code></pre>

<p>The situation I'm trying to resolve is that I have Servlet1 that has an html form with two numeric inputs, when you sumbit them, they send to Servlet2 that takes those inputs check them through an if statement and then parse the strings to doubles. Then the value between those inputs will be the data that will appear. So, I'm getting an error for NumberFormatException, I don't get it where I'm wrong. In the snippet I'm posting I was trying to workaround the problem with the method valueOf, still same problem.</p>

<pre><code>    double douFrom = 0;
    double douTo = 0;
    String from = request.getParameter("from");
    String to = request.getParameter("to");

    boolean val = true;

    if ((from != null) &amp;&amp; (to != null) &amp;&amp; from.matches(".*[0-9]+.*") &amp;&amp; to.matches(".*[0-9]+.*") &amp;&amp; (from.length()&gt;0) &amp;&amp; (to.length()&gt;0)) {
        douFrom = Double.valueOf("from");
        douTo = Double.valueOf("to");
    } else {
        val = false;
    }
</code></pre>

<p>Thanks in advance!</p>
