JSP Error: Only a type can be imported. package.cl

2019-09-01 10:16发布

问题:

my project is develop website using JSP. In this project, the JSP file will call a function from my java file.

Here is how I import my java file:

<%@ page import="java.sql.*,java.util.*,de.fraport.mobileformular.CreateEngine,org.activiti.engine.*,org.activiti.engine.runtime.*"%>

Then, here is how I call my method:

<%
    //deploy process from activiti
    CreateEngine ce = new CreateEngine();
%>

But, I don't know why, when I load above page, it will generate following error:

FYI: this web application running on Tomcat 7 and connected to Activiti Workflow Engine.

Thanks for your help.

Edited:

Here is the deployed class:

package de.fraport.mobileformular;

import org.activiti.engine.*;
import org.activiti.engine.runtime.*;

public class CreateEngine {

    //set global variable
    ProcessEngine processEngine;
    RepositoryService repositoryService;
    RuntimeService  runtimeService;
    ProcessInstance processInstance;

    //method for deploying and start process
    public void deployProcess()
    {
        processEngine = ProcessEngines.getDefaultProcessEngine();
        repositoryService = processEngine.getRepositoryService();

        repositoryService.createDeployment()
          .addClasspathResource("accidentForm.bpmn20.xml")
          .deploy();

        runtimeService = processEngine.getRuntimeService();
        processInstance = runtimeService.startProcessInstanceByKey("accidentForm");;
    }
}

回答1:

Problem Solved by change the type of the project from Java Project into Dynamic Web Project. Thanks