useBean setProperty 的行为不符合广告

发布于 2024-09-29 11:40:04 字数 505 浏览 0 评论 0原文

我试图在请求属性和 bean 之间使用“自动连接”,

<jsp:useBean id="cib" class="(fqn).CarInfoWebBean" scope="request">
    <jsp:setProperty name="cib" property="*" /></jsp:useBean>  

但(唯一)属性的设置器不会被调用。

bean属性的类型为long,并且属性名和属性名是匹配的。
奇怪的是,它

<jsp:setProperty name="cib" property="carId" param="carId"/>

也不起作用,但

<jsp:setProperty name="cib" property="carId" value="${carId}"/>

工作得很好。

I'm trying to use "auto wiring" between request attributes and a bean with

<jsp:useBean id="cib" class="(fqn).CarInfoWebBean" scope="request">
    <jsp:setProperty name="cib" property="*" /></jsp:useBean>  

but the setter of the (only) property doesn't get called.

The bean property is of type long, and the property name and attribute name are matching.
The strange thing is that

<jsp:setProperty name="cib" property="carId" param="carId"/>

isn't working either, but

<jsp:setProperty name="cib" property="carId" value="${carId}"/>

is working just fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

留蓝 2024-10-06 11:40:04

原来param属性和property(*)只能获取请求参数,不能获取请求属性……

It turns out that param attribute and property(*) can get only request parameters, not request attributes...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文