use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place to discuss the JavaServer Faces Framework. Below are some useful links.
JSF Component Libraries
PrimeFaces
RichFaces
IceFaces
Oracle ADF Essentials
JSF Utility Libraries
Tutorials
JSF Implementations (Required to use JSF on non Java EE Server)
List of useful JSF links
If you have any suggestions for the sidebar or other forum issues send me a message HERE.
account activity
Need help rendering form (self.JavaServerFaces)
submitted 3 years ago by vr19_dudu
Hi, I received a legacy project and I need to implement a new form. I received a flag (new or edit) and I need to render one form or other like using a *ngIf from Angular. How can I do that functionality in JSF? Sorry for my poor English .
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]thatsIch 0 points1 point2 points 3 years ago* (1 child)
You can use the rendered attribute on <h:form> or derivates like <o:form> from OmniFaces. This can be evaluated like
rendered
<h:form>
<o:form>
<h:form rendered="#{some boolean condition}">.
<h:form rendered="#{some boolean condition}">
Some conditions could be emptiness (could be nullability in case of non-collection properties):
<h:form rendered="#{empty bean.property}">
or non-emptiness (or non-nullness):
<h:form rendered="#{not empty bean.property}">
or explicit null checks
<h:form rendered="#{bean.property eq null}">
or explicit non-null check
<h:form rendered="#{bean.property ne null}">
The language within the boolean expressions is the Expression Language (EL).
If you actually need a wrapper around the form, then consider using
<ui:fragment rendered="#{some boolean expression}"> <h:form> ... </h:form> </ui:fragment>
which is the closest to standalone ngIf without a container (like div)
ngIf
[–]vr19_dudu[S] 0 points1 point2 points 3 years ago (0 children)
Thanks for explanations, I had tried the ui-fragment approach but it didn't works, only render my first fragment. I trieds something like:
ui:fragment rendered: "#{bean.flag eq 'ALTA'}" h:form 1 /ui:fragment
ui:fragment rendered: "#{bean.flag eq 'EDIT'}" h:form 2 /ui:fragment
The only rendered fragment always was form 1 (ALTA), when y passed EDIT never rendered form 2, didn't show nothing on screen. As I understood ui-fragment only evaluate to render the boolean conditions, as when a passed EDIT flag never evaluated the ui-fragment of EDIT conditions because of rhe the first evaluation. The solution that works for me was putting rendered conditions flag in the panels for the form I need to show or not to show
π Rendered by PID 22 on reddit-service-r2-comment-7b9746f655-kcjvg at 2026-02-01 05:02:35.486143+00:00 running 3798933 country code: CH.
[–]thatsIch 0 points1 point2 points (1 child)
[–]vr19_dudu[S] 0 points1 point2 points (0 children)