0
servlet代码看起来像下面表单提交的Servlet AEM
@SlingServlet(
methods = {"POST"},
resourceTypes = {"cq:Page"},
extensions = {"html"})
public class AssetDownloadServlet extends SlingAllMethodsServlet {
private static final Logger log = LoggerFactory.getLogger(AssetDownloadServlet.class);
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException
{
log.info("%%%%%%%%%%%%%%$$$$$$$$$$$%%%%%%%**************: "+ "doPost");
processRequest(request,response);
}
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException
{
log.info("%%%%%%%%%%%%%%$$$$$$$$$$$%%%%%%%**************: "+ "doGet");
processRequest(request,response);
}
private void processRequest(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException{
log.info("%%%%%%%%%%%%%%$$$$$$$$$$$%%%%%%%*******************");
log.info(request.getParameter("format"));
log.info("%%%%%%%%%%%%%%$$$$$$$$$$$%%%%%%%*******************");
}
}
在HTML页面的形式看起来像下面
<form method="POST">
<fieldset>
<p>Format needed?</p>
<ul style="list-style-type:none" data-sly-list.rendition="${renditions}">
<!--${rendition.path}-->
<li>
<label>
<input type="radio" name="format" value="${rendition.name}" />
<span>${rendition.displayName}</span>
</label>
</li>
</ul>
</fieldset>
<fieldset>
<button type="submit">Start Download</button>
<a>Cancel Download</a>
</fieldset>
</form>
CQ详细信息页面
上<!--cq{"decorated":false,"type":"myProject/components/page/generic","path":"/content/myProject/en/assetdetail/jcr:content","selectors":"IRNHUF7D","servlet":"Script /libs/foundation/components/page/page.jsp","totalTime":28,"selfTime":8}-->
摘要:
我有一个cq:页面资源,有一个表单和servlet链接到它。但是在提交表单时,servlet并未下注。我看到在http://localhost:4502/system/console/中正确设置了属性。
请建议..
感谢
我尝试了你的建议
jcr:content
被写入。但问题依然存在。我在日志中也看不到任何更改。 – phemanthkumar28我的不好,我修改了上面我的回复中的网址,其 /_jcr_content.html而不是 ._jcr_content.html –
我甚至试过这个,它不太好。我在上面的代码片段中添加了我在页面上收到的CQ信息。 – phemanthkumar28