Java spring @RequestParam JSP -
current controller code:
@requestmapping(value = "/city", method = requestmethod.post) public string getweather(@requestparam("city") int city_id, @requestparam("text") string days, //this gives errrors, when remove line, okay model model) { logger.debug("received request show cities page"); //int city = // attach list of subscriptions model model.addattribute("city", service.getcity(city_id)); // resolve /web-inf/jsp/subscribers.jsp return "city"; }
this jsp file(view):
<form method="post" action="/spring/krams/show/city"> vali linn <select name="city"> <c:foreach items="${cities}" var="city"> <option value="<c:out value="${city.id}" />"><c:out value="${city.city}" /></option> </c:foreach> </select><br> vali prognoos n päeva kohta(kirjuta 1 hetkese ilma jaoks) <input type="text name="text"> <input type="submit" value="test" name="submit" /> </form>
i want value textbox named text, when press submit button
http status 400 - request sent client syntactically incorrect ().
i adding answer can accept it, suggested bozho :)
there seems problem in html: <input type="text name="text">
change <input type="text" name="text">
, try .
i think syntactically incorrect means names specified in @requestparam
annotations don't match request param names... possibly because of above error in html.
Comments
Post a Comment