|
Home > Archive > WebSphere HATS > July 2006 > Calling Business Logic
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Calling Business Logic
|
|
|
| Using hats 6.0 I am trying to call business logic to clear some global vars.
It works fine when I call it it from an event but I was wondering if it is
possible to call it with JSP? When I try to call it in JSP, it expects
blInfo but I can't seem to get it right. I've also tried to call it within a
macro but I couldn't get that to work either. Help on either would be
greatly appreciated.
Thanks
Ben
public class ListGlobalVars
{
/**
* Method that executes business logic on a session
* This is invoked by the runtime when an Execute Action is requested
* in the Screen Customization Event
* @param blInfo - Contains useful information about the current
application
*/
public static void execute(BusinessLogicInfo blInfo)
{
// TEST reading Globals
IGlobalVariable local_global_variable =
getGlobalVariable(blInfo,"AcctNum");
if( null != local_global_variable) {
//Retrieve the local Global Variable listing in Hashtable form.
Hashtable localGlobalVariables = blInfo.getGlobalVariables();
System.out.println ("size: " + localGlobalVariables.size());
//System.out.println (localGlobalVariables.toString());
for (Enumeration e = localGlobalVariables.elements() ;
e.hasMoreElements() ;) {
System.out.println(e.nextElement());
}
}
}
/**
* Example method that sets a named global variable from the
current session to a value
* @param blInfo - BusinessLogicInfo from current session
* @param name - Name of the global variable
* @param value - Value of the global variable
*/
public static void setGlobalVariable(BusinessLogicInfo
blInfo,String name,Object value)
{
IGlobalVariable gv = blInfo.getGlobalVariable(name);
if ( gv == null )
....
....
....
....
| |
|
| You need to use TransformInfo to work with global variables in a
transformation jsp- eg:
IGlobalVariable column1 =
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get
GlobalVariable("Column1", true);
Thanks,
Alisa
"Ben" <hatsnewsgroup99@kurva.org> wrote in message
news:dlhmj7$3vb6$1@news.boulder.ibm.com...
> Using hats 6.0 I am trying to call business logic to clear some global
vars.
> It works fine when I call it it from an event but I was wondering if it is
> possible to call it with JSP? When I try to call it in JSP, it expects
> blInfo but I can't seem to get it right. I've also tried to call it within
a
> macro but I couldn't get that to work either. Help on either would be
> greatly appreciated.
>
> Thanks
> Ben
>
>
> public class ListGlobalVars
> {
>
> /**
> * Method that executes business logic on a session
> * This is invoked by the runtime when an Execute Action is requested
> * in the Screen Customization Event
> * @param blInfo - Contains useful information about the current
> application
> */
> public static void execute(BusinessLogicInfo blInfo)
> {
> // TEST reading Globals
> IGlobalVariable local_global_variable =
> getGlobalVariable(blInfo,"AcctNum");
> if( null != local_global_variable) {
> //Retrieve the local Global Variable listing in Hashtable form.
> Hashtable localGlobalVariables = blInfo.getGlobalVariables();
> System.out.println ("size: " + localGlobalVariables.size());
> //System.out.println (localGlobalVariables.toString());
> for (Enumeration e = localGlobalVariables.elements() ;
> e.hasMoreElements() ;) {
> System.out.println(e.nextElement());
> }
> }
> }
>
> /**
> * Example method that sets a named global variable from the
> current session to a value
> * @param blInfo - BusinessLogicInfo from current session
> * @param name - Name of the global variable
> * @param value - Value of the global variable
> */
> public static void setGlobalVariable(BusinessLogicInfo
> blInfo,String name,Object value)
> {
> IGlobalVariable gv = blInfo.getGlobalVariable(name);
> if ( gv == null )
> ...
> ...
> ...
> ...
>
>
>
| |
| Marta L 2005-12-05, 7:45 am |
| Hi all,
I have the same issue that Ben asked about. How to obtain an existing global
variable is clear, even you can do it with the wizard, but the matter is how
to update or create a global variable inside the jsp (with setVariableGlobal
I suppose). We would be interested in knowing how to code this.
Thanks
"Alisa" <alisa@us.ibm.com> escribió en el mensaje
news:dmqca0$2812$1@news.boulder.ibm.com...
> You need to use TransformInfo to work with global variables in a
> transformation jsp- eg:
>
> IGlobalVariable column1 =
>
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get
> GlobalVariable("Column1", true);
>
> Thanks,
> Alisa
>
> "Ben" <hatsnewsgroup99@kurva.org> wrote in message
> news:dlhmj7$3vb6$1@news.boulder.ibm.com...
> vars.
is[vbcol=seagreen]
within[vbcol=seagreen]
> a
>
>
| |
|
| Thank Wei Guo for this one: (We are using Hats 6.0)
<%@ page import="com.ibm.hats.common.*, com.ibm.hats.util.*" %>
<%
//clear serviceList
IGlobalVariable gv =
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).getGlobalVariable("serviceList",true);
gv.clear();
// You can set it with this
gv.set("some new value");
%>
Ben
"Marta L" <mlorenzo@opennorte.com> wrote in message
news:dn1a2o$8ok4$1@news.boulder.ibm.com...
> Hi all,
> I have the same issue that Ben asked about. How to obtain an existing
> global
> variable is clear, even you can do it with the wizard, but the matter is
> how
> to update or create a global variable inside the jsp (with
> setVariableGlobal
> I suppose). We would be interested in knowing how to code this.
>
> Thanks
>
>
>
> "Alisa" <alisa@us.ibm.com> escribió en el mensaje
> news:dmqca0$2812$1@news.boulder.ibm.com...
> ((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get
> is
> within
>
>
| |
| Marta L 2005-12-07, 7:50 am |
| Thanks both, it works.
"Ben C" <hatsnewsgroup99@KURVA.ORG> escribió en el mensaje
news:dn5i9s$800g$1@news.boulder.ibm.com...
> Thank Wei Guo for this one: (We are using Hats 6.0)
>
>
> <%@ page import="com.ibm.hats.common.*, com.ibm.hats.util.*" %>
>
> <%
> //clear serviceList
> IGlobalVariable gv =
>
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get
GlobalVariable("serviceList",true);
> gv.clear();
> // You can set it with this
> gv.set("some new value");
> %>
>
>
>
> Ben
> "Marta L" <mlorenzo@opennorte.com> wrote in message
> news:dn1a2o$8ok4$1@news.boulder.ibm.com...
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get[vbcol=seagreen]
global[vbcol=seagreen]
it[vbcol=seagreen]
expects[vbcol=seagreen]
>
>
| |
| pkum9999 2006-07-26, 11:05 am |
| quote: Originally posted by Marta L
Thanks both, it works.
"Ben C" <hatsnewsgroup99@KURVA.ORG> escribió en el mensaje
news:dn5i9s$800g$1@news.boulder.ibm.com...
> Thank Wei Guo for this one: (We are using Hats 6.0)
>
>
> <%@ page import="com.ibm.hats.common.*, com.ibm.hats.util.*" %>
>
> <%
> //clear serviceList
> IGlobalVariable gv =
>
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get
GlobalVariable("serviceList",true);
> gv.clear();
> // You can set it with this
> gv.set("some new value");
> %>
>
>
>
> Ben
> "Marta L" <mlorenzo@opennorte.com> wrote in message
> news:dn1a2o$8ok4$1@news.boulder.ibm.com...
((TransformInfo)request.getAttribute(CommonConstants.REQ_TRANSFORMINFO)).get[vbcol=seagreen]
global[vbcol=seagreen]
it[vbcol=seagreen]
expects[vbcol=seagreen]
>
>
I am trying to add some logic in my index.jsp to set a global variable . I tried using the above logic but as the global variable doesn't exist , I keep getting null exception. Can you please clarify how to first create and set a global variable in the business logic.
thanks
PK |
|
|
|
|