Solved

NESTING <LOGIC:ITERATE> <LOGIC:PRESENT> TAGS

Posted on 2004-09-23
7
1,184 Views
Last Modified: 2008-02-01

I have a page that uses a number of tables. I also have a style sheet in that jsp page. I have one class that show's items on screen but not on print preview, and another that shows items on print preview but not the screen. I am getting an iterator error or some sort, and others times, no error at all: it simply doesn't work.

I have the following

<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">
<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>
</LOGIC:PRESENT>
</LOGIC:PRESENT>


<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">
<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>
</LOGIC:PRESENT>
</LOGIC:PRESENT>

The second section doesn't work at all. I don't know how to reset the iterator. I absolutely cannot use any <% %> tags either. I have tried splitting the sections like I did above and I have tried putting them together as follows:

<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

</LOGIC:PRESENT>
</LOGIC:PRESENT>

I have checked the code to make sure there isn't another master <LOGIC:PRESENT> tag surrounding both the NOPRINT and NOSHOW sections. There isn't one. The only tag that encompasses both of these sections is the <BODY></BODY> tag, which I would think is appropriate.

Please help. I need a solution ASAP. Also, I don't want to duplicate objects in the session. I would really like to reuse the same object ( so I don't have to use something like classB1 or classB2 ).

Thanks in advance. Will up points depending on the promptness and completeness of solution.
0
Comment
Question by:jbaisden
  • 4
  • 2
7 Comments
 

Author Comment

by:jbaisden
ID: 12137290
Correction: in the above listed...the code should look like this:

<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">
<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>
</LOGIC:PRESENT>
</LOGIC:PRESENT>


<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">
<TABLE CLASS="NOSHOW">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>
</LOGIC:PRESENT>
</LOGIC:PRESENT>

and the second set of code should be


<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="class2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='class2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

</LOGIC:PRESENT>
</LOGIC:PRESENT>

For the record the syle sheet is in the header. It is as follows:

<STYLE media="print">.noprint
{
      DISPLAY: none;
      
}</STYLE>
<STYLE media="screen">.noshow
{
      DISPLAY: none;
      
}</STYLE>

Hope that makes it more clear.
0
 
LVL 11

Expert Comment

by:sompol_kiatkamolchai
ID: 12140090
I think your problem is how to reset index in the next iteration.

I would like you to test this option

<LOGIC:iterate id="class2" name="class2" indexId="ind" offset="0">


0
 

Author Comment

by:jbaisden
ID: 12142652
I have made that modification. The error I am receiving is: Error 500: Cannot create iterator for this collection. Will continue testing.



0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:jbaisden
ID: 12145035
I still have not made any progress. Any help would be appreciated.
0
 
LVL 35

Accepted Solution

by:
TimYates earned 125 total points
ID: 12158969
what happens if you change the ID to something other than the name of the collection?

<LOGIC:PRESENT NAME="class1">
<LOGIC:PRESENT NAME="class2">

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="it1" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='it1' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

<TABLE CLASS="NOPRINT">
<LOGIC:iterate id="it2" name="class2" indexId="ind">
   <TR>
   <TD>
            <bean:write name='it2' property='school'/>
    </TD>
   </TR>
</LOGIC:ITERATE>
</TABLE>

</LOGIC:PRESENT>
</LOGIC:PRESENT>
0
 

Author Comment

by:jbaisden
ID: 12160986
That did it Tim! Thanks!
0
 
LVL 35

Expert Comment

by:TimYates
ID: 12161147
:-)

Good luck!!

Tim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
password protect pdf 11 74
Apache server configuration 7 80
library class in java 1 90
designing in object programming 12 52
Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now