FOREACH var IN REFDATA

Hi everybody,
some info on FOREACH var IN REFDATA.  If the filter restriction is such that there is not existing data within the filter restriction, then the function will no be executed at all (and hence there is no looping over REFDATA).
The typical example for using FOREACH var IN REFDATA is when moving actual data from an actual cube to a plan cube.  IF the filter restriction then is e.g. VTYPE = 20 (where 10 = actual and 20 = plan) AND there is no plan data existing in the cube at the moment of executing the function THEN the coding in the function is not executed at all since the buffer is empty.
4 basic info on FOREACH var IN REFDATA also c:  
Help on aForeach in Selection and Foreach in Variable

Hello,
The planning function of type formula reads the reference data automatically.
The statement should do the job.
{ KEYFIGURE, 10 } = { KEYFIGURE, 20 }.
If you write
DATA VERS TYPE 0VERSION.
FOREACH VERS IN REFDATA.
  { KEYFIGURE, 10 } = { KEYFIGURE, VERS }.
ENDFOR.
the system would not do the job. The system will not read in data from version = 20.
You can tell the system, which reference data you use by
a) writing it in an operand at the left side of an expression
{ KEYFIGURE, 10 } = { KEYFIGURE, 20 }.
b) using a global variable and using this variable in an operand.
DATA VERS TYPE 0VERSION.
VERS = VARV( GLOBVERS).
{ KEYFIGURE, 10 } = { KEYFIGURE, VERS }.
Best regards
Hans-Juergen Schwab

