Hi,
just found the session-vars in Xapp 3.13 which help a lot
One thing I still can’t do with them is checking for existance in a scriptlet.
I tried to use “<% if (sessioncontext.getVariablesHandler().getVariable(“meineQuery”) != null) … %>” like it’s done in the getVar-Tag but that doesn’t work.
If I cannot do this, maybe I can set and get a session-variable completely with scriptlets, without setvar/getvar?
Thank you,
Ralf.
Hello,
perhaps, the method ‘getVariableValue’ of the class VariablesHandler is the method you are looking for.
The method you used evaluates the variable while the getVariableValue returns the mapped string only.
For more detail, have a look at the Java Docs of X-Application. I hope, this helps you.
Bye,
Christian.
Hello,
this topic will be moved to the Assistance Forum in the next days.
The assistance forum is intended to be used for technical questions and answers.
Thank you for your understanding.
Regards,
Christian.
when I was born, algol 60 was still in fashion, so pls. have some patience with me …
When I refer to "sessionContext. "… (as it’s done in the getvar tag ) in a scriptlet, I get an exception (sessionContext not known). That’s probably boring for all of you Java-Masters, but not for me …
<bdm:setvar name = “meineQuery” scope = “session”>
1234567
</bdm:setvar>
now, what’s wrong here?
<% if (sessionContext.getVariablesHandler().getVariableValue(“meineQuery”) != null) … %>
Can you pls help once more?
Ralf.
Hello,
when adding Scriptlet code to your page you have to import the classes you want to use and to declare your variables:
<BR><%@ page language="java" contentType="text/html; charset=UTF-8" <BR> <B>import="com.softwareag.xtools.xapplication.jsp.ServletSessionContext, <BR> com.softwareag.xtools.xapplication.jsp.SessionContext"</B><BR>%><BR></pre><BR><BR>After the import you must declare and initialize the variable ?sessionConext? before using it.<BR><BR><pre class="ip-ubbcode-code-pre"><BR><% SessionContext sessionContext = ServletSessionContext.getSessionContext(pageContext); <BR> if (sessionContext.getVariablesHandler().getVariableValue("meineQuery") != null)<BR> ...<BR>%><BR>
Bye,
Christian.
for helping again. Everything works as it should.
Ralf.