Using Strut Logic Iterate tag in JavaScript

Has anyone tried this or experienced this problem.
I have JSP pages with JavaScript imbedded. Not my web page but an out of the box portal we bought from a vendor. The JavaScript uses the Logic Iterate Strut tag but gives an error in Nitro:
"feature is not resolved" on the lines where getLink() and getID() are called. I have put the code in other editors and it does not give me any error. Does any one have a clue to why this error occurs or is this something that NitroX can not handle?
Thanks,
Zim 8)
Some of Code:
function selectFolder(folderName,doExpandPath)
                    if (typeof(doExpandPath) == 'undefined')
                         doExpandPath = true;
                    var form = document.forms['TreeForm'];
                    // unselect old one
                    var cell = document.getElementById(selectedId);
                    if (null != cell)
                         cell.className = '';
                    // select new one
                    if ('/' == folderName.charAt(folderName.length-1))
                         folderName = folderName.substring(0,folderName.length-1);
                    var targetCellId = 'cellLabel./Documents'+folderName;
                    var isContentFolderBrowser = true;
                    try {
                         var sideBarSelected = top.frames['main'].window.sideBarSelected;
                         isContentFolderBrowser = '/getfolderitems.do' == sideBarSelected;
                         if (!isContentFolderBrowser) {
                         <logic:iterate id="feature" name="userinfobean" property="sideBarFeatures"
                                   type="com.actuate.activeportal.functionality.config.Feature">
                                   if (sideBarSelected == '<%= feature.getLink()%>' )
                                        targetCellId = 'cellLabel./<%= feature.getID()%>';
                              </logic:iterate>
                    } catch (e) {
                    cell = document.getElementById(targetCellId);

May I ask why have you done it?
If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
It has the list we want to print out.
With logic:iterate:
<table>
     <tr>
       <th>Number</th>
       <th>Employee</th>
     </tr>
     <logic:iterate name="compEmployees" property="totalEmps" id="emp">
          <tr>
            <td>
              <bean:write name="emp" property="empNo"/>
            </td>
            <td>
              <bean:write name="emp" property="empName"/>
            </td>
          </tr>
     </logic:iterate>
</table>or alternatively with JSTL and c:forEach
<table>
     <tr>
       <th>Number</th>
       <th>Employee</th>
     </tr>
     <c:forEach items="${compEmployees.totalEmps}" var="emp">
          <tr>
            <td>
              <c:out value="${emp.empNo}"/>
            </td>
            <td>
              <c:out value="${emp.empName}"/>
            </td>
          </tr>
     </c:forEach>
</table>Cheers,
evnafets

Similar Messages

  • Struts html:iterate tag

    Hello all,
    Does anyone know if the struts html:iterate tag can be used to iterate through an ArrayList? Can you populate a html:radio tag with such an iterator?
    If anyone has code examples of these, they would be MOST appreciated!
    Thank you!

    I have an ArrayList object that contains a collection of Listing objects.
    The Listing object has two methods getID, getName
    In the ActionForm there is a variable listingData of List type. How can I use the logic:iterate tag to traverse the ArrayList object and display the id and name of the ListingObjects?
    What has to be added in the logic:iterate tag below?
    <table>
    <logic:iterate id="listingForm" name="listingForm" property="listingData">
    <tr>
    <td>
    // Here I want to output the value of ids
    </td>
    <td>
    // Here I want to output the value of names
    </tr>
    </logic:iterate>
    </table>Do I need a nested logic:iterate tag?
    Should the ArrayList be populated with a J2SE class rather than a business object, i.e. the Listing class?

  • Problem in Iterating using logic:iterate tag

    Hi ,
    I am using <logic:iterate> tag to iterate through a list of contents.
    When the List size is 1222, all the Contents in the List are displaying properly.
    When the size execdes 1223, the JSP is not displaying properly.
    I am not getting any exception also.
    I have added try and catch. Still it is not showing any exception.
    When the size is more than 1300, Some contents are not displaying in JSP.
    Can any one provide some inputs, so that I can crack my issue.
    The JSP code :
              <logic:iterate id="someXXXX" property="someXXX" name="someXXX" indexId="count" scope="request">
              <tr>
    <td><html:text name="someXXXX" property="someXXXX"
                             size="50" maxlength="50" onchange="setDirty()" indexed="true"/> </td>               
    <td height="15" align="center"><html:checkbox property="someXXXX" name="someXXXX" indexed="true" onclick="setCheckboxFlag(this)" />               
                   <td width="4"> </td>               
              </tr>
              <html:hidden property="someXXXX" name="someXXXX" indexed="true" />
              </logic:iterate>
    Thanks,
    RamaKrishna

    get the records and store them in a collection. Store the collection in session. take the first 10 records as a subset and pass it to the iterate tag. use the hidden field to keep the last record number in the jsp. So when you first see the jsp the first 10 records will be shown and when user clicks for next records send the hidden field value to the server and take next 10 records as subset and pass it to iterate tag. This is how you can do this. but if you have thousands of records storing them in the session is not recommended. you can pull them directly from the database.

  • C:forEach and logic:iterate tags repeating elements of a collection

    I have an issue that makes absolutely no sense to me. Basically I am using struts, and I am returning a form that contains a List of customers. I am simply trying to iterate that list into a simple table for each customer. The end result will have rows for each table, but I tried to simplify this example.
    The only filter is that I don't want to display customers that don't contain any data that I care to display. In my dataset, there is only one customer that has any data that I care about, and that has been verified in the database and in the backend action feeding the struts page.
    I first attempted this with the c:forEach JSTL tag. What I saw was that the customers were just getting repeated. Instead of showing one table for each customer, it was repeating the tables for each customer equal to the size of the Collection. For example, there were *5* customers in the List, only customer C should have been set into a table, but the table for customer C was being repeated *5* times. I went into the backend code, and made sure the object being sent back to struts contained the correct number of records.
    I then tried the same thing using the logic:iterate Struts EL tag. This did exactly the same thing. Instead of one table for customer C, I had 5 tables, all for customer C.
    Frustrated, I then went back to just writing a basic scriptlet in the JSP, to iterate over the object returned from the struts action. When I did this, everything came back as normal. Only customer C met my conditional statement, and only customer C had a table created in the generated HTML.
    Now I must be missing something with how the JSTL tags are handling the iteration, so I wanted to post the code to see if anyone had any idea what I am doing wrong here.
    The JSP page is found below. As you can see, the first part is done as a scriptlet, and the last part is done with JSTL tags. Unless I am mistaken, the 2 approaches should produce the same result. Please let me know if I am missing something here.
    <%@ include file="/common/customConfig.inc"%>
    <%@ page import="java.util.Iterator,
        com.pw.cemp.webapp.common.forms.CempDocumentsForm,
        com.pw.cemp.webapp.common.views.CustomerView"%>
    Write table with straight scriptlets...
    <br />
    <br />
    <%
        CempDocumentsForm cdForm =
            (CempDocumentsForm) session.getAttribute("cempDocsForm");
        Iterator itCustomers = cdForm.getCustomers().iterator();
        while (itCustomers.hasNext())
            int idx = 0;
            CustomerView customer = (CustomerView) itCustomers.next();
            if (customer.getCemps() != null && !customer.getCemps().isEmpty())
    %>
            <table>
                <% if (idx == 0) { %>
                    <caption>
                        Customer CEMP Listing
                    </caption>               
                <% } %>
                <tbody>
                    <tr>
                        <td class="level1">
                            <%=customer.getName() %> -
                            <%=customer.getSapCustomerId() %>
                        </td>
                    </tr>
                </tbody>
            </table>
    <%      
            idx ++;
    %>
    <br />
    <br />
    Now try using JSTL...
    <br />
    <br />
        <logic:iterate name="cempDocsForm" property="customers" id="customer" indexId="index">
        <!-- <c:forEach items="${cempDocsForm.customers}" var="customer" varStatus="status"> -->
            <c:if test="${not empty customer.cemps}">           
            <table>
                <c:if test="${index == 0}">
                    <caption>
                        Customer CEMP Listing
                    </caption>
                </c:if>
                <tbody>
                    <tr>
                        <td class="level1">
                            <c:out value="${customer.name}" /> -
                            <c:out value="${customer.sapCustomerId}" />
                        </td>
                    </tr>
                </tbody>
            </table>
            </c:if>
        <!-- </c:forEach> -->
        </logic:iterate>
        <br />
        <br />The code above produced the following HTML. As you can see, the scriptlet did exactly what I wanted, it produced 1 table for the only company that met the conditional statement. The JSTL section repeated the table for that one company, equal to the number of items in my List.
    Write table with straight scriptlets...
    <br />
    <br />
            <table>
                    <caption>
                        Customer CEMP Listing
                    </caption>                           
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>
            </table>
    <br />
    <br />
    Now try using JSTL...
    <br />
    <br />
            <table>           
                    <caption>
                        Customer CEMP Listing
                    </caption>           
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>       
            </table>
            <table>
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>
            </table>
            <table>           
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>
            </table>
            <table>           
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>
            </table>
            <table>       
                <tbody>
                    <tr>
                        <td class="level1">
                            FMP Test Company -
                            5
                        </td>
                    </tr>
                </tbody>
            </table>
        <br />
        <br />Thanks in advance...
    Edited by: cdbyrd on Feb 28, 2008 4:22 PM
    Edited by: cdbyrd on Feb 28, 2008 5:12 PM

    Okay, it looks like I kept moving things around until I stumbled upon something. One thing to note is that I am using Tiles in my struts 1.2.9 application. I don't know if that has anything to do with it, but this is what I found.
    If you notice in my code, with the iteration tags, I had one active and one commented version of the tag. I kept flipping them around, thinking it was some kind of syntax problem or it was specific to either the logic:iterate or c:forEach tag.
    Well, as it turns out, when you comment something the way I did, I think the custom tag processor doesn't ignore the commented sections. I had things commented like the following.
        <logic:iterate name="cempDocsForm" property="customers" id="customer" indexId="index">
        <!-- <c:forEach items="${cempDocsForm.customers}" var="customer" varStatus="status"> -->Now I have done this many times in the past, and I have never noticed any adverse behavior. I guess it was just the correct situation here to make the problem come to the surface. As soon as I removed any comments on the JSP, the page started working as expected. I can't explain why it happens, I just know it happened.
    Does anyone out there have a good explanation for this, so I can put a reason to why I lost so much hair today? Also, does anyone have the proper way to comment out JSTL tags to keep them from being parsed?
    Thanks...

  • How can I write the analogous code to the logic:iterate tag functionality

    Hai This is Rayalu .And I am very new to the Java World. I have a doubt?.How can I write the analogous code to the<logic:iterate> tag functionality using the JSP Tag Libraries . Pleae Send me some examples .

    Hi,
    SELECT objnr objid aufnr
            from afih
            into table t_afih.
    SELECT objnr
            from JEST
            into table t_JEST
            where stat = 'A0045'
               OR stat = 'A0046'
               AND inact 'X'.
    SELECT objnr
            from COBRB
            into table t_cobrb.
    SELECT arbpl werks objid objty
          from crhd
          INTO table it_crhd
          FOR ALL ENTRIES IN it_afih
          WHERE objty eq 'D'
          AND gewrk = it_afih-objid.
    SELECT aufnr objnr auart txjcd pspel gstrp werks aufnr
            FROM caufv
            INTO table t_caufv
            FOR ALL ENTRIES IN it_afih
            WHERE aufnr = it_afih-aufnr
              And pspel = ' '
              AND txjcd = ' '
             ANd objnr ne it_crhd-objnr
              AND auart in s_wtype
              AND werks in s_plant.
             AND objnr ne it_jest-objnr.
    dont use NE in the select statements, it may effect performance also. Instead use if statements inside
    loops.
    loop at t_caufv.
    read table it_chrd............
      if t_caufv-objnr ne it_chrd-objnr.
      read table it_jest..........
       if   if t_caufv-objnr ne it_jest-objnr.
        (proceed further).
       endif.
      endif.
    endloop.
    hope this helps.
    Reward if useful.
    Regards,
    Anu

  • Re: Announce: J2EE MVC training using Struts with Standard Tags (JSTL)   8/2 in NYC

    Standard J2EE MVC training using Struts with Standard Tags (JSTL)
    -We have done more Struts training than anyone. This class adds Standard Tag Libs (JSTL) with MVC and a portal discussion.
    Full Syllabus is at :
    http://www.basebeans.com/syllabus.jsp
    NYC on 8/2.
    This is the last week to sign up :
    http://www.basebeans.com/classReservation.jsp
    More dates(tentative):
    8/9 - Chicago downtown Marriott
    8/16 - Atlanta downtown Marriott
    8/23 - Austin downtown Marriott
    To keep up on upcoming MVC training sign up at:
    http://www.basebeans.com:8081/mailman/listinfo/mvc-programmers
    Hope to see you,
    Thanks,
    Vic
    Ps. 1: Set your newsreader such as Outlook Express or Netscape to news.basebeans.com for Open Standard news groups like JDO, Apache, SOAP, etc.
    Ps 2: The sample app will be available end of next week at:
    http://www.basebeans.com/downloads.jsp

    i have same problem with
    CLI130 Could not create domain, domain1
    then i try these things with PATH stuff but it haven't worked for me...
    then i tried to search windows registry for string domain1 and nothing found...
    then i searched my profile directory (on windowsxp c:\Documents and Settings\user on linux /home/user) for files that containd string domain1 and i found some .adadmin* files (as i remember there were 3 files) then i deleted them, try to install sun app server and it works for me... there are still some warnings but at least installation finishes and files were not deleted...
    i hope this help...
    for me it does

  • How to use struts Logic tags in weblogic8.1

    hi
              i have used jakarta struts in JDeveloper there i used logic tags
              but the same i have to use in weblogic8.1 ,how should i use it
              i am new to weblogic platform
              it is very urgent
              please

    Hi harish,
              Procedure for using a Struts Tag Libraries in weblogic 8.1 :
              â€¢Copy the tag lib jar files under WEB-INF/lib ( if tag handler supplied as
              classes without package a jar file then we need to copy the classes
              under WEB_INF/classes.
              â€¢ Copy the tld files files under WEB-INF or create a directory under
              WEB-INF and copy tld files under this directory.
              â€¢ We need to give the information about the tag libraries in web.xml by
              adding the following lines to it as,
              <taglib>
              <taglib-uri>bean</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>html</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>logic</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
              </taglib>
              To use tags in jsp file we need to add taglib directive as ,
              <%@ taglib uri="logic" prefix=“logic"%>
              <%@ taglib uri="html" prefix=“html"%>
              <%@ taglib uri="bean" prefix=“bean"%>
              Every tag can support zero or more number of attributes and a tag may or
              may not support body content
              Every Tag Library Uniquely identified by uri defined in web.xml.
              we can use the tags in jsp according to the tags and attributes which are defined in *.tld files.
              if we look at .tld files we can find several tags and its attributes.
              note :any jar files that are related to struts framework ,place under the lib directory of the webapplication.
              ----- Anilkumar kari

  • Can I use Struts Validator Plugin's html:javascript tag?

    Hi:
    Is it possible to incorporate the client-side validation using Struts Validator
    Plugin's tag <html:javascript>?
    i.e.
    1) Insert the following tag to A.jsp and define a taglib:
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <html:javascript formName="aForm" staticJavascript="true"/>
    2) Define validation.xml as follows:
    <form-validation>
    <formset>
    <form name="aForm">
    <field property="aField"
    depends="required">
    <msg name="required" key="FieldMissingError"/>
    </field>
    </form>
    </formset>
    </form-validation>
    3) Insert the onSubmit event in aForm:
    <netui:form action="SubmitAForm" style="border-width:1px;" onSubmit="validateAForm(this)">

    Instead of writing something like this -
    <p class="logos">Logo1<a href="...></a></p>
    <p class="logos">Logo2<a href="...></a></p>
    <p class="logos">Logo3<a href="...></a></p>
    <p class="logos">Logo4<a href="...></a></p>
    <p class="logos">Logo5<a href="...></a></p>
    <p class="logos">Logo6<a href="...></a></p>
    Why not have something like this -
    <div id="logodiv">
    <p>Logo1<a href="...></a></p>
    <p>Logo2<a href="...></a></p>
    <p>Logo3<a href="...></a></p>
    <p>Logo4<a href="...></a></p>
    <p>Logo5<a href="...></a></p>
    <p>Logo6<a href="...></a></p>
    </div>
    with CSS like this -
    #logodiv p { ... }

  • Pls help me writing logic:iterate tag in jsp page

    Hey guys , I am struck in retriving string p1,p2,p3 in the jsp page
    Pls have a look ata the code
    In DAO class:-
    StdprdDAO.java
    Public arrayList getPFP()
    ArrayList a = new ArrayList();
    While(rs.next())
         columnsVO colVO = new columnsVO;
         colVO.setProduct(rset.getString(1));//will store in String colProduct
         colVO.setFamily(rset.getString(2));//will store in String colFamily
    colVO.setPrice(rset.getString(3));//will store in String colPrice
    a.add(colVO);
    return a;
    In Action Class:-
    ArrayList final = null;
    StdprdDAO DAO = new stdprdDAO();
    final = DAO.getPFP();
    For(int i = 0; final !=null && i<final.size() ; i++)
         columnsVO VO = null;
         VO = (columnsVO)final.get(i);
         String p1 = (String) VO.getProduct();
         String p2 = (String) VO.getFamily();
         String p3 = (String) VO.getPrice();
         Request.setAttribute(“p1”,p1);
         Request.setAttribute(“p2”,p2);
         Request.setAttribute(“p3”,p3);
    In JSP PAGE:-
    id = “columnsVO”>
    <bean:write name = “columnsVO” property=”final” id=”p1”>
    but still I am doubting my above sentences in jsp page ,so pls correct them if possible.
    Instead of l;ogic:iterate can I use directly getattribute(“p1”)? <logic:iterate
    Still I m doubting I can not utilize columnsVO file in logic:iterate, I can utilize only formbean file.
    So pls help me with this.

    May I ask why have you done it?
    If it is related to printing of the list then it is of no use.But it IS of use. The objects compEmployees is in scope.
    It has the list we want to print out.
    With logic:iterate:
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <logic:iterate name="compEmployees" property="totalEmps" id="emp">
              <tr>
                <td>
                  <bean:write name="emp" property="empNo"/>
                </td>
                <td>
                  <bean:write name="emp" property="empName"/>
                </td>
              </tr>
         </logic:iterate>
    </table>or alternatively with JSTL and c:forEach
    <table>
         <tr>
           <th>Number</th>
           <th>Employee</th>
         </tr>
         <c:forEach items="${compEmployees.totalEmps}" var="emp">
              <tr>
                <td>
                  <c:out value="${emp.empNo}"/>
                </td>
                <td>
                  <c:out value="${emp.empName}"/>
                </td>
              </tr>
         </c:forEach>
    </table>Cheers,
    evnafets

  • How to use logic:interate tag in this case? thanks a lot.

    a javabean:
    a{
    int a;
    ArrayList bList (to store some strings);
    request.setAttribute("a",a);
    then how can I use <logic:iterate> tag to loop to use <bean:write> tag to write out the strings contained by bList?

    use getparams and get that attribute(arraylist)
    define a bean in jsp with property as this attribute for which u should have a getter method in context
    the following is to iterate through arralist of arraylist
    <logic:iterate id="accList" name="<%=subAppContextName%>" ="accountsHoldedList">
              <tr>
    <logic:iterate id="accList2" name="accList">
    <td> <bean:write name="accList2"/> </td>
    </logic:iterate>
    <td>
    <jfp:link styleClass="appNavNext" warn="false" bundle="<%=bundleName%>" key="GiveNotice" paramId="selectedAccount" paramName="accList2" href="javascript:submitMyForm();"></jfp:link>
    </td>
    </tr>
    </logic:iterate>
    accountsHoldedList is the one which is set in Context and i am iterating to display it.
    bye

  • JSP - Nested Jakarta Struts Logic Tags

    Hi,
    Simple question....
    Can Jakarta Struts Logic tags be nested when coding JSP's
    i.e.
    ==========================================
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request">
    <logic:greaterEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <logic:lessEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getMaxPage()%>'>
    <logic:equal name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </logic:equal>
    <logic:notEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <a href="<%=request.getContextPath()%>/performSearch.do?pageRequired=<bean:write name='searchSizeTracker' property='page_no'/>&action_id=<bean:write name='searchActionForm' property='currentActionId'/>&searchType=<bean:write name='searchActionForm' property='searchType'/>&currentScreen=search_reorder"><jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </a>
    </logic:notEqual>
    </logic:lessEqual>
    </logic:greaterEqual>
    </logic:iterate>
    =========================================
    The above code sample seems to fail to get past the first <logic:greaterEqual tag even though the conditions are met. And the iterator just loops throught the rest of the SearchTrackerObjects.
    I'm not sure whether logic tags can be nested as shown???
    Thanks in advance.

    Yes you should be able to nest logic tags like that.
    However you seem to be wanting to limit the values that are iterated through using the greaterEqual and lessEqual tags.
    I would suggest you use the offset and length attributes on the logic:iterate tag:
    something like:
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request" offset ="<%searchActionForm.getCurrentPage()%>" length="<%searchActionForm.getMaxPage() - searchActionForm.getCurrentPage()%>">Cheers,
    evnafets

  • JSP Compile Error when using dynamic ID in logic:iterate and bean:size

    Hello,
    I try to create a dynamic table with logic:iterate and bean:size tag. Dynamic means the attributes are written by scriptlet. Eg.:
    <logic:iterate id="customerBean" name="<%= formName %>"  property="<%= propertyName%>" length="<%= sRowSize%>">When I replace the id Attribute with propertyName I get compile errors, such as
    the compiler doesn't know the value at runtime:
    Unable to compile class for JSP An error occurred at line: 179 in the jsp file: /pages/formContent.jsp Generated servlet error: _newCustomer.java:1046: Missing term. java.lang.Object <%= propertyName %> = null; ^
    Whats wrong ?
    Thanks for your help

    Solution: don't use a runtime expression for the id attribute.
    The id attribute is used to declare
    - an attribute in scope
    - a scriptlet variable on the page
    These are only available for the duration of the <logic:iterate> tag
    The "id" is only used in your programming. You don't need to make it dynamic.

  • How to perform logical comparison using struts

    Hi all, I know this is probably not the best forum for a question regarding struts, but am sure most developers here are familiar with it.
    how do you implement this using struts logic present or logic no present tags ?
    if ((a != null ) && (b != null))
         // perform operation
    else
         // perform altername operation
    I am familiar with the stuts logic tags but not sure about the nesting levels to perform this type of operation.
    Cheers

    <logic:present name="XXXXForm" property="a">
         <logic:present name="XXXXForm" property="b">
              // perform operation
         </logic:present>
    </logic:present>
    <logic:notPresent name="XXXXForm" property="a">
         <logic:notPresent name="XXXXForm" property="b">
              // perform altername operation
         </logic:notPresent>
    </logic:notPresent>
    /code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to use form name in struts html:form tag

    Hi,
    I want to validate text box value, if it is ordinary html form I would have done like this <form name="myform" action="xxxx.jsp" onsubmit="return validate()">
    But am using struts html:form tags. In this case how can I use/specify name for a form.
    Can any one help me.
    Thanks

    The name of the form comes from the actionForm you have defined backing it.
    View source on the generated page to see what HTML it constructs.
    You are able to use the onsubmit event with the <html:form> tag just like the standard one, so if all you want to do is that:
    <html:form action="/saveUser" onsubmit="return validate()">
    ...You can also give it a styleId, which will generate an id in the HTML.
    See the tag documentation for details: http://struts.apache.org/1.2.x/userGuide/struts-html.html#form

  • Urgent help on logic:iterate

    Dear all,
    I have a problem on logic:iterate and structs. Suppose I have EmployeeListAction to get the employees data as below :-
    employees = EmployeeData.getEmployees(getDataSource(request));
    request.setAttribute("employees", employees);
    In the EmployeeData file, sample codes are as below :-
    Employee employee = null;
    ArrayList employees = new ArrayList();
    employee = new Employee();
    employee.setName(firstname);
    employee.setEmail(Email);
    employee.setTimezone(Time_zone);
    employees.add(employee);
    In JSP, the way to call the employees data in the logic:iterate tag is as below :-
    <logic:iterate id="employee" name="employees" indexId="index" scope="request" property="com.convenxia.EmployeeListAction"
    <bean:message...>
    </logic:iterate>
    But it return errors which is as below :-
    javax.servlet.ServletException: Cannot find bean employees in scope session
    I have tried :-
    <logic:iterate id="employee" name="employees" indexId="index" scope="request"> or
    <logic:iterate id="employee" name="employees" indexId="index" scope="request" type="com.convenxia.Employee">
    But it still return errors which is as below :-
    javax.servlet.ServletException: Cannot find bean employees in scope session
    How to resolve it ?
    Please help me as soon as possible.
    Thank you.
    Cheers,
    yymae

    It look like you did not define or use bean.
    In program you do: request.setAttr || request.getSession().setAttr
    In jsp you then pick it up first:
    <jsp:useBean id="employees" class="...." scope=[request || session] (depends where you put it) />
    or for struts:
    <bean:define id="employees" scope="..[as above] toScope=[where you want to pick it up in iterate]"
    type="..." />
    then you should be able to use it safely in iterate tag.

Maybe you are looking for