-1

I have a form created with bootstrap and I use spring MVC. I don't use spring security here.

<form role="form">
    <fieldset>
        <div class="form-group">
            <input class="form-control" placeholder="Username" name="name" type="text" autofocus>
        </div>
        <div class="form-group">
            <input class="form-control" placeholder="Password" name="password" type="password">
        </div>
        <a href="<c:url value="welcome"/>" class="btn btn-lg btn-success btn-block">Login</a>
    </fieldset>
</form>

I want to send the username and password to the welcome url. How can I do that.

Now, when I use @RequestParam("name") annotation, it gives an

Required String parameter 'name' is not present

error.

Undo
  • 25,519
  • 37
  • 106
  • 129
bula
  • 8,719
  • 5
  • 27
  • 44

1 Answers1

1

Set the 'action' attribute of the form to the url that you want to submit the form to.

The url can be absolute (http ://...) or relative (some/path), depending on where the page is hosted.

You may need to set the 'method' attribute on the form to POST , if the server expects a POST request.

You also want a submit button too

Neil McGuigan
  • 46,580
  • 12
  • 123
  • 152