How to pass value or param from jsp to Spring cont

2019-09-05 22:49发布

问题:

I'm trying access some value from my jsp file in Spring controller. All examples that I've found was with <input> or <form> code, but I want to pass "clear" value (just String), for example <c:set var="name" value="Ololo"/>or smth like this and print it in Conroller.

回答1:

You can't. Data can flow only in one direction, from controller to view (jsp). If you have to send information back to the controller then you should make http request. That's the reason you only see <form> and <input> in examples