File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes dynamically generated buttons within nested jsp pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "dynamically generated buttons within nested jsp pages" Watch "dynamically generated buttons within nested jsp pages" New topic

dynamically generated buttons within nested jsp pages

Jason Alterbon

Joined: Dec 13, 2004
Posts: 3
k so heres the deal: I am making a tree structure to represent a data structure and I need a way to put details buttons on each of the nodes on the tree structure so the user can click and a subsection of the page can populate with the details of the node. What I am having trouble with is using the buttons generated according to the nodes how do I know which button has been pressed. each of the nodes is uniquely identified by a variable "dn". i have an action that handles the button clicks:
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)

//do something here???

the base jsp page:

&<;body bgcolor="#FFFFFF">
&<;nested:form action="/">

&<;nested:write property="beanName" />
&<;nested:nest property="Tree" >
&<;jsp:include page="node.jsp" />

node.jsp there is some javascript functions for hiding and showing the subtree just ignore it)

&<;%@page contentType="text/html"%>
&<;%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
&<;%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html" %>


&<;nested:equal property="hasChildren" value="true">
&<;div class="trigger" onC1ick="showBranch('&<;nested:write property="dn" />');swapFolder('&<;nested:write property="dn" />folder')">
&<;img src="gfx/km_plus.gif" border="0" id="&<;nested:write property="dn" />folder">
&<;nested:equal property="hasErrorInSubtree" value="true">
&<;img src="gfx/Error.gif">
&<;nested:equal property="isError" value="true">
&<;img src="gfx/image.gif">
&<;nested:write property="nodeName" />

&<;span class="branch" id="&<;nested:write property="dn"/>">

&<;nested:iterate property="childCollection">
&<;jsp:include page="node.jsp"/>

&<;nested:equal property="hasChildren" value="false">

&<;img src="gfx/km_empty.gif">
&<;nested:equal property="hasErrorInSubtree" value="true">
&<;img src="gfx/Error.gif">
&<;nested:write property="nodeName" />


[ December 14, 2004: Message edited by: Jason Alterbon ]
I agree. Here's the link:
subject: dynamically generated buttons within nested jsp pages
It's not a secret anymore!