ulib621

How do I output contents of a List<Course> variable using bbNG tags?

Discussion created by ulib621 on Feb 3, 2017
Latest reply on Mar 7, 2017 by ulib621

Hi,

We are currently running Q2 2016 & I'm trying create a very simple course search in a B2. The user enters some part of a course name & this is used to generate a List<Course> variable (sResults) holding the results.

My question is, how do I output the contents of sResults using the bbNG tags?

 

 

My code snippet is below.  moduleName is passed as the user search input >>

 

<%

String moduleName = request.getParameter("modulename").trim();

 

try {  

//CREATE DB LOADER

CourseDbLoader cLoader = CourseDbLoader.Default.getInstance();

 

//CREATE VARIABLES FOR MY CourseSearch OBJECT

CourseSearch.SearchKey key = CourseSearch.SearchKey.CourseId;

SearchOperator op = SearchOperator.Like;

SearchOperator dateOp = SearchOperator.LessThan;

java.util.Date createDate = Calendar.getInstance().getTime();

Course.ServiceLevel serviceLevel = Course.ServiceLevel.DEFAULT;

 

//CREATE CourseSearch OBJECT

CourseSearch search = SearchHelper.getViewCoursesSearch(key,op,moduleName,dateOp,createDate,serviceLevel);

 

//USE CourseSearch OBJECT to BUILD COURSE LIST

List<Course> sResults = cLoader.loadByCourseSearch(search);

} catch (Exception e) {

            out.println("Error1 : <br />" + e + "<br />");

        }

 

 

 

I understand I'll have to iterate through sResults somehow & pull out the values I want (eg courseTitle, courseId), but it's how to then output the values using the usual set of bb tags?

 

If I can get my pulled values into an array somehow, I may be able  use <bbNG:inventoryList> & <bbNG:listElement> tags??

 

 

 

Sorry for the newbie question.

Thanks!

Outcomes