Hi Joerg,
i found this strange behaviour :
the content of the fragment at /authentication/data/socOM in the context authentication contains the code "8801", and i can see this value if i show on screen with first snippet.
I thought that i could evaluate a variable in the same manner (second snippet) ; but this doesn't happen.
Anyway, looking at the mail archive, i found some interesting examples and i wrote a little function that seems to work ; here is the code :
private synchronized String getParAut(String inContext, String inPath) {
String sRet = null; org.apache.avalon.framework.component.ComponentManager cm = this.manager; org.apache.cocoon.webapps.session.SessionManager sm = null;
//System.out.println("getParAut - cerco **"+inPath+"** in **"+inContext+"**"); try { sm = (org.apache.cocoon.webapps.session.SessionManager)cm.lookup(org.apache.cocoon.webapps.session.SessionManager.ROLE); org.w3c.dom.DocumentFragment df = sm.getContextFragment(inContext, inPath); StringBuffer sb = new StringBuffer(); for (int i=0; i< df.getChildNodes().getLength(); i++) { sb.append(df.getChildNodes().item(i).getNodeValue()); sRet = sb.toString(); } if (sm != null) { cm.release((Component)sm); } } catch (Throwable e) { System.out.println("getParAut - Errore "+e); } finally { cm.release((Component)sm); } return sRet; }
<xsp:logic>String sSoc = getParAut("authentication", "/authentication/data/socOM");</xsp:logic>
<outEasy sizeFont="3" label="Codice Societa':" alignLabel="left"
widthLabel="100" alignCampo="left" widthCampo="100" name="codiceSoc"
size="5">
<xsp:attribute name="value"><xsp:expr>sSoc</xsp:expr></xsp:attribute>
Please let me know what you think about.
As I said I don't know about the internals, only about possible error causes. Now that it works I think it's ok. It would just be interesting to have your solution compared with the session:getxml solution.
I don't know if you know it but the XSP stuff is transformed via XSLT into Java code. Somewhere the resulting Java code must be lying around (e.g. TOMCAT_HOME/work/**). You can compare them if you want to see what's wrong with the standardized solution provided by session:getxml.
Joerg
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
