Re: Access to BTemplate on request phase ?
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, > is there a way I can have access to the BTemplate tokens while processing > the request event ? Yes and no - sure, you can always process the dom, and then get the directives. But no, its not directly supported. > The idea is to have a list of the requested fields from the "client" to > taylor the requested data object from the server tier (using the generic > attribute access pattern and hibernate). The deal is to have a naming > convention accross all the application's tiers. > > So... is this simply stupid, or is there a way to achieve this using > Barracuda ? Weeeelllll - I don't know much about your app, and not much about hibernate eihter. But let me guess - the generic attribute access pattern boils down to a (hash)map? Thats what such things usually are. So for now, I assume that. Thus in answer to you question - what help is it to accss the directives? If you have e.g. 10 properties with distinct names, you'll need a html snipplet that includes at least (ten directives) * (# of values you wan't to fill in, e.g. name and value). Now this looks stupid (at least to me!), I have to confess. Because you end up modifying doms before passing them to barracuda to let it modify the dom, too. One time of dom modification too much, for my taste. My approach would be a iterative model - every entry in the list of values iterated over is a name/value-pair. And the list is created by parsing the request-parameters and then queriying the objects. Thus you don't need to alter any directives and would still have full flexibility on this. BTW: You know that you will end up in trouble with order of the attributes? Or is that somehow supplied (can't think of a way right now, but alas as mentioned before, I don't know much about your app. But maps don't have an implicit order). Did this help? Feel free to ask further questions or fill me in with more details so I get a better grip of what you are planning. Regards, Diez