Java 无法编译JSP类(易趣交易API示例-登录重定向)

Java 无法编译JSP类(易趣交易API示例-登录重定向),java,jsp,web-applications,tomcat7,ebay-api,Java,Jsp,Web Applications,Tomcat7,Ebay Api,我正在尝试使用SDK附带的eBay示例应用程序(签名重定向) 我已将应用程序复制到webapps目录,并进行了相应的更改以使其运行 现在我得到了这个错误 org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 16 in the generated java file Only a type can be imported. signinredirect.Gl

我正在尝试使用SDK附带的eBay示例应用程序(签名重定向)

我已将应用程序复制到webapps目录,并进行了相应的更改以使其运行

现在我得到了这个错误

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

An error occurred at line: 16 in the generated java file
Only a type can be imported. signinredirect.Global resolves to a package

An error occurred at line: 18 in the jsp file: /credentials.jsp
Global cannot be resolved
15:   String signInURL = ""; 
16:   String ApiServerUrl = "";
17:   String reqError ="";
18:   String devId = Global.getProperty("devId");
19:   String certId = Global.getProperty("certId");
20:   String appId = Global.getProperty("appId");
21:   //runame of this sample application
jsp代码:

<html>
<head>
<title>
eBay signin redirection sample with new token fetch flow
</title>
</head>
<body bgcolor="#ffffff">
<%@ page import="com.ebay.sdk.*" %>
<%@ page import="com.ebay.sdk.call.*" %>
<%@ page import="signinredirect.Global" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page errorPage="errorPage.jsp" %>

<%
  String signInURL = ""; 
  String ApiServerUrl = "";
  String reqError ="";
  String devId = Global.getProperty("devId");
  String certId = Global.getProperty("certId");
  String appId = Global.getProperty("appId");
  //runame of this sample application
  String runame = Global.getProperty("runame");

  if (request.getParameter("goToSignin") != null ) {
        reqError="";

        int environment = Integer.parseInt(request.getParameter("EnvList"));
        if (environment == 1 ) {
            // Sandbox
            signInURL =Global.getProperty("sandboxSignInUrl");
            ApiServerUrl = Global.getProperty("sandboxAPIUrl");

        } else if (environment ==2) {
            // Production
            signInURL = Global.getProperty("ebaySignInUrl");
            ApiServerUrl = Global.getProperty("ebayAPIUrl");

        }

        //Get the Credentials Information 
        devId = request.getParameter("DevID");
        if(devId.length() == 0 )
         throw new SdkException("Please enter developer ID.");
        appId  = request.getParameter("AppID");
        if( appId.length() == 0 ) 
         throw new SdkException("Please enter application ID.");
        certId = request.getParameter("CertID");
        if( certId.length() == 0 ) 
         throw new SdkException("Please enter certificate ID.");
        //Get the runame
        runame = request.getParameter("RuName");
        if(runame.length() == 0)
         throw new SdkException("Please enter runame of the sample application");


        ApiContext apiContext = Global.createApiContext(devId, appId, certId, ApiServerUrl );
        ApiLogging apiLogging = new ApiLogging();
        apiContext.setApiLogging(apiLogging);
        session.setAttribute("apicontext", apiContext );

        GetSessionIDCall api = new GetSessionIDCall(apiContext);
        api.setRuName(runame);

        String ruParams="params="+runame +"-"+(environment==1?"Sandbox":"Production");

        try {

             String sessionID = api.getSessionID();
             String encodedSesssionIDString =URLEncoder.encode(sessionID,"UTF-8");           

             session.setAttribute("sessionID", sessionID);           
             response.sendRedirect(response.encodeRedirectURL(signInURL + "&RuName=" + runame + "&SessID=" + encodedSesssionIDString + "&ruparams=" + ruParams));     

        } catch(SdkHTTPException ex) {
            reqError = "Call failed: " + ex.getMessage();
        } catch(Exception ex) {
            reqError = ex.getMessage();
        } 
}
%>

具有新令牌获取流的易趣登录重定向示例

存在Java类Global。看起来导入失败了。有人能告诉我我做错了什么吗?

这意味着直接。全局是一个包,而不是一个类。试试这个:

<%@ page import="signinredirect.Global.*" %>

这意味着SignInDirect.Global是一个包,而不是一个类。试试这个:

<%@ page import="signinredirect.Global.*" %>


我必须创建一个新的web应用程序项目,而不是从sdk复制示例应用程序

我必须创建一个新的web应用程序项目,而不是从sdk复制示例应用程序

Global是包signirect中的一个类。当我添加*,我得到了错误。(全局无法在asp页面本身中解析)我甚至尝试过,即使它说全局无法解析(在运行时)全局是包SignInRedect中的一个类。当我添加*,我得到了错误。(全局无法在asp页面本身中解析)我甚至尝试过,即使它说全局无法解析(在运行时)。使用Scriptlet的整个想法是错误的,使得调试几乎不可能。为什么不把Java代码重新分解成一个模型类呢。这是我从一个ebay SDK下载的示例应用程序。不管怎么说,我现在明白了。你是对的。使用Scriptlet的整个想法是错误的,这使得调试几乎不可能。为什么不把Java代码重新分解成一个模型类呢。这是我从一个ebay SDK下载的示例应用程序。不管怎么说,我现在明白了。你是对的。