如何将值或参数从jsp传递到Spring控制器? [英] How to pass value or param from jsp to Spring controller?

查看:172
本文介绍了如何将值或参数从jsp传递到Spring控制器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Spring控制器中的jsp文件访问一些值.我找到的所有示例都使用<input><form>代码,但是我想传递清除"值(仅字符串),例如<c:set var="name" value="Ololo"/>或类似的内容,并在Conroller中打印.

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.

推荐答案

您不能.从控制器到视图(jsp)的数据只能沿一个方向流动.如果必须将信息发送回控制器,则应发出http请求.这就是为什么您在示例中只看到<form><input>

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

这篇关于如何将值或参数从jsp传递到Spring控制器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