在Java Web开发中,Action映射通常指的是在Servlet容器(如Tomcat)中配置URL与Action类方法的映射。以下是在不同环境中配置Action映射的方法:
1. 使用Servlet 3.0的注解方式
如果使用Servlet 3.0或更高版本,可以使用注解来配置映射。
```java
@WebServlet(urlPatterns = "/example")
public class ExampleServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// 处理请求