Show or hide HTML DIV in JSF 1.2

When the implementation of Apache My Faces JSF 1.2 renders the HTML page behind the scenes, it is even possible to install / encode something that conditionally displays a clean HTML table / DIV (NOT the jsf component). When I searched, I saw this using h: panelGroup - this is the solution, but I have not tried it yet, posting here any best methods or approaches.

Its almost as I would like to say - write javascript code in java and enter it when rendering HTML - is this possible?

Thank,

+3
source share
1 answer

A few ways.

  • Use <h:panelGroup layout="block">. It displays an HTML element <div>.

    <h:panelGroup layout="block" rendered="#{bean.condition}">
        content
    </h:panelGroup>
    
  • HTML <div> <h:panelGroup>. - , id, styleClass, onclick .., <h:panelGroup> . , , <span> ( <div>, layout block).

    <h:panelGroup rendered="#{bean.condition}">
        <div>content</div>
    </h:panelGroup>
    
  • HTML <div> <f:verbatim>.

    <f:verbatim rendered="#{bean.condition}">
        <div>content</div>
    </f:verbatim>
    

, , , MyFaces HTML. Mojarra JSF . Struts2, Spring MVC, Wicket, Tapestry ..... . Microsoft ASP.NET MVC . PHP . . - , - . HTML/CSS/JS;)

JavaScript Java/JSP/JSF, .

+12
source

Source: https://habr.com/ru/post/1752526/


All Articles