Sathish David Kumar N
asked on
How to use <c: if > inside <ul>,<li> HTMl tags
Hi ,
Iook this code i want to use <c:if> inside the code bcz i want to display spme of the menu only to the user some menu not display to some other user !!
Iook this code i want to use <c:if> inside the code bcz i want to display spme of the menu only to the user some menu not display to some other user !!
<ul id="ddsubmenu3" class="ddsubmenustyle">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
<li><a href="${pageContext.request.contextPath}/menuAccess.htm?">User Role Maintenance</a></li>
<li><a href="#">OpLoc Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</ul>
</li>
<li><a href="#">Approval Limit Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCApprover.htm">Create Approver</a></li>
</ul>
</li>
<li><a href="#">Supplier Management</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaSupplierC.htm">Create Supplier</a></li>
<li><a href="${pageContext.request.contextPath}/papaSupplierS.htm">Search Supplier</a></li>
</ul>
</li>
<li>
<a href="#">Organization Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaOrgnizationLevelController.htm">Create </a></li>
<li><a href="http://192.168.3.17/ReportServer/Pages/ReportViewer.aspx?%2fPAPA_Reports%2fOrganisational_Hierarchy&rs:Command=Render" target="_blank">View</a></li>
</ul>
</li>
</ul>
ASKER
ya i done u told !!
the ul sub menu !! so i cant omit !!
if i give ul inside <c:if> means tha blank page only coming thats my big pblm how to solve this ???
the ul sub menu !! so i cant omit !!
if i give ul inside <c:if> means tha blank page only coming thats my big pblm how to solve this ???
<c:if test="yourcodition">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
<li><a href="${pageContext.request.contextPath}/menuAccess.htm?">User Role Maintenance</a></li>
<li><a href="#">OpLoc Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</ul>
</c:if>
you can use multiple if conditions on each link that you want to show and the link you do not want to show..
mean you can use <c:if> around the <li> elements leave ul elements as is.
like the code sample I gave.. you can use another if condition for another link and so on..
mean you can use <c:if> around the <li> elements leave ul elements as is.
like the code sample I gave.. you can use another if condition for another link and so on..
<ul id="ddsubmenu3" class="ddsubmenustyle">
<c:if test="yourcodition">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
</c:if>
<c:if test="anothercodition">
<li><a href="${pageContext.request.contextPath}/menuAccess.htm?">User Role Maintenance</a></li>
</c:if>
<li><a href="#">OpLoc Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</ul>
</li>
<li><a href="#">Approval Limit Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCApprover.htm">Create Approver</a></li>
</ul>
</li>
<li><a href="#">Supplier Management</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaSupplierC.htm">Create Supplier</a></li>
<li><a href="${pageContext.request.contextPath}/papaSupplierS.htm">Search Supplier</a></li>
</ul>
</li>
<li>
<a href="#">Organization Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaOrgnizationLevelController.htm">Create </a></li>
<li><a href="http://192.168.3.17/ReportServer/Pages/ReportViewer.aspx?%2fPAPA_Reports%2fOrganisational_Hierarchy&rs:Command=Render" target="_blank">View</a></li>
</ul>
</li>
</ul>
ASKER
if i give ul inside <c:if> means tha blank page only coming thats my big pblm how to solve this ???
i want to hide some menu !
check this code if i give like tht means ...
display balnk page
reaming thing coming another if condition!1
i want to hide some menu !
check this code if i give like tht means ...
display balnk page
reaming thing coming another if condition!1
<c:if test="yourcodition">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
<li><a href="${pageContext.request.contextPath}/menuAccess.htm?">User Role Maintenance</a></li>
<li><a href="#">OpLoc Maintenance</a>
<ul>
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</ul>
</c:if>
ASKER
This is the code i have change ..
but still i have blank page only !!
Help me how to do this !!
but still i have blank page only !!
Help me how to do this !!
<ul id="ddsubmenu3" class="ddsubmenustyle">
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
<li><a href="#">User Role Maintenance</a></li>
<li><a href="#">OpLoc Maintenance</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li><a href="#">Approval Limit Maintenance</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaCApprover.htm">Create Approver</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li><a href="#">Supplier Management</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaSupplierC.htm">Create Supplier</a></li>
<li><a href="${pageContext.request.contextPath}/papaSupplierS.htm">Search Supplier</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li>
<a href="#">Organization Maintanance</a>
</c:if>
<ul>
<li><a href="${pageContext.request.contextPath}/papaOrgnizationLevelController.htm">Create </a></li>
<li><a href="http://192.168.3.17/ReportServer/Pages/ReportViewer.aspx?%2fPAPA_Reports%2fOrganisational_Hierarchy&rs:Command=Render" target="_blank">View</a></li>
</ul>
<c:if test="${role eq 'ADM}">
</li>
</c:if>
</ul>
your if condition is written wrongly..
it should be written as
<c:if test="${role == 'ADM'}">
for it to work...
if you can post your whole code then may be I will be able to see what you are doing wrong.
it should be written as
<c:if test="${role == 'ADM'}">
for it to work...
if you can post your whole code then may be I will be able to see what you are doing wrong.
ASKER
This code only i used
for buyer,app are working other than ADM !!
bcz ADM only have sub Menu !!
Check and help me plz
for buyer,app are working other than ADM !!
bcz ADM only have sub Menu !!
Check and help me plz
<ul>
<li><a href="#">Home</a></li>
<li><a href="#" rel="ddsubmenu1">Purchase Request(PR)</a></li>
<li><a href="#" rel="ddsubmenu2">Purchase order(PO) </a></li>
<li><a href="#" rel="ddsubmenu3">Maintenance</a></li>
<li><a href="#" rel="ddsubmenu4">Reports</a></li>
</ul>
</div>
<script type="text/javascript">
ddlevelsmenu.setup("ddtopmenubar", "topbar") //ddlevelsmenu.setup("mainmenuid", "topbar|sidebar")
</script>
<!-- ///////////////////////////////////////// Role Based Menu ///////////////////////////////// -->
<c:forEach items="${roleCode}" varStatus="roleCount" var="role" >
<c:out value="${role}"/>
<c:out value="${role eq 'BUYER'}"/>
<ul id="ddsubmenu1" class="ddsubmenustyle">
<c:if test="${role eq 'APP'}" >
<li><a href="${pageContext.request.contextPath}/papaViewController.htm">Search PR</a></li>
<li><a href="${pageContext.request.contextPath}/papaApprovePRController.htm">Approve PR</a></li>
</c:if>
<c:if test="${role eq 'REQ'}" >
<li><a href="${pageContext.request.contextPath}/papaCreatePR.htm">Create PR</a></li>
<li><a href="${pageContext.request.contextPath}/papaEditPRController.htm">Modify PR</a></li>
<li><a href="${pageContext.request.contextPath}/papaViewController.htm">Search PR</a></li>
</c:if>
</ul>
<ul id="ddsubmenu2" class="ddsubmenustyle">
<c:if test="${role eq 'BUYER'}">
<!--Top Drop Down Menu 2 HTML-->
<li><a href="${pageContext.request.contextPath}/purchaseOrderController.htm">Build PO</a></li>
<li><a href="${pageContext.request.contextPath}/papaOrderSearchLoadController.htm">Search PO</a></li>
</c:if>
<li><a href="${pageContext.request.contextPath}/papaApprovePOController.htm">Approve PO</a></li>
</ul>
<!--Top Drop Down Menu 3 HTML-->
<ul id="ddsubmenu3" class="ddsubmenustyle">
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/createUserManagement.htm?">User Management</a></li>
<li><a href="#">User Role Maintenance</a></li>
<li><a href="#">OpLoc Maintenance</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaCreateOploc.htm">Create Approver</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li><a href="#">Approval Limit Maintenance</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaCApprover.htm">Create Approver</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li><a href="#">Supplier Management</a>
</c:if>
<ul>
<c:if test="${role eq 'ADM}">
<li><a href="${pageContext.request.contextPath}/papaSupplierC.htm">Create Supplier</a></li>
<li><a href="${pageContext.request.contextPath}/papaSupplierS.htm">Search Supplier</a></li>
</c:if>
</ul>
<c:if test="${role eq 'ADM}">
</li>
<li>
<a href="#">Organization Maintanance</a>
</c:if>
<ul>
<li><a href="${pageContext.request.contextPath}/papaOrgnizationLevelController.htm">Create </a></li>
<li><a href="http://192.168.3.17/ReportServer/Pages/ReportViewer.aspx?%2fPAPA_Reports%2fOrganisational_Hierarchy&rs:Command=Render" target="_blank">View</a></li>
</ul>
<c:if test="${role eq 'ADM}">
</li>
</c:if>
</ul>
</c:forEach>
<!--Top Drop Down Menu 4 HTML-->
<ul id="ddsubmenu4" class="ddsubmenustyle">
<li><a href="http://192.168.3.17/ReportServer/Pages/ReportViewer.aspx?%2fPAPA_Reports%2fPR_Report&rs%3aCommand=Render" target="_blank">Cost Center-PR Summary Report</a></li>
</ul>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oh thats gr8 man !! miner mistake take long time !!
Open in new window