Dmitri,

One alternative to your proposal to have all of the beans in the
request/session/application stack be represented as XPath variables is to
have them appear as sub-elements of request, session and application
nodes...

<bean:write xpath="/application/books[title =
/request/session/title]/author"/>

<html:text xpath="people[/request/index]/firstName"/>

The contexts I've assumed for those elements are purely arbitrary of
course! Through permitting XPath-based lookup of bean property values, it
might also be nice to be able to explicitly state which scope the bean is
contained within, to deal with the inevitable name-clashes. Simply relying
on the standard 'scope' attribute might also be the simplest solution.

Have you also considered the power of employing XPath expressions in
Struts...

<html:text xpath="concat(people[$index]/firstName, people
[$index]/secondName)"/>

Also, what about using XPath to populate the values of form fields. It
might still be necessary to include a bean property name that is used to
populate the bean when the form is posted (especially if the value of the
form field is populated from an XPath function, rather than a simple
expression).

What if the XPath returns a nodeset? What will the default behaviour be...
to print each value in the nodeset separated by a comma, dash, non-breaking
space, <BR> tag?

Regards,
James W.

Reply via email to