Using Logic iterate to display a arraylist in STRUts

I m having a form bean containg a string array......
<form-bean
name="myDynaForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="names" type="java.lang.String[]" />
</form- bean>
and in my jsp , i m using .......
<logic:iterate name="myDynaForm" property="names" id="names" >
<tr>
<td class="style3" align="left" width="30%" >
<html:textarea property="names" cols="40" rows="2" size="40" indexed="true" readonly="true" />
</td>
</tr>
Now this code is printing only the first element of String names.
How can i print all the elemts of answer in my jsp

How could you do the same thing but using only two cells?
where the check box returns a specific value in the second.
in this instance its for a staff registration sheet where a checkbox in (A) would return a set value in (B)
i know this might sound simple to you guys in the know but i cant figure it out! I have been messing around trying things with the if function but still only shows me the red triangle (syntax error).
A simple solution would be much appreciated.

Similar Messages

  • How to add a row for every 5 records using logic:iterate

    Hi,
    In my application, using logic:iterate iam displaying 20 records per page.
    I want to insert a row for every 5 records.
    Please tell how to insert that row.
    Thanks in advance.
    Mohan

    I think this could work for you
    for (int x=1 ; x<=20 ; x++) {
    addRowWithRecord
    if (x%5==0)
    addEmptyRow
    }

  • Problem in using logic:iterate in struts

    Hello all,
    I have developed 1 application using struts.I am getting this error in my JSP.I have used logic:iterate.I am able to see the list of topics in my JSP but I am getting error when I am clicking on the hyperlink.This is the error.Please help me.Any help will be highly appreciated.Thanx in advance.
    ApplicationDispatcher[TGMC_DB1-2009] PWC1231: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Cannot find bean: "topic_list" in any scope
    at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
    at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:232)
    at org.apache.jsp.viewThreads_jsp._jspService(viewThreads_jsp.java from :121)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
    StandardWrapperValve[action]: PWC1406: Servlet.service() for servlet action threw exception
    javax.servlet.jsp.JspException: Cannot find bean: "topic_list" in any scope
    at org.apache.struts.taglib.TagUtils.lookup(TagUtils.java:935)
    at org.apache.struts.taglib.logic.IterateTag.doStartTag(IterateTag.java:232)
    at org.apache.jsp.viewThreads_jsp._jspService(viewThreads_jsp.java from :121)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:703)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:542)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:474)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:366)
    at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    at org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:198)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:288)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:270)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:339)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:261)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:212)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
    *//Action class*
    package com.myapp.struts;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import java.util.ArrayList;
    public class DiscussionForumViewAction extends Action {
      public ActionForward execute(ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws IOException, ServletException
          String target = new String("success");
            try
             ArrayList TopicList = null;
             TopicList= Discussion_Forum.getTopics();
             request.setAttribute("topic_list",TopicList);
            catch(Exception ex)
                System.out.println(ex.getMessage());
          return (mapping.findForward(target));
    *// jsp*
    <%@ 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 contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
        </head>
        <body>
            <html:form action="/view_topic.do">
            <br><br><br>
    <center><h2><u>Discussion Forum</u></h2></center>
    <br><br>
            <div align="center">
                  <html:errors />
                <table border="1" cellspacing="0" cellpadding="0">
                                <thead>
                                 <tr>
                                    <th>Forum</th>
                                    <th>Topic/Messages</th>
                                   <th>Last Post</th>
                                 </tr>
                                </thead>
                                <tbody>
                                    <logic:present name="topic_list" scope="request">
                                      <logic:iterate id="TopicForm" name="topic_list">
                                        <tr align="left">
                                          <td>
                                             *<a href="get_threads.do?topic_id=<bean:write name="TopicForm" property="topic_id"/>"><font color="#336699">     <bean:write name="TopicForm" property="topic_name"/></font></a>*
                                        </td>
                                        <td>
                                        <bean:write name="TopicForm" property="no_of_threads"/>
                                       </td>
                                       <td>
                                       <bean:write name="TopicForm" property="last_post" />
                                      </td>
                                    </tr>
                                </logic:iterate>
                            </logic:present>
                     </tbody>
               </table>
            </div>
        </html:form>
    </body>
    </html>
    *//struts config*
        <action path="/view_topic"
                   type="com.myapp.struts.DiscussionForumViewAction"
                   name="TopicFormBean"
                   scope="session"
                   validate="true"
                   input="/Discussion_forum.jsp">
                   <forward name="success" path="/Discussion_forum.jsp" />
                   <forward name="failure" path="/welcomeStruts.jsp" />
           </action>
    *//formbean*
    package com.myapp.struts;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    public class TopicFormBean extends ActionForm {
      protected String topic_name;
      protected String description;
      protected Integer no_of_threads;
      protected String last_post;
      protected Integer topic_id;
        public String getTopic_name() {
            return topic_name;
        public void setTopic_name(String topic_name) {
            this.topic_name = topic_name;
        public String getDescription() {
            return description;
        public void setDescription(String desc) {
            this.description = desc;
         public Integer getNo_of_threads() {
            return no_of_threads;
        public void setNo_of_threads(Integer no_of_threads) {
            this.no_of_threads = no_of_threads;
        public String getLast_post() {
            return last_post;
        public void setLast_post(String last_post) {
            this.last_post = last_post;
         public Integer getTopic_id() {
            return topic_id;
        public void setTopic_id(Integer topic_id) {
            this.topic_id = topic_id;
          }

    Thanx Praveen,
    I have already googled this error.I found many people have already posted this problem.But my problem is different.I am getting error only when clicking on hyper link otherwise that arraylist is displaying result on jsp.
    I have also gone through this link
    http://blog.smartlogicsolutions.com/2007/06/12/struts-11-problems-with-logiciterate-tags-and-cannot-find-bean-xxx-under-any-scope/
    It talks about :-
    1) using logic:present tag if your arraylist can be null.
    2) Take care that getter setter are properly written.. I mean there are no spelling mistakes.
    3)arraylist is set in request scope.
    4)I have also included the necessary taglibs.
    I have confirmed all these things.Please help me.I am pretty new to java.Thanx.
    Neha

  • 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.

  • I am not able to use logic iterate to print values in tables

    hi ,
    Any one plz help me in this..
    i am using struts 1.2.i have values to be displayed in table in an
    ArrayList.for example emp_id one ArrayList.
    emp_name another ArrayList.i want to display this in a jsp page.
    i have these values in ActionForm getter setter method as
    public void setname(ArrayList<String> a1){ 
        this.a1=a1;
      public ArrayList<String> getname(){
        return this.a1;
    public void setname(ArrayList<String> a2){ 
        this.a2=a2;
      public ArrayList<String> getname(){
        return this.a2;
      }to be displayed in jsp page
    as
    emp_ id emp_name
    1 san
    2 jay
    etc
    plzzz hepl me.thanks in advance.........

    Opps,Was too late to reply... :(
    sanjay_gates wrote:
    hi ,
    Any one plz help me in this..
    i am using struts 1.2.i have values to be displayed in table in an
    ArrayList.for example emp_id one ArrayList.
    emp_name another ArrayList.i want to display this in a jsp page.
    i have these values in ActionForm getter setter method as
    public void setname(ArrayList<String> a1){ 
    this.a1=a1;
    public ArrayList<String> getname(){
    return this.a1;
    public void setname(ArrayList<String> a2){ 
    this.a2=a2;
    public ArrayList<String> getname(){
    return this.a2;
    }to be displayed in jsp page
    as
    emp_ id emp_name
    1 san
    2 jay
    etc
    plzzz hepl me.thanks in advance.........Well first thing is that you need to right Convensions.
    public void setName(ArrayList<String> a1){ 
         this.a1=a1;
       public ArrayList<String> getName(){
         return this.a1;
       } and try to iterate it in the below fashoin.
    <logic:iterate id="varString"  name="formBean" property="name">
        <bean:write property="name"/><br/>
    </logic:iterate>Hope this might help :)
    REGARDS,
    RaHuL

  • How to select a drop down option item while using logic:iterate?

    I am using the following peice of code -
    {color:#808080}+String countrySelected = (String)request.getAttribute("country");+
    +....+
    +<logic:iterate id="countryVO" name="countryList" type="com.sa.biz.vo.airport.CountryVO">+
    +<%+
    +if (countrySelected != null){+
    String countrySel = countryVO.getCountryCode().toString();
    String selected = (countrySel.equalsIgnoreCase(countrySelected)) ? " " "Selected" : " ";+
    +%>+
    +<option value="<%=countryVO.getCountryCode()%>*<%=selected%>*"><bean:write property="countryName" name="countryVO"/></option>+
    +<%+
    +}+
    +%>+{color}
    {color:#808080}+</logic:iterate>+
    {color}{color:#000000}The drop down is a list of country names (value - country code, display text - country name) which gets populated from the database. I need to ensure that the countrySelected is the menu item which gets selected in the drop down.
    The expected option item is not rendered as selected when i run this code? Please help!!{color}

    <option value="<%=countryVO.getCountryCode()%>" <%=selected%>>Apply the above change which should help you out on the same. :)
    REGARDS,
    RaHuL

  • Not able to use collection multiple times in a jsp using logic:iterate

    I have following question:
    I am working on a report using J2EE. I have a collection(resultset) which has 3 different types of vendors information along with other information in the collection and I want to put them into 3 different sections on my report depend on vendor type in the collection (resultset).
    Anyone know that I can able to use same collection multiple times uisng <logic:iterate> or is any other way of doing this.
    Thanks,

    Enable the logs on your router. Then try to do remote desktop. It will fail of course. After it does, view the logs, there might be ports listed in the incoming logs that you failed to forward.

  • Proble with Struts Taglib "logic:iterate"

    I m designing an simple application, it uses to input some data and then display them.
    For example,I want to input studentID,studentName into the database,but i want to input more than one student data each time.
    This is my FormBean souce:
    package system.form;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMessage;
    import javax.servlet.http.HttpServletRequest;
    public class StudentForm {
        private String[] studentID;
        private String[] studentName;
        public String[] getStudentID() {
             return studentID;
        public String[] getStudentName() {
             return studentName;
        public void set(String[] field) {
             studentID = field;
        public void set(String[] field) {
             studentName = field;
    }This is my form:
    <html:form method="post" action="/add">
        StudentID: <html:text property="studentID"/>
        StudentName:<html:text property="studentName"/>
        <br/>
        StudentID: <html:text property="studentID"/>
        StudentName:<html:text property="studentName"/>
        <br/>
        <html:submit value="add"/>
    </html:form>The problem is: my StudentForm is in SESSION scope.So after i have input some data,i return to the input page, the text filed will display the data i inputed last time.
    But when i do it, i saw the data in the field are like this:
    [Ljava.lang.String;@595420
    [Ljava.lang.String;@a218a5
    [Ljava.lang.String;@2f54
    Not the data i input,I think the problem is that my attribute in the StudentForm is array string, not string. So there is any problem when display.
    What can i do to resolve it?
    Also,there is another problem.
    In my input page. I must iterate the input field like:
    StudentID: <html:text property="studentID"/>
        StudentName:<html:text property="studentName"/>
        <br/>
        StudentID: <html:text property="studentID"/>
        StudentName:<html:text property="studentName"/>
        <br/>
        ....So when i want to input 10 records each time, i must iterate the html above 10 times,and then 20 records needs iterating 20 times, it's bald and it makes the page hard to read and maintain.
    So i want to use Struts's Tag <logic:iterate> to manipulate it.
    But i don't know how to use it.
    Can anybody give me a hand? Thank u.

    First of all, the studentID and the studentName are related. If you keep them as two separate String arrays, it will be very hard to use logic:iterate to display them together.
    I would suggest that you first create a VO class which contains only studentID and studentName and have getter-setter methods for them. (This is logically good as you are modelling a student using a separate class) And, in your form, declare a studentVO[ ] and have getter-setter methods. You may need to change them and add new ones as they will have to be indexed. This can be looked up in the Struts documentation page.
    Finally in your jsp, iterate over the studentVO[ ] bean and give the respective getter property of studentID and studentName in VO with indexed = "true"....
    <logic:iterate id = "studentVO" name = "<formbean name>" property = "studentVO">
    <html:text name="studentVO" property = "studentID" indexed = "true"/>
    <html:text name="studentVO" property = "studentName" indexed = "true"/>
    etc..
    </logic:iterate>
    (Note that you may have to give the type attribute in your logic:iterate so that it may be cast into the right VO object)
    Hope this helps.

  • 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

  • Reg logic:iterate Urgent

    Hi All,
    Having doubt in <logic:iterate>... I am using the following for getting two ArrayList into a JSP using form bean.
    Im having table consisting of 5 column
    element1 element2 element3 element4 element5
    In this element2 is a list which display value in the label and element3 is another list which display the values in combo box.
    I need to know how to iterate two different list in the same row.... using <logic:iterate>...
    Pls Help me..
    Thanks in Advance.. For providing the solution..

    You have two ArrayList to be iterated in the same row but in defferent column.
    <td>
    <logic:iterate id="list1" name="ArraList1">
    <bean:write name="list1" property="propertyname"/>
    </logic:iterate>
    </td>
    <td>
    <html:select property="">
    <logic:iterate id="list2" name="ArraList2">
    <html:option value=""><bean:write name="list2" property="propertyname"/></html:option>
    </logic:iterate>
    </html:select>
    </td>

  • Question on logic:iterate

    Hi,
    I have stored HashMap in Application scope.This HashMap stored collection of objects.
    Each object has its getter setter methods.
    Application scope attribute = "all"
    Hashmap stored in this attribute = "hm"
    object stored in hm = key:"all" , value="chatroom"
    Now how can i get the getter setter value displayed on page of chatroom object using Logic:iterate.
    Thanks in advance

    <logic:iterate id="db" name="dbForm">
    <tr>
    <td>
    <bean:write name="db" property="name"/>
    </td> <td><bean:write name="db" property="name1"/></td>
    </tr>
    </logic:iterate >
    dbForm is my form name where i have getname,getname1 for storing two
    ArrayList..
    but i find error as Cannot create iterator for this collection;(
    where i went wrong;(

  • logic:iterate inside logic:iterate

    How to use <logic:iterate> inside another <logic:iterate>?? pls explain me with example......i found in google that its possible but example was not clear....please help me

    oppsss i throught it the other way around
    are you trying to populate values of a single Combobox ??
    if yes Try with
    <html:select name="detailForm" property="selectedValue" indexed="true" >
        <logic:iterate name="detailForm" property="selectedAction" id="row">
              <html:option value="<%=row%>"><%=row%></html:option>
        </logic>
    </html:select>where you would have properties something like the once below in your Form bean.
    public String getSelectedValue(){
      return selectedValue;
    public void setSelectedValue(String selectedValue){
       this.selectedValue = selectedValue;
    public String[] getSelectedAction(){
    return selectedAction;
    public void setSelectedAction(String [] string) {
    this.selectedAction=selectedAction;
    }Hope this might help :)
    REGARDS,
    RaHuL

  • Why can't  the JSP display the data with logic:iterate?

    Hi,all
    I am writing a web application with Struts framework. I dont know what's the problem when I use the tag logic:iterate in my application. I have created a form bean follow source code:
    public class ProductsForm extends ActionForm {
         private Vector alist;
         public void reset(ActionMapping mapping, HttpServletRequest request) {
         this.alist = new Vector();
         public Vector getAlist() {
              return alist;
         public void setAlist(Vector alist) {
              this.alist = alist;
    I also created action for the form
    public class ProductsAction extends Action {     
    public ActionForward execute(
              ActionMapping mapping,
              ActionForm form,
              HttpServletRequest request,
              HttpServletResponse response)
              throws Exception {
                   String target = "success";
                   if(form!=null){
                        ProductsForm aForm = (ProductsForm) form;
                        Vector aList = new Vector();
         //loadProductsList() method return the Vector object
    // which is a array included Product object.
                        aList = loadProductsList();
                        if(!aList.isEmpty()){
                        request.setAttribute("aList",aList);
                   return mapping.findForward(target);
    JSP page follow:
    <logic:iterate id="aitem" name="aList">
    <tr>
    <bean:write name="aitem" property="productname"/>
    </tr>
    </logic:iterate>
    Anybody tell me why the JSP page can't display the result. Thanks.

    Are you getting any error messages, or are you just not seeing anything in the page? If you get error messages, please post them.

  • 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

  • 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.

Maybe you are looking for

  • How do I get it to be read as a mass storage device?

    I've read all of the step by step processes on viewing my ipod touch (3rd generation) to be viewed in "My Computer" as a mass storage device and then viewing the files and putting music on that way, or taking the music on there and putting it on itun

  • Google images not loading properly!!

    Hey guys, Im not sure if this is a networking problem or but here we go... Here's my prob - Whenever i google image search something, it never loads all of the thumbnails! Or the other prob is, when i change the search option to "larger than x" then

  • Comments on documents are duplicated when saved in SharePoint

    Greetings, We are using Office 365, two colleagues of mine are working on a document that has been around for sometime.  They have uploaded the document to Sharepoint and whenever the two of them work on the document and leave a comment for the other

  • Problem in Process Chain Scheduling

    Hi BW Experts, We are running daily Process Chains in the Night Time. Due to Memory Problem in BW Production Server we stopped all Process Chains on 20/09/2007. Yesterday our memory problem solved. So I scheduled Process Chains Yesterday. We have Tim

  • Installing the Dreamweaver Extension

    We are using the "OracleAS Portal Installation Guide for Dreamweaver Extension" document that has a creation date of December 02, 2003. In this document, under the "Installing the web service", step 2, it states that we should copy the portalTemplate