在 alfresco 中从 Web 表单调用 execute 方法

Calling the execute method from the web form in alfresco

我对户外活动很陌生。如何从 Web 表单调用此方法:

@Override
public void execute(final WebScriptRequest req, final WebScriptResponse res) throws IOException {
    try {

        AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Void>() {
            @Override
            public Void doWork() throws Exception {
                searchInvoice(req, res);
                return null;
            }
        }, AuthenticationUtil.getSystemUserName());

    } catch (Exception e) {
        logger.error("Can not verify query result");
        e.printStackTrace();
    }
}

甚至可以在露天实施这种方法吗?来自这个网络表格:

<form action="execute()" enctype="text/plain"  method="get">
    <input type="hidden" name="url" value="http://book.myrest.com/api?sort=TransDate">
    <label>From: <input type="date" name="from" ></label>
    <lable>To:<input type="date" name="to"></lable>
    <input type="submit" name="submit" value="search">
</form>

您可以将您的代码放入 java 支持的网络脚本中,并在您的 <form ..>

中将其 url 设为 action

请参考此 to create java backed webscript