Re: [Webwork-user] Name collision
Brought to you by:
baldree,
rickardoberg
From: Rickard <ri...@jb...> - 2000-12-08 16:29:35
|
(Maurice, gotta send emails to webwork-user, not me personally ;-) "Maurice C . Parker" wrote: > > I think the above allows arbitrary scoping. And it also allow included > > pages to refer to any attribute of any property in parent page (without > > this scoping the child included pages can only refer to attributes in > > the result!). > > > > I think that being able to refer to parent pages is *very* important. I'm glad that this may be coming soon. Just to clarify, you would be referring to the parent action and not the parent view, right? Yes. But you can do this today, as we do it all the time with the generic controls. Of course. But there's no way currently to reference beans from iterator, property, bean or similar tags. > > Any flaws with? Pros/cons? > > Would the id parameter do the upward search the same way that the name parameter does today? If so, we could potentially still have name collisions, this time on the id parameter instead of the name parameter. The "id" attribute is just a way to place a tag value into the page context under a name. E.g.: <webwork:iterator id="foo"> <%=pageContext.getAttribute("foo")%> </webwork> If you use included pages you need to make sure that the parent page doesn't use an id name that is going to be overwritten by the child page. > Since we are dealing hierarchial data maybe taking a look at some of the XML syntaxes isn't such a bad idea. Maybe X-Path or XSLT? These technologies have had to deal with problem already and may have some good ideas. > > The @ syntax is confusing me. Using the hierarchy below: > > Main.action > | > +--name > +--address (iterator) > | | > | +--name > | +--street > | +--city > | > (main.jsp) > | > +--Message.action > | | > | +--name > | +--subject > | +--text > | | > | (message.jsp) > | | > | +--Message.action > | | | > | | +--name > | | +--subject > | | +--text > | | | > | | (message.jsp) > | | | > | +--Message.action > | | | | > . . . . > . . . . > . . . . > > How to I address the name element of the Main.action while using address as an iterator? This example is the same problem as the original control problem. You would use "result@name" for Main.name "address@name" for the address iterator elements (if you use the id="address" attribute on the iterator tag that is), and so on. > Inside the Message.action recursion, is it possible to access the parent actions elements? Yes. The parent is bound to "parent.result" attribute. > Inside of these, would it be possible to specify the name on the first address? Yes, see above. > Pretty harsh (but hopefully not unfair) examples. I don't just don't want to see us get locked into a syntax that can't be flexible as the rest of Webwork has so far proven to be. Same here :-) Let's think about this some more. Test with more tricky examples, etc. But so far it seems ok. regards, Rickard -- Rickard Öberg Email: ri...@jb... |