Question

Struts: nesting <bean:write>tag in a <logic:equal> tag (inside a javascript)

Asked by: cicoii

I have a javascript that makes a 'tree-view' for me. I managed to already get the tree-view to build trees whose values are taken from my db. The problem is, I want to be able to check the bean of the 'first' array such that if it equals the one located in the second array, it will print/iterate.

Here's a short explanation of my code: the changeItemProducts array is only used to get the 'subject' names. Inside each 'subject' are sub-entries. (For example, Paint has sub-entries like: watercolor, etc). Now, the changeItems array contains the sub-entries (I also added in this array from what 'subject' they come are from).

Now I want to check that if the value of the subject in the changeItems array = value of the subject in the changeItemProducts array, print all the sub-entries. If not, skip it (because it may not have any sub-entries yet in the db) and check the next entries.

Here's my Javascript code for it:

<logic:iterate id="changeItemProduct" name="changeItemProducts">

      folCA = insFld(foldersTree, gFld("<bean:write name="changeItemProduct" property="productName" />", ""))
            headCA = insDoc(folCA, gLnk("S", makeHeader("Title","#cccccc"), "",makeHeader("CR#","#cccccc"),makeHeader("Date Submitted","#cccccc"),makeHeader("Target Date","#cccccc"),makeHeader("Phase","#cccccc")))
            headCA.iconSrc = ICONPATH + "ftv2blank.gif"
               
            <logic:iterate id="changeItem" name="changeItems">
                <logic:equal name="changeItem" property="productName" value="<bean:write name="changeItemProduct" property="productName" /> ">
                    insDoc(folCA, gLnk("S", "<bean:write name="changeItem" property="title" />", "/ADM/GetWorkOrders.do?changeItemNumber=<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="dateSubmitted" />", "<bean:write name="changeItem" property="targetDate" />", "<bean:write name="changeItem" property="phaseNumber" />"))
                </logic:equal>
            </logic:iterate>
               
</logic:iterate>

The error I get is: equal symbol expected

on this part of the code(at least I think it is this part of the code):

<logic:equal name="changeItem" property="productName" value="<bean:write name="changeItemProduct" property="productName" /> ">

I heard that nesting within a struts tag is not possible. Is there a way to do this? Thanks in advance!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-10-22 at 19:50:02ID20775341
Tags

struts

Topics

Java Server Pages (JSP)

,

Extensible HTML (XHTML)

