简体   繁体   English

如何将值或参数从jsp传递到Spring控制器?

[英]How to pass value or param from jsp to Spring controller?

I'm trying access some value from my jsp file in Spring controller. 我正在尝试从Spring控制器中的jsp文件访问一些值。 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. 我发现的所有示例都是使用<input><form>代码的,但是我想传递“清除”值(仅字符串),例如<c:set var="name" value="Ololo"/>或类似的东西并在Conroller中打印。

You can't. 你不能 Data can flow only in one direction, from controller to view (jsp). 从控制器到视图(jsp)的数据只能沿一个方向流动。 If you have to send information back to the controller then you should make http request. 如果必须将信息发送回控制器,则应发出http请求。 That's the reason you only see <form> and <input> in examples 这就是您在示例中仅看到<form><input>的原因

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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