struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patil, Sheetal" <pati...@diebold.com>
Subject RE: Accessing List in JSP
Date Fri, 12 May 2006 05:04:35 GMT
First thing you have to set your form object in either session or
request by in action classs
        if("request".equals(mapping.getScope())) {
            request.setAttribute(mapping.getAttribute(),form);
        }else {
            request.getSession().setAttribute(mapping.getAttribute(),
form);
        }

And then you have to use name of your action form registered in
struts-config.xml in <logic:iterate name="    here    ">

Check out if it work  and reply

Regards,
Sp




-----Original Message-----
From: Sonu S [mailto:sonu.in@gmail.com] 
Sent: Friday, May 12, 2006 10:27 AM
To: user@struts.apache.org
Subject: Accessing List in JSP

Hi 2 all


I am using Struts 1.2

in my action class i am writing

List testList = new ArrayList();

testList.add("str 1");
testList.add("str 2");
testList.add("str 3");

MyForm myForm = (MyForm) form;
myForm.setMyList(testList);

In Action Form i have done
public class myForm extends ActionForm{
    List myList;

    public List getMyList() {
	 return MyList;
    }
    public void setMyList(List MyList) {
	 this.MyList = MyList;
    }

I want to access this List in JSP.

I am trying <logic:iterator> butit is not working. I am trying

<logic:iterate id="test" name="myForm" property="myList" > <bean:write
name="test" property="myList"/>

Could u please tell me how to access List in JSP page


Thank you
With regards

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message