conditional-rendering

How to conditionally display elements of JSP page depending on user role

房东的猫 提交于 2019-11-29 08:54:10
How to load menu on webpage depends upon login user? I want to make websites where some menu will show before login and after login it will show more menu depends upon login user if admin is login then some administraive menu will appear if normal user is login then some different menu will be added. I want to build this project using JSP/Servlet. When user click on any menu total page will not be reloaded only some part will be changed where show the details description of this menu. BalusC You can just use JSTL to programmatically control the flow in the HTML output of the JSP. You can check

p:column rendered attribute does not seem to work with p:dataTable var

孤人 提交于 2019-11-29 07:48:49
I have written a code like: <p:column headerText="Edit" width="40" rendered="#{(leaveDetails.strLeaveStatus == 'Canceled') or (leaveDetails.strLeaveStatus == 'Availed')}"> <p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="true" process="@this" update="leaveDataTable" immediate="false"> <h:graphicImage url="resources/images/edit.JPG"/> <f:attribute name="userId" value="#{employee.name}"/> <f:attribute name="editFirstHalf" value="#{leaveDetails.strStartTiming}"/> <f:attribute name="editSecondHalf" value="#{leaveDetails.strEndTiming}"/> <f:attribute name=

Conditionally render JSF components for printing

放肆的年华 提交于 2019-11-28 12:55:41
I want to print only a certain part of my webpage (so not the whole page). How can I achieve this in JSF? This is normally to be controlled by CSS with display: none|block . Check the CSS media rules . For example, as @media print {} inside a default CSS file: @media print { #header, #footer, #menu { display: none; } } (the above example will hide HTML elements with IDs header , footer and menu ) Or via a generic style class: @media screen { .printonly { display: none; } } @media print { .noprint { display: none; } .printonly { display: block; } } You then add styleClass="noprint" to those

Conditionally render a component based on selectOneMenu value

自闭症网瘾萝莉.ら 提交于 2019-11-28 05:55:09
问题 Is there a way to render a component based on the current value the user has selected from a selectOneMenu component? My selectOneMenu component is populated with an enum consisting of two values, smoker and non-smoker. If the user has smoker selected I want to render a checkbox below it which lets the user check how many they smoke a day 10, 20, 30+, etc. I also want the opposite to work if they user has selected non-smoker i.e. the check boxes don't render/disappear. 回答1: Just check the

How to conditionally display elements of JSP page depending on user role

女生的网名这么多〃 提交于 2019-11-28 02:09:21
问题 How to load menu on webpage depends upon login user? I want to make websites where some menu will show before login and after login it will show more menu depends upon login user if admin is login then some administraive menu will appear if normal user is login then some different menu will be added. I want to build this project using JSP/Servlet. When user click on any menu total page will not be reloaded only some part will be changed where show the details description of this menu. 回答1:

p:column rendered attribute does not seem to work with p:dataTable var

℡╲_俬逩灬. 提交于 2019-11-28 01:21:00
问题 I have written a code like: <p:column headerText="Edit" width="40" rendered="#{(leaveDetails.strLeaveStatus == 'Canceled') or (leaveDetails.strLeaveStatus == 'Availed')}"> <p:commandLink actionListener="#{userLeaveBean.editAppliedLeave}" title="Edit" disabled="true" process="@this" update="leaveDataTable" immediate="false"> <h:graphicImage url="resources/images/edit.JPG"/> <f:attribute name="userId" value="#{employee.name}"/> <f:attribute name="editFirstHalf" value="#{leaveDetails

Conditional rendering of non-JSF components (plain vanilla HTML and template text)

一个人想着一个人 提交于 2019-11-27 05:06:25
I'm trying to conditionally render a <tr> therefore I cannot use <h:panelGroup> as it will render to <span> or <div> My current (working) approach is the following: <h:outputFormat rendered="#{negotiator.maySend}"> <tr> my tr stuff </tr> </h:outputFormat> This works, but I'm not sure if that's the way to abuse <h:outputFormat> - before that I used <h:outputLabel> but this was rendered to <label> in IE. I have also read the answers to this question, but as mentioned above, they won't work for me because of the <tr> : How to not render whole block in JSF? BalusC I cannot use <h:panelGroup> as it

Form submit in conditionally rendered component is not processed

大城市里の小女人 提交于 2019-11-26 23:19:13
I have a custom tagfile with a form: <h:form> <h:commandButton value="click"> <f:ajax event="click" listener="#{bean[method]}" /> </h:commandButton> </h:form> I'm conditionally rendering it by ajax as below: <h:panelGroup id="test"> <h:form> <h:commandButton value="click"> <f:ajax event="click" listener="#{backingTest.updateFlag}" render=":test"/> </h:commandButton> </h:form> <h:panelGroup rendered="#{backingTest.flag}"> <my:customtag bean="#{backingTest}" method="printMessage"/> </h:panelGroup> </h:panelGroup> This is the associated backing bean: import javax.faces.bean.ManagedBean; import

Conditional rendering of non-JSF components (plain vanilla HTML and template text)

淺唱寂寞╮ 提交于 2019-11-26 11:27:48
问题 I\'m trying to conditionally render a <tr> therefore I cannot use <h:panelGroup> as it will render to <span> or <div> My current (working) approach is the following: <h:outputFormat rendered=\"#{negotiator.maySend}\"> <tr> my tr stuff </tr> </h:outputFormat> This works, but I\'m not sure if that\'s the way to abuse <h:outputFormat> - before that I used <h:outputLabel> but this was rendered to <label> in IE. I have also read the answers to this question, but as mentioned above, they won\'t

Form submit in conditionally rendered component is not processed

牧云@^-^@ 提交于 2019-11-26 08:37:39
问题 I have a custom tagfile with a form: <h:form> <h:commandButton value=\"click\"> <f:ajax event=\"click\" listener=\"#{bean[method]}\" /> </h:commandButton> </h:form> I\'m conditionally rendering it by ajax as below: <h:panelGroup id=\"test\"> <h:form> <h:commandButton value=\"click\"> <f:ajax event=\"click\" listener=\"#{backingTest.updateFlag}\" render=\":test\"/> </h:commandButton> </h:form> <h:panelGroup rendered=\"#{backingTest.flag}\"> <my:customtag bean=\"#{backingTest}\" method=\