Monday, July 22, 2013

how to use tag in strut 1.2?

Javadoc for :
Specifies the attribute name of the bean whose property is accessed to retrieve the value specified byproperty (if specified). If property is not specified, the value of this bean itself will be rendered.
In essence, if you have a JavaBean (with getters and setters),
Person person = new Person;
request.setAttribute("person", person);
by setting , you're telling Struts to first findperson object first from PageContext scope. If not found, then request, then session, thenapplication scope.
The property="age" attribute (from  tag), will then call the getter methodgetAge() from the Person object (irrespective of whether there's an instance variable called ageon the bean).
Hope this helps.

No comments:

Post a Comment