Hi all,

I am using Struts since a couple of months and i face a problem with the
<set-property> tab in the <form-bean> tag in struts-config.xml

I understood that the <set-property> could be used to initialize parameters
of JavaBeans (see struts-config.dtd).

But in fact this doesn't work in my case:

I am building an Application System and a Administration System using
Struts,Apache and Tomcat.
I have a "UserListForm" in my Administration System, which is a "ActionForm"
listing all the users registered in my Application System.
This UserListeForm is linked, through action-mapping,with a JSP Page
UserList.jsp, who is just displaying the list.
I would like to give to the Administrators the possibility to fix the
maximum number of element in the list, and giving them the possibility to
view the rest of the list by links "next" and "previous".
This works pretty well if I initialize this number directly in my
application code in UserListeForm.
But when i want to make it fixed through the struts-config.xml, the max
number is never initialized.
Can anybody help me on my problem ???

Here is My Struts-config.xml :
<form-bean   name="UserListForm"
             type="com.myapplication.form.UserListForm"
         <set-property property="numberOfElement" value="4"/>
</form-bean>


Here is my UserListForm extending the ActionForm to be able to use the
<set-property> :

public final class UserListForm extends ActionForm{

  private int numberOfElement;

  public void setNumberOfElement(int _numberOfElement){
    numberOfElement=_numberOfElement;
    }

  public int getNumberOfElement(){
    return numberOfElement;
    }
}

Reply via email to