Page 1 of 1

HC compile class error in 8.1.1

PostPosted: Tue Feb 28, 2017 5:19 am
by david
What's the HC boilerplate for Servoy 8+? Boilerplate from Servoy 6 is throwing errors:

Code: Select all
<%@ page import = "java.util.*" %>
<%@ page import = "com.servoy.j2db.server.headlessclient.*" %>
<%@ page import = "com.servoy.j2db.util.*" %>

<%
   // grab params
   String solution = request.getParameter("s");
   String form    = "blank";
   String method    = request.getParameter("m");
   Object[] args    = new Object[]{session, request};

   // start servoy headless client
   ISessionBean servoy_hc = (ISessionBean)application.getAttribute("servoy");
   if (servoy_hc == null || !servoy_hc.setMainForm(form)) {
      servoy_hc = HeadlessClientFactory.createSessionBean(request, solution);
      application.setAttribute("servoy_cms",servoy_hc);
   }

   // set form
   boolean ok = servoy_hc.setMainForm(form);
   if (!ok) {
      out.print("Error cannot work on required form");
      return;
   }

   // call servoy method
   String results = (String)servoy_hc.executeMethod(null, method, args);

   // print out results
   out.print(results);
   
%>


Errors:

Code: Select all
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 13 in the jsp file: /endpoint_example2.jsp
ISessionBean cannot be resolved to a type
10:    Object[] args    = new Object[]{session, request};
11:
12:    // start servoy headless client
13:    ISessionBean servoy_hc = (ISessionBean)application.getAttribute("servoy");
14:    if (servoy_hc == null || !servoy_hc.setMainForm(form)) {
15:       servoy_hc = HeadlessClientFactory.createSessionBean(request, solution);
16:       application.setAttribute("servoy_cms",servoy_hc);


An error occurred at line: 13 in the jsp file: /endpoint_example2.jsp
ISessionBean cannot be resolved to a type
10:    Object[] args    = new Object[]{session, request};
11:
12:    // start servoy headless client
13:    ISessionBean servoy_hc = (ISessionBean)application.getAttribute("servoy");
14:    if (servoy_hc == null || !servoy_hc.setMainForm(form)) {
15:       servoy_hc = HeadlessClientFactory.createSessionBean(request, solution);
16:       application.setAttribute("servoy_cms",servoy_hc);


An error occurred at line: 15 in the jsp file: /endpoint_example2.jsp
HeadlessClientFactory cannot be resolved
12:    // start servoy headless client
13:    ISessionBean servoy_hc = (ISessionBean)application.getAttribute("servoy");
14:    if (servoy_hc == null || !servoy_hc.setMainForm(form)) {
15:       servoy_hc = HeadlessClientFactory.createSessionBean(request, solution);
16:       application.setAttribute("servoy_cms",servoy_hc);
17:    }
18: