简体   繁体   中英

How to send a path from a HTML form to a servlet?

I want to send path(it is the path of a properties file) from a HTML form to the servlet. How would the servlet read the path?What should be the code to be written in the servlet?

I think you could solve this by doing something like this:

  <!DOCTYPE html>
  <html>
    <body>
      <form action="demo_form.asp">
        First name: <input type="text" name="fname"><br>
        <input type="hidden" name="country" value="Norway">
        <input type="submit" value="Submit">
      </form>
      <p>Notice that the hidden field above is not shown to a user.</p>
    </body>
 </html>

In your servlet You then call the doPost method and the .getParameter("country") The example above is from: http://www.w3schools.com/tags/att_input_type.asp I hope this is the solution for your problem

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