@SlingServlet(

resourceTypes = "geometrixx/components/homepage",

selectors = "data",

extensions = "html",

methods = {"GET", "POST"},

metatype =true)

public class SimpleServlet extends SlingSafeMethodsServlet {

...

}

要注意的是, 提交POST 请求的时候,  一定要在URL里面添加_jcr_content, 比如:

http://localhost:4502/content/geometrixx/en/_jcr_content.data.html ,否则servlet不会捕获POST请求

详细参考 http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/#sling_servlet_using_selector

Write Sling Servlet using a resource type and selector的更多相关文章

  1. Ambari源代码分析之Resource.Type与ResourceProvider相应关系

    前面提到.每一种Resource都相应一个ResourceProvider,以下给出其相应关系: Resource.Type ResourceProvider Workflow WorkflowRes ...

  2. VS2010编译以前版本工程时 ERROR CVT1100:duplicate resource,type:MANIFEST解决办法

    1.将 Resource Files 里面的 *.exe.manifest 文件删除 2.右键选择 *.rc 文件,选择 view code,查找并删除所有引用 *.exe.manifest 文件的代 ...

  3. system.stat[resource,<type>]

    系统信息. 整型或者浮点型 ent - 该分区有权接收的处理器单元数(float) kthr, - 关于内核线程状态的信息: r - 平均可运行内核线程数(float) b - 虚拟内存管理器等待队列 ...

  4. PWC6199:Generated servlet error:Only a type can be imported. org.apache.jasper.tagplugins.jstl.core.ForEach resolves to a package

    <%@ import="org.apache.jasper.tagplugins.jstl.core.ForEach"%> 去掉这条语句,就不报错了.所以问题就出在这里 ...

  5. Servlet追忆篇:那些年一起学习的Servlet

    title: servlet notebook: javaWEB tags:servlet --- Servlet是什么? Servlet是JavaWeb的三大组件之一. 作用类似银行前台接待: 接收 ...

  6. 《JavaWeb从入门到改行》那些年一起学习的Servlet

    目录 获取ServletContext : ServletContext接口中的一些方法 application域存取数据功能 代码演示: application域获取项目文件路径 代码演示: API ...

  7. 深圳宝安图书馆官网错误 HTTP Status 500 - Servlet.init() for servlet spring threw exception

    停留了一段时间没有动 打开https://www.balib.cn/balib/category/152 *********************************************** ...

  8. Spring5:@Autowired注解、@Resource注解和@Service注解

    什么是注解 传统的Spring做法是使用.xml文件来对bean进行注入或者是配置aop.事物,这么做有两个缺点: 1.如果所有的内容都配置在.xml文件中,那么.xml文件将会十分庞大:如果按需求分 ...

  9. Servlet入门笔记

    一.一个简单的Servlet 在servlet 3.0之前,下面是基本步骤: 1.新建一个class名为FirstServlet,让它继承javax.servlet.http.HttpServlet: ...

随机推荐

  1. jquery判断字符长度 数字英文算1字符 汉字算2字符

    <input type="text" maxlength="25" oninput="textlength(this)"> &l ...

  2. 第一次安装myeclipse+tomcat经验

    在网上找了很多资料,这里记录一下验证有用的资料,避免以后走弯路 1.安装myeclipse 参考如下URL,亲测有用 https://blog.csdn.net/qingjianduoyun/arti ...

  3. Mac下安装SecureCRT并激活

    今天花了好长的时间终于把SecureCRT安装成功了 现在分享给大家 安装的步骤, 希望对大家用帮助 Mac下的SecureCRT需要破解才能使用 所以有些费劲的.. 先下载SecureCRT和破解文 ...

  4. 递归算法+sql三种分页

    using Maticsoft.Common; using System; using System.Collections.Generic; using System.Data; using Sys ...

  5. 浏览器对象模型BOM总结

    BOMwindows对象document对象location对象screen对象 Windows对象 1.窗口操作 移动指定的距离:window.moveBy(10,20); //向右移动10像素,向 ...

  6. Tensorflow object detection API 搭建属于自己的物体识别模型

    一.下载Tensorflow object detection API工程源码 网址:https://github.com/tensorflow/models,可通过Git下载,打开Git Bash, ...

  7. Flask实战-留言板-使用Faker生成虚拟数据

    使用Faker生成虚拟数据 创建虚拟数据是编写Web程序时的常见需求.在简单的场景下,我们可以手动创建一些虚拟数据,但更方便的选择是使用第三方库实现.流行的python虚拟数据生成工具有Mimesis ...

  8. Mysql如何进行分组,并且让每一组的结果按照某个字段排序,并且获取每一组的第一个字段

    select * from (select * from table_name order by id desc) h where h.catagory_id in(value1,value2,val ...

  9. CCF CSP 201809-2 买菜

    题目链接:http://118.190.20.162/view.page?gpid=T78 问题描述 小H和小W来到了一条街上,两人分开买菜,他们买菜的过程可以描述为,去店里买一些菜然后去旁边的一个广 ...

  10. String,StringBuilder,tringBuffer

    这三个类之间的区别主要是在两个方面,即运行速度和线程安全这两方面. 运行速度,或者说是执行速度,在这方面运行速度快慢为:StringBuilder > StringBuffer > Str ...