Participating Experts
2
Points
125
Comments
22

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. logic: iterate struts
    With struts, I m trying to do the following in my action class TableModel table = new TableModel(); Column columns = new Columns(); columns.addColumn("col1"); columns.addColumn("col2"); ... ... Data data=new Data(); data....
  2. Struts
    How do i check for the ArrayList size for Zero in Struts page Any help Thanks
  3. Struts - Cannot find bean error
    I am getting: javax.servlet.ServletException: Cannot find bean DateRange in any scope My Action Class (ShowKalendarList.java) is: --------------------------------------------------- public ActionForward execute( ActionMapping mapping, ActionForm form, ...
  4. <jsp:useBean…> VS <bean:define…> in struts
    Hi! I am wondering differences between <jsp:useBean…> and <bean:define…> in struts. Thanks,
  5. Struts jsp bean manipulation
    Dear all, I have an issue with a JSP page in Java Struts. I have two collections of beans in the jsp page. One contains the persons and the other one contains the title (used before the names). A person bean has a titleId property that points to the id property of a title...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: kennethxuPosted on 2003-10-22 at 21:58:01ID: 9604425

you cannot use one tag as another tag's property value, try this:
<logic:equal name="changeItem" property="productName" value="<%=changeItemProduct.getProductName()%>">

let me know if you have further enquires

 

by: cicoiiPosted on 2003-10-22 at 22:21:41ID: 9604504

Hi kennethxu!

I tried the code you wrote but I'm getting an error when I load the page:


Generated servlet error:
    [javac] Compiling 1 source file

C:\tomcat\work\Standalone\localhost\ADM\jsp\Change Item\chi_list_jsp.java:133: cannot resolve symbol
symbol  : variable changeItemProducts
location: class org.apache.jsp.chi_list_jsp
              _jspx_th_logic_equal_0.setValue(changeItemProduct.getProductName());
                                              ^
1 error

Any ideas? Thanks again!

 

by: kennethxuPosted on 2003-10-23 at 08:21:29ID: 9607369

can you tell me how do you define your changeItemProduct bean? thanks.

 

by: znapsPosted on 2003-10-23 at 09:22:34ID: 9607941

Try this - It is similar to Kenneth's code and should work for all cases:

<bean:define id="prodName" name="changeItemProduct" property="productName/>

<logic:equal name="changeItem" property="productName" value="<%= prodName %>">

....rest of code...

 

by: znapsPosted on 2003-10-23 at 09:24:20ID: 9607954

Sorry, that should read:

<bean:define id="prodName" name="changeItemProduct" property="productName"/>

<logic:equal name="changeItem" value="<%= prodName %>">

....rest of code...

 

by: cicoiiPosted on 2003-10-23 at 18:47:45ID: 9611617

kennethxu,

When I try to use the bean:define or jsp:useBean with my code, I always end up getting an error. Am not quite sure how to use this though. I had always assumed that when I place my array in an logic:iterate it will be working ok. I also tried using znaps <bean:define> code but I also get an error (see below). Any help would be greatly appreciated. Thanks!

Znaps,

I tried out your code but am still getting an error similar to the one above:


Generated servlet error:
    [javac] Compiling 1 source file

C:\tomcat\work\Standalone\localhost\ADM\jsp\Change Item\chi_list_jsp.java:153: cannot resolve symbol
symbol  : method setValue (java.lang.Object)
location: class org.apache.struts.taglib.logic.EqualTag
              _jspx_th_logic_equal_0.setValue( prodName );
                                    ^
1 error

Any help would be greatly appreciated. Thanks!

 

by: kennethxuPosted on 2003-10-23 at 19:15:00ID: 9611733

can you post your full jsp page?

 

by: cicoiiPosted on 2003-10-23 at 19:38:34ID: 9611803

Hi kennethxu,

Thanks for all your replies. Hope you can help me with this one :-)

I've included the full jsp page as well as snippets of my java codes (in case this will be helpful in solving this problem)

Here's my full jsp page: (chi_list.jsp)

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ page import="com.hp.adm.changeItem.ListChangeItemsAction"%>
<%@ page import="com.hp.adm.changeItem.ChangeItem"%>
<%@ page import="com.hp.adm.changeItem.ChangeItemProduct"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML><HEAD><TITLE>Change Management portal</TITLE>

<!-- Code for browser detection -->
<script src="/ADM/doc_root/ua.js"></script>

<!-- Infrastructure code for the tree -->
<script src="/ADM/doc_root/ftiens4.js"></script>

<!-- Execution of the code that actually builds the specific tree.
     The variable foldersTree creates its structure with calls to
       gFld, insFld, and insDoc -->
<script>
// Decide if the names are links or just the icons
USETEXTLINKS = 1  //replace 0 with 1 for hyperlinks

// Decide if the tree is to start all open or just showing the root folders
STARTALLOPEN = 0 //replace 0 with 1 to show the whole tree

ICONPATH = '/ADM/images/' //change if the gif's folder is a subfolder, for example: '/ADM/images/'

foldersTree = gFld("", "")
foldersTree.iconSrc = ICONPATH + "s.gif"
<jsp:useBean id="changeItemProduct" type="com.hp.adm.changeItem.ChangeItemProduct"/>

