On 28.Jul.2003 -- 09:36 AM, Lionel Crine wrote:
> Hi,
>
> I've some trouble with session attribute. Here is what I try :
>
> The sitemap:
> <map:match pattern="addUser">
> <map:generate type="MyGenerator" src="user.xml" />
> <map:transform type=MyTransformerAddUser" />
> <map:select type="session_selector">
> <map:parameter name="attribute-name" value="errorUser" />
> <map:when test="UserAlready">
> <map:transform type="xslt" src="xsl/error_User.xsl">
> <map:parameter name="errorUser"
> value="{session-attr:errorUser}" />
> </map:transform>
> </map:when>
> <map:when test="UserOk">
> <map:transform type="xslt" src="xsl/error_User.xsl">
> <map:parameter name="errorUser"
> value="{session-attr:errorUser}" />
> </map:transform>
> </map:when>
> </map:select>
> <map:serialize type="xml" />
> </map:match>
>
>
>
> In MyTransformerAddUser,I manage the session like this :
>
> public class IXIASOFTTransformerAddUser
> extends AbstractDOMTransformer
> implements Transformer, DOMBuilder.Listener, Composable, Disposable,
> Recyclable {
>
> public void setup(SourceResolver resolver, Map objectModel, String src,
> Parameters par)
> throws ProcessingException, SAXException, IOException {
>
> ...
> this.session = null;
> this.session = this.request.getSession();
> ...
> }
>
> private Document addUser(Document doc) {
> ...
> if (!isUser) {
> ...
> this.session.setAttribute("errorUser", "UserOk");
> ...
> }
> else {
> this.session.setAttribute("errorUser", "UserAlready");
> ...
> }
> ...
> }
>
> In the transformer, all is working fine.
> But from the sitemap, tha session attribute errorUser is one time late.
> For example, if errorUser is UserAlready the first time, I have to go
> throught the transformer twice if I want to set errorUser to UserOk.
>
>
> Any Idea what's going on.
The sitemap is executed *before* any of the sitemap pipeline
components. So, when your transformer sets the attribute, the sitemap
has already tried to read it in order to setup the other transformer.
Only when you do it with an action, the data would be available at
setup time for the transformer. Or your transformers need to
communicate inline through the data stream.
Chris.
--
C h r i s t i a n H a u l
[EMAIL PROTECTED]
fingerprint: 99B0 1D9D 7919 644A 4837 7D73 FEF9 6856 335A 9E08
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]