且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

JSF读取托管bean中的动态输入元素

更新时间:2023-10-06 09:25:46

这是输入的 name = value 一对作为请求参数发送 name = value ,而不是 id = value 。您需要改为设置名称属性。

It's the input's name=value pair which get sent as request parameter name=value, not the id=value. You need to set the name attribute instead.

<input id="ft2" name="ft2" type="text" value="foo"/>






无关具体问题,我建议使用 @ManagedProperty 来设置值:


Unrelated to the concrete problem, I suggest to use @ManagedProperty instead to set the value:

@ManagedProperty("#{param.ft2}")
private String ft2;