<logic:iterate id="changeItemProduct" name="changeItemProducts">

      folCA = insFld(foldersTree, gFld("<bean:write name="changeItemProduct" property="productName" />", ""))
            headCA = insDoc(folCA, gLnk("S", makeHeader("Title","#cccccc"), "",makeHeader("CR#","#cccccc"),makeHeader("Date Submitted","#cccccc"),makeHeader("Target Date","#cccccc"),makeHeader("Phase","#cccccc")))
            headCA.iconSrc = ICONPATH + "ftv2blank.gif"
           
            <logic:iterate id="changeItem" name="changeItems">
                <logic:equal name="changeItem" property="productName" value="<%= changeItemProduct.getProductName%>">          
                    insDoc(folCA, gLnk("S", "<bean:write name="changeItem" property="title" />", "/ADM/GetWorkOrders.do?changeItemNumber=<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="dateSubmitted" />", "<bean:write name="changeItem" property="targetDate" />", "<bean:write name="changeItem" property="phaseNumber" />"))
                </logic:equal>              
            </logic:iterate>
               
</logic:iterate>
                /*
<option selected>All Open Items</option>
<option>Fall 2003 Release</option>
<option>Spring 2004 Release</option>
<option>Fall 2004 Release</option>
*/

release = new Array("Fall 2003 Release","Spring 2004 Release","Fall 2004 Release");
monthly = new Array("January 2003","February 2003","March 2003","April 2003","May 2003","June 2003","July 2003","August 2003");
prodrel = new Array("R","M","R","M","R","R","R","R","R","M","M","M","M","M","M","M","M","M","M");

function changeRelease(select,charChWin,start){
      for (i = select.options.length; i >= start; i--) {
            select.options[i] = null;
      }
      chWinArray = (charChWin == "R") ? release : monthly;

      for (i = start; i < start + chWinArray.length; i++) {
            select.options[i] = new Option(chWinArray[i-start]);
      }
}

</script>


</HEAD>
<LINK rel="stylesheet" type="text/css" href="/ADM/doc_root/hpweb.css">
<BODY text=#000000 vLink=#660066 aLink=#003366 link=#003366 bgColor=#ffffff
leftMargin=0 topMargin=0 marginwidth="0" marginheight="0">

<%@ include file="/jsp/common/top_panel.jsp" %>

<!-- End Search Area --><!--startindex--><!-- Begin Page Title and Printable Version Area -->
<TABLE cellSpacing=0 cellPadding=0 width=740 border=0>
  <TBODY>
  <TR>
    <TD vAlign=center align=middle width=170><A
      href=""><IMG height=53
      src="/ADM/images/hpc60_topnav_hp_logo.gif"
      width=63 border=0></A><BR></TD>
    <TD width=10><IMG height=93 alt="" src="/ADM/images/s.gif"
    width=10></TD>
    <TD vAlign=top align=left width=406><BR><IMG height=6 alt=""
      src="/ADM/images/s.gif" width=1><BR>
      <H1>change items</H1><IMG height=4 alt="" src="/ADM/images/s.gif"
      width=1></TD><!--stopindex--><!--Start Print-->
    <TD vAlign=top align=left width=154><IMG height=10 alt=""
      src="/ADM/images/s.gif" width=1>&nbsp;</TD><!--End Print--></TR></TBODY></TABLE><!-- End Page Title and Printable Version Area --><!--End top inc--><!--End top inc--><!-- Begin Left Navigation and Content Area.  To increase width of content area, modify width of table below. -->
<TABLE cellSpacing=0 cellPadding=0 width=740 border=0 height=423>
  <TBODY>

<!--Start Left inc--><!--Start Left inc--><!-- Start Left Navigation -->

<%@ include file="/jsp/common/left_panel.jsp" %>
 
<!-- End Left Navigation -->



<!--startindex--><!--End Left inc--><!--End Left inc--><!-- Start Content Area.  To increase width of content area, modify width of table cell below. -->

    <TD vAlign=top align=left width=560><!--Start Top table-->

      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR class=midheader>
          <TD width=10 class=rightheader><IMG height=20 alt="" src="/ADM/images/s.gif"
            width=10 border=0></TD>
          <TD width=550 class=rightheader>»&nbsp;list change items</TD></TR>
        <TR class=decoration>
          <TD colSpan=2><IMG height=10 alt="" src="/ADM/images/s.gif"
            width=10 border=0></TD></TR>
        <TR>
          <TD class=color003366 vAlign=top width=10>&nbsp</TD>
          <TD vAlign=top width=550>