Similar Messages

  • How to set foreach's items(wcm:idcService)

    I use wcm:idcService get the service from the Oracle content server,and I set
    the service as COLLECTION_GET_CONTENTS,var as contentInfo,when I use the
    c:foreach tag to show my datas,how should I get the contentInfo,the code
    below is not usefull.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:wcm="http://www.oracle.com/jsp/wcm"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <jsp:output omit-xml-declaration="true" doctype-root-element="HTML"
    doctype-system="http://www.w3.org/TR/html4/loose.dtd"
    doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>homepage</title>
    <link type="text/css" rel="stylesheet" href="../wcm/css/template.css"/>
    <!-- <link type="text/css" rel="stylesheet" href="../../../css/template.css"/>-->
    </head>
    <body>
    <jsp:include page="/wcm/templates/fragments/header.jspf"/>
    <div id="container">
    <jsp:include page="/wcm/templates/fragments/menu.jspf"/>
    <jsp:include page="/wcm/templates/fragments/sidebar.jspf"/>
    <wcm:idcService service="COLLECTION_GET_CONTENTS" var="contentInfo">
    <wcm:idcParameter name="SortField" value="dInDate"/>
    <wcm:idcParameter name="SortOrder" value="Desc"/>
    <wcm:idcParameter name="hasCollectionPath" value="true"/>
    <wcm:idcParameter name="dCollectionPath"
    value="/Contribution Folders/root"/>
    </wcm:idcService>
    <c:forEach var="row" items="${contentInfo.resultSets.DOC_INFO.rows}"><!-- the items here is not getted from the var contentInfo,it is setted manually-->
    <p>The content item <em>${row.dDocName}</em> is a
    <u>${row.xWebsiteObjectType}</u></p>
    </c:forEach>
    <jsp:include page="/wcm/templates/fragments/footer.jspf"/>
    </div>
    </body>
    </html>
    </jsp:root>

    Hi,
    You can use session variables to set the value. There are apis available for setting and getting the session variables.
    declare
    persons number;
    begin
    p_session.set_value(
    p_block_name => blk,
    p_attribute_name => 'A_FLIGHTNO',
    p_value => to_char(NULL)
    persons := p_session.get_value_as_number(
    p_block_name => blk,
    p_attribute_name => 'A_NOF_PERSONS');
    end;
    Thanks,
    Sharmila

  • Urgent need help in c:forEach in JSF

    I have a problem while using loop with any UI component ex Input field
    here is my code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%-- jsf:codeBehind language="java" location="/JavaSource/pagecode/Loop.java" --%><%-- /jsf:codeBehind --%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
    <%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c_rt"%>
    <%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <HTML>
    <HEAD>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ page
    language="java"
    contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"
    %>
    <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <META name="GENERATOR" content="IBM WebSphere Studio">
    <META http-equiv="Content-Style-Type" content="text/css">
    <LINK href="theme/Master.css" rel="stylesheet" type="text/css">
    <TITLE>Loop.jsp</TITLE>
    <LINK rel="stylesheet" type="text/css" href="theme/stylesheet.css"
         title="Style">
    </HEAD>
    <f:view>
         <BODY><hx:scriptCollector id="scriptCollector1">
         <h:form styleClass="form" id="form1"><P>Place content here.<BR>
         <%
    // initialisation of string[][]
    String[] sValues = new String[5];
    for (int i=0; i<sValues.length; i++){
           sValues= "" + i;
    pageContext.setAttribute("arrayValues", sValues);
    %>
    <!--//
    // And now to test print out the values
    // -->
    <c:forEach var="row" items="${arrayValues}">
    <c:out value="${row}"/>
    <h:inputText styleClass="inputText" value='#{row}' rendered="true" >
    </h:inputText>
    <%="<br>"%>               
                   </c:forEach>
         <BR>
         </P></h:form>
         </hx:scriptCollector>
         </BODY>
    </f:view>
    </HTML>
    when i run the code nothing displayed.
    when using standared html input field, the code runs well.
    waiting for reply

    JSF dose not like DOCTYPE tag for HTML. Try removing that.
    Vaibhav

  • How to name items that are coming from forEach loop

    I have an arraylist of String[]'s that I need to display on the screen. I am sorting through the arrayList and pulling the values I need and displaying them without a problem. Two of the values from the String[] the user can modify. The problem is that when they modify it they aren't being mapped back to the original ArrayList when I submit the form. There seem to me to be two possible answers... A. It can't be done, or B I don't know what to name the values.
    So here is the code I am using and then I'll explain how I've worked around the problem.
    <table><tr>
              <th> </th>
              <th><fmt:message key="T895Form.deNumber" /></th>
              <th><fmt:message key="T895Form.deDescription" /></th>
              <th><fmt:message key="T895Form.deValue" /></th>
              <th><fmt:message key="T895Form.calcOptions" /></th></tr>
              <c:set var="counter" value="0" />
         <c:forEach var="list" items="${sessionScope.T895Form.dictionaryDE}" varStatus="status">
              <c:if test="${list[0]>100}">
                   <c:set var="counter" value="${counter+1}" />
                   <tr>
                        <td><c:out value="${counter}" /></td>
                        <td><INPUT type="text" size="5" MAXLENGTH="5" name="deNumber"
                                       readonly style="background-color: #D3D3D3;"
                                       value="<c:out value='${list[0]}' />"></td>
                        <td><INPUT type="text" size="50" MAXLENGTH="50" name="deDescription"
                                       readonly style="background-color: #D3D3D3;"
                                       value="<c:out value='${list[1]}' />"></td>
                        <td><INPUT type="text" size="20" MAXLENGTH="50" name="deValue"
                                       value="<c:out value='${list[2]}' />" onblur=""></td>          
                        <td><select name="calcOptions">
                             <c:choose>
                                  <c:when test="${empty list[3]}">
                                       <option selected value=""></option>
                                  </c:when>
                                  <c:otherwise>
                                       <option value=""></option>
                                  </c:otherwise>
                             </c:choose>
                             <c:choose>
                                  <c:when
                                       test="${not empty list[3] and list[3] == 'O'}">
                                       <option selected value="O"><fmt:message
                                            key="T895Form.calcOptionsO" /></option>
                                  </c:when>
                                  <c:otherwise>
                                       <option value="O"><fmt:message key="T895Form.calcOptionsO" /></option>
                                  </c:otherwise>
                             </c:choose>
                             <c:choose>
                                  <c:when
                                       test="${not empty list[3] and list[3] == 'A'}">
                                       <option selected value="A"><fmt:message
                                            key="T895Form.calcOptionsA" /></option>
                                  </c:when>
                                  <c:otherwise>
                                       <option value="A"><fmt:message key="T895Form.calcOptionsA" /></option>
                                  </c:otherwise>
                             </c:choose>
                             <c:choose>
                                  <c:when
                                       test="${not empty list[3] and list[3] == 'S'}">
                                       <option selected value="S"><fmt:message
                                            key="T895Form.calcOptionsS" /></option>
                                  </c:when>
                                  <c:otherwise>
                                       <option value="S"><fmt:message key="T895Form.calcOptionsS" /></option>
                                  </c:otherwise>
                             </c:choose>
                        </select></td>     
                        <td><INPUT type="hidden" size="20" MAXLENGTH="50" name="position"
                                       value="<c:out value='${list[8]}' />"></td>                                                       
                   </tr>                                                  
              </c:if>     
         </c:forEach>
    </table>Right now when I submit the page I get String[]'s returned for each of the columns... I thing use the position string[] that contains the position the row was pulled from the arraylist at and loop through the arrays and put them back in the arraylist... that way when I revisit the screen the arraylist still contains the users changes...
    This all works.. but I was wondering if there was a better way to do this. .. ie name the deNumber input something else that will map directly back to the arrayList?
    Thanks in advance... but again, it works the way I'm doing it... it just isn't very pretty.

    There seem to me to be two possible answers...
    A. It can't be done, or
    B I don't know what to name the valuesIf you are talking standard JSP/JSTL the answer is A
    however as part of Struts, they developed indexed properties.
    You can use the jakarta commons BeanUtils package to automatically populate
    Therefore the answer is B if you consider this approach.
    Each individual textfield gets numbered. This is resolved by the BeanUtils package.
    You don't NEED struts to do this. You can use the BeanUtils class on its own. I haven't done too much research into it though :-)
    <INPUT type="text" size="5" MAXLENGTH="5" name="deNumber[${status.index}]" Linkies:
    http://struts.apache.org/userGuide/building_view.html#indexed
    http://jakarta.apache.org/commons/beanutils/api/index.html
    Cheers,
    evnafets

  • c:forEach use .......need help

    I am making a form of registering details of competitive exams.in this i am using the jstl for fetching the values fromthe database
    like qualification table is master table and the eligibilty table .
    these two tables are drop down list and depend on one another
    in the sense ...eligibility table when u select multiple values from it then an event onblur will make the changes in the qulaification drop down list.
    the list of values from the master tables are taken to the bean first and then into the form and also all the getter and setter methods are also there in it
    the code for it is as follows:
    bean
    private String examinationName;
         private List eligibilityList = new ArrayList();
         private List qualificationList = new ArrayList();
         private List sourceList = new ArrayList();
         public CompetitiveExamBean() {
         eligibilityList = DAOMaster.getQualificationMaster();
         if(eligibility!=null) qualificationList=DAOMaster.getQualificationDetail(eligibility);
         sourceList = DAOMaster.getSourceList();
    jsp page
    (Code for eligibility)
    <select name="eligibility" style="width:220pt" multiple size="4" onblur="changeQualification()">
    <c:forEach var="elb" items="${competitiveExamBean.eligibilityList}">
    <option value="${elb.id}"
         <c:forEach var="selEligi" items="${competitiveExamBean.eligibility}">
         <c:if test="${elb.id==selEligi}"><c:out value="selected"/></c:if></c:forEach> >
         <c:out value="${elb.value}"></c:out>
    </option>
    </c:forEach>
    </select>
    (code for qualification)
    <select multiple name="qualification" style="width:220pt">
    <c:forEach var="selq" items="${competitiveExamBean.qualificationList}">
         <option value="${selq.id}"
                   <c:forEach var="selQuali" items="${competitiveExamBean.qualification}">
                   <c:if test="${selq.id==selQuali}"><c:out value="selected"/></c:if></c:forEach> >
              <c:out value="${selq.value}"></c:out>
         </option>
    </c:forEach>
    </select>
    In the jsp page the list of eligibility is shown but the qualification list can't be displayed .........
    javascript for this is
    <script language="javascript">
    function changeQualification(){
    document.forms[0].changeQuali.value="1";
    document.forms[0].submit();
    </script>
    and there is a hidden field ---- changeQuali in the jsp page
    place help me as to where i am going wrong
    waiting for ur reply

    I am making a form of registering details of competitive exams.in this i am using the jstl for fetching the values fromthe database
    like qualification table is master table and the eligibilty table .
    these two tables are drop down list and depend on one another
    in the sense ...eligibility table when u select multiple values from it then an event onblur will make the changes in the qulaification drop down list.
    the list of values from the master tables are taken to the bean first and then into the form and also all the getter and setter methods are also there in it
    the code for it is as follows:
    bean
    private String examinationName;
         private List eligibilityList = new ArrayList();
         private List qualificationList = new ArrayList();
         private List sourceList = new ArrayList();
         public CompetitiveExamBean() {
         eligibilityList = DAOMaster.getQualificationMaster();
         if(eligibility!=null) qualificationList=DAOMaster.getQualificationDetail(eligibility);
         sourceList = DAOMaster.getSourceList();
    jsp page
    (Code for eligibility)
    <select name="eligibility" style="width:220pt" multiple size="4" onblur="changeQualification()">
    <c:forEach var="elb" items="${competitiveExamBean.eligibilityList}">
    <option value="${elb.id}"
         <c:forEach var="selEligi" items="${competitiveExamBean.eligibility}">
         <c:if test="${elb.id==selEligi}"><c:out value="selected"/></c:if></c:forEach> >
         <c:out value="${elb.value}"></c:out>
    </option>
    </c:forEach>
    </select>
    (code for qualification)
    <select multiple name="qualification" style="width:220pt">
    <c:forEach var="selq" items="${competitiveExamBean.qualificationList}">
         <option value="${selq.id}"
                   <c:forEach var="selQuali" items="${competitiveExamBean.qualification}">
                   <c:if test="${selq.id==selQuali}"><c:out value="selected"/></c:if></c:forEach> >
              <c:out value="${selq.value}"></c:out>
         </option>
    </c:forEach>
    </select>
    In the jsp page the list of eligibility is shown but the qualification list can't be displayed .........
    javascript for this is
    <script language="javascript">
    function changeQualification(){
    document.forms[0].changeQuali.value="1";
    document.forms[0].submit();
    </script>
    and there is a hidden field ---- changeQuali in the jsp page
    place help me as to where i am going wrong
    waiting for ur reply

  • Problem using c:forEach

    I'm having a problem using c:forEach. Eclipse is telling me the problem is with the items parameter, and for the life of me, I cannot see why, since I could swear forEach uses an items parameter. Here is my code and the exception report. Can anyone please help? Thanks.
    <table>
         <c:forEach var="user" items="${users}">
              <tr>
                   <td>${user.name}</td>
                   <c:forEach var="education" items="${education}">
                        <td>${education.school}</td>
                        <td>${education.major}</td>
                        <td>${education.degree}</td>
                        <td>${education.gpa}</td>
                   </c:forEach>
                   <c:forEach var="employment" items="${employment}">
                        <td>${employment.employer}</td>
                        <td>${employment.jobtitle}</td>
                        <td>${employment.startdate}</td>
                        <td>${employment.enddate}</td>
                   </c:forEach>
              </tr>
         </c:forEach>
    </table>
    org.apache.jasper.JasperException: /RecruiterResumeResults.jsp(46,1) According to TLD or attribute directive in tag file, attribute items does not accept any expressions
         org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1174)
         org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:821)
         org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
         org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
         org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
         org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1736)
         org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:183)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:332)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)

    In web.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4"
         xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">At the top of my JSP:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@ taglib prefix="s" uri="/struts-tags"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

  • How use forEach tag in xml tag library

    Hi,
    Can u please explain the procedure for using forEach tag for displaying the parsed xml tags?
    This is the code snippet
    <%@ page contentType="text/html" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
    <html>
    <body>
         <c:import url="\books.xml" var="url" />
         <x:parse xml="${url}" var="doc" />
              <x:forEach var="n" select="${doc}/books/book">
                   <x:out select="${n}/title"/>
                   <x:out select="${n}/author" />
         </x:forEach>
    </body>
    </html>
    but I got the fallowing error.
    java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
         at org.apache.taglibs.standard.tag.common.xml.ForEachTag.prepare(ForEachTag.java:51)
         at javax.servlet.jsp.jstl.core.LoopTagSupport.doStartTag(LoopTagSupport.java:262)
         at jsp_servlet.__index._jspService(__index.java:197)
         at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    Just the same way as you do in JSP. Since JSF 1.2 you can use unified EL #{ } in c:forEach.
    You can also use Tomahawk's [t:dataList|http://myfaces.apache.org/tomahawk-project/tomahawk12/tagdoc/t_dataList.html] by the way. It is more efficient.

  • JSTL forEach inside html form

    I am using JSTL to display data in an editable menu. The data is retrieved from a database and the user may change it if required. The problem is that I get a blank page inside the forEach tag.
    %@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <sql:query var="rs" dataSource="jdbc/agenda">
    SELECT * FROM cardapios WHERE username="${pageContext.request.remoteUser}"
    </sql:query>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    <form action="../ChangeMenu" method="POST">
    Everything I write here I can see!!!
    <c:forEach var="r" items="${rs.rows}">
    Restaurante: <input type="text" name="restaurante" value="${r.restaurante}" />  I cant see it!!
    Here I have many <input type="text" ..... etc />
    </c:forEach>
    <input type="submit" value="Salvar" />
    </form>
    </body>
    </html>Well, if I remove the form action, it works properly. So, the data is being retrieved from the database.
    Also, do I really have to use <c:forEach> since it will always retrieve just one line from the table? Is there any other way I can get the data from "rs" ?
    Thanks!

    If you know for certain there is exactly one and only ever one row returned, then you can just access it directly:
    <c:set var="r" value="${rs.rows[0]}"/>With regards to the query, it would probably be better using parameter rather than the variable directly:
    <sql:query var="rs" dataSource="jdbc/agenda">
      SELECT * FROM cardapios WHERE username=  ?
      <sql:param value="${pageContext.request.remoteUser}"/>
    </sql:query>I don't think that would change the functionality, but it would prevent SQL injection attacks.
    I don't see how removing the form action would change the display of the html page.
    My suggestion would be to view source on the generated HTML page, and see what is being produced by running the page.
    Did the query return the results that you wanted? Is it generating valid HTML?
    Cheers,
    evnafets

  • Formating table using c:forEach

    Dear fellow Java Developers,
    I have an object in session called grid whose properties consist of several array lists. I am trying to iterate through each ArrayList so that each list has its own column side by side in one HTML table. Currently the page displays the data but does not build the table correctley. I am having a lot of trouble correctly building the HTML table. Here is my JSP code:
    <table border="1">
         <c:forEach var="cusID" items="${grid.cusID}">
         <tr>
              <td>
                   <c:out value="${cusID}" />
              </td>
         </c:forEach>     
         <c:forEach var="cusName" items="${grid.cusName}">
              <td>
                   <c:out value="${cusName}" />
              </td>
         </tr>
         </c:forEach>
    </table>The CusID and CusName are printed in one long column rather then having a table with two columns side by side as desired.
    Could anyone show me a JSP code example which prints two ArrayLists in seperate columns of a HTML table?
    many thanks in advance to anyone who replies,
    James.

    Lemme see if I understand correctly...
    You have a grid object, with two ArrayLists, cusID and cusName. You want to print a table that looks like this:
    |    cusID[0]    |    cusName[0]    |
    |    cusID[1]    |    cusName[1]    |
    //...My approach would be to redesign your grid to contain a single ArrayList of Customers, which would be a simple JavaBean, like this:
    package beans;
    private String id, name;
    public class Customer implements java.io.Serializable
      public Customer();
      public void  setId(String _id) { id = _id; }
      public void setName(String _name) { name = _name; }
      public String getId() { return id; }
      public String getName() { return name; }
    }Then change your grid to use the Customer bean to store customer IDs and Names in a single array list (named customers) with an appropriate get method... then you could do:
    <table border="1">
         <c:forEach var="customer" items="${grid.customers}">
         <tr>
              <td><c:out value="${customer.id}" /></td>
              <td><c:out value="${customer.name}" /></td>
         </tr>
         </c:forEach>
    </table>

  • JSTL nesting of foreach tag in the c:import

    Ran into the problem when migrated the jstl to 1.2.
    We have the code like below with the c:import and dynamic parameters.
    jstl 1.2 is complaining about the nesting of tags.
    <c:import url="Ixxxxxxxx">
    <c:forEach var="entry" items="${usebean1.htmlParameters}">
    <c:param name="${entry.key}" value="${entry.value}" />
    </c:foreach>
    </c:import>
    What is suggested approach for the c:import with dynamic parameters?
    Any suggestions/solutions will be appreciated.
    Thank you,
    -Sreeni.

    Are you the one who commented out the code you're looking for ?//String desc = StringFactory.getString(attributes.getValue("desc"));You just have to modify you AttributeObject class to hold a new field : String description. And then, it's up to you to create a new constructor or a new setter method.
    Btw, this is not a Swing related question.

  • JSTL forEach tag taking longer time than scriplets ???

    Hi Gurus,
    My STRUTS action class setsup a collection object [roughly 900 + records stored as java beans] to be displayed on my view [JSP]. The problem is, when I iterate over this collection in JSP using <c:forEach> tag, it takes around 4-5 minutes to build up the page.
    I coded the same looping logic through java scriplets embedded within JSP and the processing came down to 1 minute. Should I assume that <c:forEach> tag will have a processing overhead over plain java code in JSP?
    FYI, I checked the server generated SERVLET code under WORK directory of TOMCAT for this JSP with <c:forEach> tag and find lot of code being generated for this <c:forEach> tag implementation. Could it be that the processing of these generated code takes longer than plain java using scriplets?
    Please Help.
    Thanks,
    Karthik.
    <b>JSP using <c:forEach></b>
    <c:forEach var="refurb" items="${BOMDataForm.refurbSummary}" varStatus="loopStatus">                    
    <tr valign="top" bgcolor="#FFFFFF"> 
    <td>
    <div align="center"><span class="modulecontent"><c:out value="${refurb.configName}" /></span></div>
    </td>                     
    <td>
    <div align="center"><span class="modulecontent"><c:out value="${refurb.itemName}" /></span></div>
    </td>
    </tr>
    </c:forEach><b>JSP using embedded scriplets</b>
    <%
    BOMDataForm bomDataForm = (BOMDataForm) request.getAttribute("BOMDataForm");
    ArrayList arrayList = (ArrayList) bomDataForm.getRefurbSummary();
    int loop = arrayList.size();
    for (int i=0;i<loop;i++) {
    out.println("<tr valign=\"top\" bgcolor=\"#FFFFFF\">");
    out.println("<td>");
    out.println("<div align=\"center\"><span class=\"modulecontent\">");
    out.println(((RefurbSearchResult)arrayList.get(i)).getConfigName());
    out.println("</span></div>");
    out.println("</td>");
    out.println("<td>");
    out.println("<div align=\"center\"><span class=\"modulecontent\">");
    out.println(((RefurbSearchResult)arrayList.get(i)).getItemName());
    out.println("</span></div>");
    out.println("</td>");
    out.println("</tr>");                         
    %>

    Never looked at the speed issues. For me it has always been "fast enough"
    When displaying pages with 900 records on it the common approach is to split the result across multiple pages, so that loading doesn't get too long.
    The JSTL tags obviously introduce some overhead in extra procedure calling. As you found out by looking at the generated servlet code.
    Also the EL expressions have to be evaluated. using the reflection APIs. Its pretty certain that direct access to the object is faster.
    The forEach tag uses an iterator under the hood, where you are calling get(i) directly on an ArrayList.
    Any or all of these would be contributing. My guess would be the EL expression evaluation is probably the most overhead.
    One thing about your example I would like to see is how long it would take using an Iterator, rather than calling get(i) on the array elements. That would remove at least one of the differences.
    So in short, yes the JSTL is adding overhead to your page. I'm a bit surprised to hear it is so much though.
    Cheers,
    evnafets

  • ForEach items syntax help please

    This shouldn't be a problem but it is. I have a JSP. I am sending it an attribute that is a collection by calling setAttribute() on the request and then dispatching to the JSP from my front controller servlet. I want to iterate through the collection. The name of the attribute is "changeRequets" and I have tried accessing it without any scope qualifiers and with scope qualifiers and no matter what, this forEach produces no data. I have verified that the JSP is receiving data, because I've accessed the request attribute separately without JSTL. What is wrong with the following please?
       <c:forEach var="chgRequest" items="${requestScope.request.changeRequests}">
                    <tr>
                        <td>
                            <input type="radio" name="crButton" value="<c:out value="${chgRequest.crChangeRequestID}"/>" <c:if test="${status.first}">checked</c:if> />
                        </td>
                    </tr>
    </c:forEach>This produces no data, no rows. I don't get it. I can't find anything in my JSTL book that helps. Thanks.
    Ken

    Ignore the previous reply
    change it to the following
    <c:forEach var="chgRequest" items="${changeRequests}">
                    <tr>
                        <td>
                            <input type="radio" name="crButton" value="<c:out value="${chgRequest.crChangeRequestID}"/>" <c:if test="${status.first}">checked</c:if> />
                        </td>
                    </tr>
    </c:forEach>

  • How to numberformat when using sql:query alogn with c:forEach JSTL tags

    Is there anyway to format the numeric values returned from the database when using <sql:query> alogn with <c:forEach> tags
    Here is my jsp code
    <sql:query..../>
    <c:forEach var="row" items="${queryResults.rows}">
    <tr>
    <td><c:out value="${row.COL1}" /></td>
    <td><c:out value="${row.COL2}" /></td>
    </tr>
    </c:forEach>
    Col1 values are numeric without any formats Eg: 1000, 10000, 1000000 etc.
    how can i format them to 1,000 , 10,1000 , 100,000 etc

    It is polite to mention what your answer was. These posts are not just here for you to ask questions, but to be used as a resource for other people to find answers. Saying "I solved it" with no details helps noone.
    I presume you discovered the JSTL <fmt:formatNumber> tag?

  • Error  while working with JSF SelectOneMenu and JSTL forEach Tag

    Hello,
    I have set up few things in ArrayList in my contextListener as like below
    ServletContext context=event.getServletContext();
    List list=new ArrayList();
    list1.add("Honda");
    list1.add("Mazda");
    list1.add("eClipse");
    context.setAttribute("carList", list)
    I just wanted to display the list in my JSF page, I wrote the below statements in my JSF page
    <h:selectOneMenu value="{com.carSelection}">
    <c:forEach var="car" items="${applicationScope.carList}" >
    <f:selectItem itemLabel="${car}"/>
    </c:forEach>
    </h:selectOneMenu>
    I am getting the below exception
    org.apache.jasper.JasperException: /pages/protected/cmt/index.jsp(23,2) According to TLD or attribute directive in tag file, attribute itemLabel does not accept any expressions
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1124)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:819)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:838)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator
    Could some one help to solve this error (Or) How should I display from my applicationScope list into MenuItems ?
    Edited by: Saravvij on Apr 9, 2008 8:37 PM
    Edited by: Saravvij on Apr 9, 2008 8:38 PM

    Hi,
    get your original message source from SXMB_MONI
    (right click - view source ) then paste your message to your message mapping (Test Tab) in the Integration Repository
    test your mapping and check if it's ok
    Regards,
    michal

  • [JDev 10.1.2] Compare JSTL var attribute with sessionScoped bean attribute

    I'm new to JSTL.
    I'm looking for a way in JDev 10.1.2 to compare a sessionScope bean attribute (sessionScope.User.Username) and a JSTL attribute variable. For this purpose I've developed the following code:
    +&lt;%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%&gt;+
    +&lt;%@ page import="bean.User"%&gt;+
    +&lt;jsp:useBean id="User" class="bean.User" scope="session" /&gt;+
    +...+
    +&lt;c:forEach var="Row" items="${bindings.ReadOnlyViewObject.rangeSet}"&gt;+
    +&lt;c:choose&gt;+
    +&lt;c:when test="${Row.CreatedBy == sessionScope.User.Username}"&gt;+
    +...+
    +&lt;/c:when&gt;+
    +&lt;/c:choose&gt;+
    +&lt;/c:forEach&gt;+
    +...+
    However it doesn't work on the test line. I'm not able to compare Row.CreatedBy to sessionScope.User.Username.
    I've also tried &lt;c:when test="${Row.CreatedBy == User.Username}"&gt; without success.
    Could you help me?
    Thanks.

    The bean property will have an initial lowercase name, so try sessionScope.User.username ?
    I believe since you used the jsp:useBean, that you can also just use User.username without the "sessionScope" in there, as well.

