JSF 2.1中的<f:viewParam>
和<f:param>
什么区别?
Simply put:
<f:viewParam>
is used inside <f:metadata>
to attach an UIViewParameter
as metadata for the current view. For example, if you access the page myapp/check.jsf?id=3
and your check.jsf
page has this:
<f:metadata>
<f:viewParam name="id" value="#{mrBean.id}"/>
</f:metadata>
The value 3
will be set on mrBean
's id
property when the page is loaded.
On the other hand, <f:param>
sets a parameter in the parent (enclosing) component of this tag, accessible later by obtaining the component's parameters themselves. This is in particular really powerful (yet, disastrous if used wrong) because through EL
you can achieve some interesting results.
It can be used in different contexts. This link provides an interesting range of applications.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.