<form>
<select name=products id="countrySelect" onChange="changeRelease(changeWindow,prodrel[this.selectedIndex],1)">
<option selected>Core Manufacturing</option>
<option>&nbsp;»&nbsp;Capital Management</option>
<option>&nbsp;»&nbsp;Contract Manufacturing</option>
<option>&nbsp;»&nbsp;Costing</option>
<option>&nbsp;»&nbsp;Maintenance and Storeroom</option>
<option>&nbsp;»&nbsp;Production Execution</option>
<option>&nbsp;»&nbsp;Purchasing</option>
<option>&nbsp;»&nbsp;Quality Management</option>
<option>&nbsp;»&nbsp;Cross-Row</option>
<option>Supplier Connectivity</option>
<option>&nbsp;»&nbsp;TDX ERP to ERP</option>
<option>&nbsp;»&nbsp;Supplier Portal</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;Web Visibility</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;Web Entry</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;Document Collaboration</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;REG</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;eCOA</option>
<option>&nbsp;&nbsp;&nbsp;&nbsp;»&nbsp;RTIM</option>
<option>&nbsp;»&nbsp;Syncra</option>
<option>WOM</option>
</select>
<select name="changeWindow" id="countrySelect">
<option selected>All Open Items</option>
<option>Fall 2003 Release</option>
<option>Spring 2004 Release</option>
<option>Fall 2004 Release</option>
</select>
<INPUT type=image alt="List" src="/ADM/images/hpc60_arrow_submit.gif" border=0 name=submit></A>
</form>
          </TD></TR>
          </TBODY></TABLE>

      <TABLE cellSpacing=0 cellPadding=0 width=560 border=0>
        <TBODY>
        <TR class=midheader>
          <TD width=10 class=rightheader><IMG height=20 alt="" src="/ADM/images/s.gif"
            width=10 border=0></TD>
          <TD width=550 class=rightheader>»&nbsp;all open items</TD></TR>
        <TR class=decoration>
          <TD colSpan=2>


      <!--      <IMG height=10 alt="" src="/ADM/images/s.gif" width=10 border=0></TD></TR>      -->      
        <TR>
          <TD class=color003366 vAlign=top width=10>&nbsp</TD>
          <TD vAlign=top width=550>

<!-- Removing this link will make the script stop from working -->
<a href="http://www.treemenu.net/"></a>

<!-- Build the browser's objects and display default view of the
     tree. -->
<script>initializeDocument()</script>

          </TD></TR>
        <TR class=decoration>
          <TD colSpan=2><IMG height=10 alt="" src="/ADM/images/s.gif"
            width=10 border=0></TD></TR>
        <TR>
          </TBODY></TABLE>

<!-- END HumanTag Monitor. DO NOT MOVE! MUST BE PLACED JUST BEFORE THE /BODY TAG --><!--End bottom inc--></BODY></HTML>

ListChangeItemsAction.java:

//  ******************EXECUTE****************//
   
    public ActionForward execute(ActionMapping mapping,
            ActionForm form,
            HttpServletRequest request,
            HttpServletResponse response)
            throws IOException, ServletException, Exception {
               
                ArrayList returnChangeItems = getChangeItems();
                ArrayList returnChangeItemProducts = getChangeItemProducts();
                request.setAttribute("changeItems", returnChangeItems);
                request.setAttribute("changeItemProducts", returnChangeItemProducts);
                //Forwards to the appropriate View
                return (mapping.findForward("continueToListChangeItems"));
            }

ChangeItem.java: (shows the variables I set and get)

    protected int changeItemNumber;
    protected String title;
    protected String dateSubmitted;
    protected String targetDate;
    protected int phaseNumber;
    protected String productName;ChangeItemProduct.java:

ChangeItemProduct: (shows the variables I set and get)

    protected int changeItemProductNumber;
    protected String productName;

 

by: znapsPosted on 2003-10-24 at 05:22:39ID: 9613636

My last post contained one more mistake (I left out the property="productName" attribute)....sorry! This works fine in my code so I'm not sure why it wouldn't work for you:

<bean:define id="prodName" name="changeItemProduct" property="productName"/>

<logic:equal name="changeItem"  property="productName" value="<%= prodName %>">

....rest of code...

 

by: kennethxuPosted on 2003-10-24 at 13:59:25ID: 9617367

1. I think you might not need the <jsp:useBean>, but this is the right why to use it:
<jsp:useBean id="changeItemProducts" type="java.util.List" scope="request"/>
<jsp:useBean id="changeItems" type="java.util.List" scope="request"/>

2. you should specify the type in <logic:iterate>
<logic:iterate id="changeItemProduct" name="changeItemProducts" type="com.hp.adm.changeItem.ChangeItemProduct"/>

3. you missed the parentheses for your get method:
<logic:equal name="changeItem" property="productName" value="<%=changeItemProduct.getProductName()%>">

I think znaps' code will also work.
Let us know.

 

by: cicoiiPosted on 2003-10-25 at 04:19:55ID: 9619216

Hi again,

I tried what you guys said, but I'm still getting the same error: (below for your reference - this is while using kennethxu's code). I also tried znaps' code but am getting a similar error as well. Can this be caused by an error with java or tomcat? I'm not sure why I'm getting this error...

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 30 in the jsp file: /jsp/common/left_panel.jsp

Generated servlet error:
    [javac] Compiling 1 source file

C:\tomcat\work\Standalone\localhost\ADM\jsp\Change Item\chi_list_jsp.java:137: cannot resolve symbol
symbol  : variable changeItemProduct
location: class org.apache.jsp.chi_list_jsp
          _jspx_th_logic_equal_0.setValue(changeItemProduct.getProductName());
                                          ^
1 error

Using this code in jsp:

<logic:iterate id="changeItemProduct" name="changeItemProducts" type="com.hp.adm.changeItem.ChangeItemProduct"/>

      folCA = insFld(foldersTree, gFld("<bean:write name="changeItemProduct" property="productName" />", ""))
            headCA = insDoc(folCA, gLnk("S", makeHeader("Title","#cccccc"), "",makeHeader("CR#","#cccccc"),makeHeader("Date Submitted","#cccccc"),makeHeader("Target Date","#cccccc"),makeHeader("Phase","#cccccc")))
            headCA.iconSrc = ICONPATH + "ftv2blank.gif"
           
            <logic:iterate id="changeItem" name="changeItems">
                <logic:equal name="changeItem" property="productName" value="<%=changeItemProduct.getProductName()%>">          
                    insDoc(folCA, gLnk("S", "<bean:write name="changeItem" property="title" />", "/ADM/GetWorkOrders.do?changeItemNumber=<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="dateSubmitted" />", "<bean:write name="changeItem" property="targetDate" />", "<bean:write name="changeItem" property="phaseNumber" />"))
                </logic:equal>              
            </logic:iterate>
               
</logic:iterate>




 

by: kennethxuPosted on 2003-10-25 at 10:24:10ID: 9620111

Strange! which version of Struts r u using?

 

by: cicoiiPosted on 2003-10-25 at 20:06:24ID: 9621462

I use struts 1.1 along with jdk 1.3.1_06.

At first, I had problems also with this while using <bean:write> but it worked after later on....this is getting rather strange...

 

by: kennethxuPosted on 2003-10-25 at 20:32:32ID: 9621542

can you send the jsp file and  2 bean java file to kennethxu at yahoo.com? I'll try to test.

 

by: cicoiiPosted on 2003-10-26 at 17:35:24ID: 9624342

kennethxu,

sent you the files. Hope you can see if it works at your end. Thanks

 

by: kennethxuPosted on 2003-10-27 at 10:12:06ID: 9628597

Hmm, this should get it fixed:

foldersTree = gFld("", "")
foldersTree.iconSrc = ICONPATH + "s.gif"

