简体   繁体   中英

HTML to JSP conversion issues

I want an HTML textbox value to be converted in a variable.
I have the following:

<input type="text" name="abc" value="0">
  <br>
    <%
      String contb = request.getParameter("abc");
      out.print("The result is: "+contb);
    %> 

Why do I receive a "NULL" result?

You want

<%
    String contb = request.getParameter("abc");
    out.print("The result is: " + contb);
    %> 

Note the spaces. If you leave no space between the string, "+" operator and contb then JavaScript cannot parse it as an operation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM