开发者

Mixing JSF Tag and HTML

I just started out using JSF 2.0 but I found myself mixing JSF tags with standard HTML tag to achieve the desired layout. Although I am using the facelets to layout my pages, but I think I cant help but mix components.

<开发者_运维技巧ui:define name="content">
    <h:form>
        <h:commandButton value="Search" action="#{myBean.handleSearch}"/>
        <h:commandButton value="Reset" action="#{myBean.handleReset}"/>
        <div>
            <!-- Some JSF component -->
        </div>

I have been thinking if I have been running into bad practice. Any source of info for this? Thanks


This is not a bad practice. This is perfectly fine. The only reason to use a JSF component is to have access to it in the JSF component tree. It would be a more poor practice to use <h:panelGroup layout="block"> instead of <div> here. But if it was a container of which you'd like to ajax-update its content, then a <h:panelGroup id="foo" layout="block"> would have been perfectly fine as would an 'html5-friendly' <div jsf:id="foo"> with the xmlns:jsf="http://xmlns.jcp.org/jsf" namespace.

For a bit of history, you may find this useful: JSF vs HTML(JSP) for enterprise portals UI layer. Which one to Choose? and WHY?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