<logic:iterate id="changeItemProduct" name="changeItemProducts"/>
<jsp:useBean id="changeItemProduct" type="com.hp.adm.changeItem.ChangeItemProduct"/>

     folCA = insFld(foldersTree, gFld("<bean:write name="changeItemProduct" property="productName" />", ""))
          headCA = insDoc(folCA, gLnk("S", makeHeader("Title","#cccccc"), "",makeHeader("CR#","#cccccc"),makeHeader("Date Submitted","#cccccc"),makeHeader("Target Date","#cccccc"),makeHeader("Phase","#cccccc")))
          headCA.iconSrc = ICONPATH + "ftv2blank.gif"

           
            <logic:iterate id="changeItem" name="changeItems">
                <logic:equal name="changeItem" property="productName" value="<%=changeItemProduct.getProductName()%>">
                    insDoc(folCA, gLnk("S", "<bean:write name="changeItem" property="title" />", "/ADM/GetWorkOrders.do?changeItemNumber=<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="dateSubmitted" />", "<bean:write name="changeItem" property="targetDate" />", "<bean:write name="changeItem" property="phaseNumber" />"))
                </logic:equal>              
            </logic:iterate>
               
</logic:iterate>

the trick is this line:
<jsp:useBean id="changeItemProduct" type="com.hp.adm.changeItem.ChangeItemProduct"/>

 

by: kennethxuPosted on 2003-10-27 at 10:14:44ID: 9628615

BTW, you'd better start to use JSTL now, those struts logic, bean taglibs will soon be obsoleted.

 

by: cicoiiPosted on 2003-10-27 at 18:22:10ID: 9631107

Well, I got it to work...somewhat. I had to get rid of one of the <logic:iterate> tags (in kennethxu's code) because the first line:

<logic:iterate id="changeItemProduct" name="changeItemProducts"/>

is already 'ended'. Unfortunately, now, I can't loop thru my array anymore. Only the first item is shown. Any remedies for this? =) (Take note that if I simply remove the backslash in the logic:iterate code above, I get an error already). Thanks.

This is how my code went:

<logic:iterate id="changeItemProduct" name="changeItemProducts"/>
<jsp:useBean id="changeItemProduct" type="com.hp.adm.changeItem.ChangeItemProduct"/>

     folCA = insFld(foldersTree, gFld("<bean:write name="changeItemProduct" property="productName" />", ""))
          headCA = insDoc(folCA, gLnk("S", makeHeader("Title","#cccccc"), "",makeHeader("CR#","#cccccc"),makeHeader("Date Submitted","#cccccc"),makeHeader("Target Date","#cccccc"),makeHeader("Phase","#cccccc")))
          headCA.iconSrc = ICONPATH + "ftv2blank.gif"
           
            <logic:iterate id="changeItem" name="changeItems">
                <logic:equal name="changeItem" property="productName" value="<%=changeItemProduct.getProductName()%>">
                    insDoc(folCA, gLnk("S", "<bean:write name="changeItem" property="title" />", "/ADM/GetWorkOrders.do?changeItemNumber=<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="changeItemNumber" />", "<bean:write name="changeItem" property="dateSubmitted" />", "<bean:write name="changeItem" property="targetDate" />", "<bean:write name="changeItem" property="phaseNumber" />"))
                </logic:equal>              
            </logic:iterate>

 

by: kennethxuPosted on 2003-10-27 at 20:44:36ID: 9631553

this time, I toke the code you initially posted and did following:

1. remove 2 include, because I don't have those jsp files.
2. removed jsp:useBean
3. change first iterate to:
<logic:iterate id="changeItemProduct" name="changeItemProducts" type="com.hp.adm.changeItem.ChangeItemProduct" >
4. change the equal to:
<logic:equal name="changeItem" property="productName" value="<%= changeItemProduct.getProductName()%>">

and it worked!

I'll also send you the file by email.

 

by: cicoiiPosted on 2003-10-27 at 22:31:56ID: 9631849

It works! Finally works! :-)

Thanks kennethxu for everything. Znap's as well!

 

by: znapsPosted on 2003-10-28 at 04:27:14ID: 9633135

Glad to hear

 

by: kennethxuPosted on 2003-10-28 at 07:13:32ID: 9634254

As always, my pleasure.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...