Maybe you are looking for

  • CRM WEB UI log in page images and text

    Hi Experts, At Login page of WEB UI, I want to remove the image of u201CSap net weaver sap Web Application serveru201D  I want to remove the warning message: No switch to HTTPS occurred, so it is not secure to send a passwordu201D And I want to remov

  • Why is the notification center different on ipad mini and iPhone?

    For instance.. Weather shows in the notification center on ipad mini, and not on iPhone. Also, calculator shows on iPhone control center and not ipad mini. I can understand why the calculator doesn't display as an option for the ipad mini as the calc

  • I cant activate my adobe acrobat 7

    i just change a new notebook, now i am using window 7 professional 64bit, i try to install and activate my Adobe Acrobat 7, but can't success, anyone can help me about this?? need it urgent for work~

  • 'Auto resize image' 'Settings' dialog box controls

    I have a signature that contains an avatar image (size 120px by 120px) Every time I 'Send' an 'Auto Resize Image' > 'Settings' dialogue box pops up How can I bypass this as its becoming annoying. Most emails (98%) do not contain any other embedded or

  • Why do I get the message "error connecting to acrobat"?

    Why am I getting the message "error connecting to the acrobat..." when I try to open a pdf file from the internet? I have the adobe reader installed on my tablet. This is something that just started happening. I did not have this problem before. I ho