Often times on JSP pages within our ALBPM projects we want to display a select list with a list of values loaded from a database. Hopefully this quick tutorial will get you started in the right direction.
Prerequisites
BEA AquaLogic BPM Studio 6.0.4 (Will also work on previous versions)
Create instance variable for the array
Load array from database
Create an "Automatic" component on your screenflow and add code similar to the following in order to load the array defined above.
params[0] = "STATES" //local var defined as String[]
for each row in executeQuery(DynamicSQL, sentence : "select text,value from lookups where lookup_name = ?",
implname : "YOUR DB", inParameters : params) do
statesList[String(row["text"])] = String(row["value"])
end
// You could also use "inParameters : ["STATES]" and save yourself from defining the params local variable.
Pass array into JSP
Place an "Interactive Component Call" on your screenflow. Double-click on your component so the "Main Task" editor appears. Select "BPM Object Interactive Call" and select your object variable and JSP. You must then select "Argument Mapping" in order to pass your array into the JSP.
Create the select on the JSP page
Here is some example code I use in my JSP to display the data from the array in the select box:
Next Steps
Hopefully this quick tutorial will help you accomplish what you need. I did leave out some details as I'm assuing you have at least a little ALBPM experience. If you need more info or have any problems please let me know.
Subscribe to:
Post Comments (Atom)
1 comment:
hi Steve,
Your blog is the first help in resolving an issue that has bugged me for weeks.
Do you have a tutorial or blog type example of using a JSP as a presentation.
Thanks
Folarin
Post a Comment