Hello all , i have a problem on which i have been stuck for 3 days, i have
asked numerous developers and worked on this problem for days but to no
avail, i would be extremely grateful if you could advise me on how to
overcome this monstrous beast!
I am using the struts framework components to create a componentized
submenu. I used the struts example(tiles) to build upon the submenu which is
being generated dynamically using this file:-
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
<comp:insert page="/hfa/common/submenu.jsp" flush="true">
<comp:put name="title" value="submenu" />
<comp:putList name="items" >
<comp:add value="Create" />
<comp:add value="Search" />
<comp:add value="Requests:" />
<comp:add value="Drafts" />
<comp:add value="In Process" />
</comp:putList>
<comp:putList name="links" >
<comp:add value="create.jsp" />
<comp:add value="search.jsp" />
<comp:add value="nolink" />
<comp:add value="drafts.jsp" />
<comp:add value="inprocess.jsp" />
</comp:putList>
<comp:put name="novalue" value="nolink" />
<comp:put name="linkbold" value="Create" />
<comp:put name="linknormal" value="Search" />
<comp:put name="linknormal" value="Drafts" />
<comp:put name="linknormal" value="In Process" />
</comp:insert>
The two lists are straight forward(one item and the other links), the issues
i have are the following
Basically i need to do three states. The first is to have a link which is
bold(eg. create) the second state is to have nolink(eg Requests), and the
third state is to have a normal link. I would like to represent all three
states in one page. When i execute the page, for some reason i can get the
process to work however, create and request are repeated as normal links.
So i get the desired result, create is bold, request has no link, and drafts
is a normal link, but create and request is repeated as normal links!!!
I have tried 1 million and one things and it does not work, it could be
something very simple but i do not see it. I would appreciate any help ..
thank you
Here is the submenu.jsp file which is called upon from the page above.
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
<%@ page import="java.util.Iterator" %>
<%-- Push component attributes in page context --%>
<comp:importAttribute />
<bean:define id="links" name="links" type="java.util.List" scope="page" />
<% Iterator i = links.iterator(); %>
<logic:iterate id="linknormal" name="items" >
<bean:define id="item" name="linknormal" type="java.lang.String"
scope="page" />
<% // Compute link value
String link = (String)i.next();
%>
<logic:equal name="novalue" value="<%=link%>">
<%=item%>
</logic:equal>
<logic:equal name="linkbold" value="<%=item%>">
<B><a href="<%=link%>"><%=item%></a></B>
</logic:equal>
<logic:equal name="linknormal" value="<%=item%>">
<a href="<%=link%>"><%=item%></a>
</logic:equal>
</logic:iterate>
Also tried to do it this way:-
All i did was to replace the id to iterateItems
<logic:iterate id="iterateItems" name="items" >
<bean:define id="item" name="iterateItems" type="java.lang.String"
scope="page" />
but the problem with this approach is that it only picks up just one of the
logic:equal 'linknormal'(actaully the last one), eg, it would only spit out
In Process(and it will hide drafts and search), it won't allow me to pass
multiple values for the same logic:equal ...
and i also have tried numerous other methods, still stuck ... will really
really appreciate any feedback.
Cheers,
it_medic
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp