java - Liferay 不捕获 portlet 中的表单,也不进行处理

标签 java netbeans glassfish liferay portlet

我在liferay中有.jsp,并在applet中使用javascript,但是在将表单发送到portlet之后,在服务器端,portlet不会捕获该表单,并且不会在日志中显示附加消息。

jsp页面的片段:

<script type="text/javascript">
    function processSigning(){
        var applet = document.applets["SignApplet"];
        var path_to_certificate = document.getElementById("certificate").value;
        var pass = document.getElementById("password").value;
        var filePath = document.getElementById("documentSign").value;
        applet.filePath = document.getElementById("documentSign").value;
        applet.profileTestPKCS12(path_to_certificate, pass);

        document.getElementById("file").value = applet.getDocumentString(filePath);
        document.getElementById("sign").value = applet.getSignString();
        document.getElementById("cert").value = applet.getCertificateString();
        document.getElementById("mainForm").submit();


    }
</script>

<form id="mainForm" action="<portlet:actionURL>
          <portlet:param name="COMMAND" value="LOAD"/>
      </portlet:actionURL>">

    <hidden id="file" value="asdf"></hidden>
    <hidden id="cert" value="asdf"></hidden>
    <hidden id="sign" value="asdf"></hidden>
    <input type="button" onClick="processSigning();" value="click here!" >
</form>

portlet 片段:

public void processAction(ActionRequest request, ActionResponse response) throws PortletException {
    session = request.getPortletSession(true);
    String command = request.getParameter("COMMAND");
    System.out.println("command=" + command);
    log.info("command=" + command);


if ("LOAD".equals(command)) {

{
System.out.println("file");
log.info("file");
String fileBase64 = request.getParameter("file");
System.out.println(request.getParameter("file"));
log.info(request.getParameter("file"));
}
}
}

最佳答案

检查您的 portlet.xml 中的 portlet 类是否指向 MVCPortlet 或您的自定义 portlet 类。它应该指向自定义 portlet 类。

关于java - Liferay 不捕获 portlet 中的表单,也不进行处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10407861/

相关文章:

java - 文档监听器带来空指针异常

java - 在 Timeline 对象的构造函数中使用 lambda 表达式会导致错误

java - 哪个 JAR 包含 weblogic.servlet.security.ServletAuthentication 类?

java - (Java) Heapsort - 实现不排序半元素?

java - 引用构造函数而不重置参数值?

java - Heroku 找不到 groovy 依赖项

java - Netbeans 中的数据库和 Java

java - 关于企业 Java session Bean

java - 调用servlet时未找到404

javax.xml.ws.WebServiceException : class do not have a property of the name return when returning HashMap in web service