更新时间:2021-11-30 02:30:41
与JSF在幕后所做的相同:获取HTTP请求参数.如果您熟悉基本的HTML,那么您就会知道每个HTML输入元素都会将其name=value
对作为HTTP请求参数发送.
Just do the same as JSF is doing under the covers: grabbing the HTTP request parameter. If you're familiar with basic HTML, you know that every HTML input element sends its name=value
pair as HTTP request parameter.
给出一个
<h:form id="formId">
<p:inputText id="userId" /> <!-- Note: no value attribute at all, also no empty string! -->
...
<p:commandButton value="submit" action="#{bean.submit}" />
</h:form>
基本上会生成 以下HTML
which generates basically the following HTML
<form id="formId" name="formId">
<input type="text" name="formId:userId" ... />
...
<button type="submit" ...>submit</button>
</form>