我难住了。我有一个带有输入文本的表单,我希望用户填充它,当他们点击添加按钮时,使用 f:param 设置这些属性。当我尝试从上下文中获取它们时,这些值不断返回为空:
<h:form>
<h1 align="center" style="font-size: 12pt; color: green">Enter the details for the new product</h1>
<br/>
<div align="center">
<h:outputLabel id="productNameLabel"
value="Product Name " />
<h:inputText id="productName" value="#{product.productName}" />
</div>
<br/>
<div align="center">
<h:outputLabel id="productDescriptionLabel"
value="Product Description " />
<h:inputText id="description" value="#{product.description}" />
</div>
<br/>
<div align="center">
<h:outputLabel id="productQuantity"
value="Product Quantity " />
<h:inputText id="quantity" value="#{product.quantity}" />
</div>
<div align="center">
<h:commandButton value="Submit" action="welcome">
<f:param name="creating" value="true"/>
<f:param name="name" value="#{product.productName}" />
<f:param name="description" value="#{product.description}" />
<f:param name="quantity" value="#{product.quantity}" />
</h:commandButton>
</div>
</h:form>