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