# FrameworkServlet **Repository Path**: mgang/FrameworkServlet ## Basic Information - **Project Name**: FrameworkServlet - **Description**: 点对点的servlet控制跳转 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2014-12-15 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README #FrameworkServlet ##快速入门 1.导入frameworkServlet.jar包到自己的工程中
2.编写TestServlet类继承FrameworkServlet.
使用servlet3.0的注解配置servlet,在界面上只需要传入action=test1,则调用test1方法来处理请求。 package room.mgang.test; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import room.mgang.web.common.servlet.FrameworkServlet; @WebServlet("/test.mg") public class TestServlet extends FrameworkServlet{ private static final long serialVersionUID = 1L; /** * test1方法 * @param req * @param res * @return 跳转到test1.html */ public String test1(HttpServletRequest req,HttpServletResponse res){ return "test1.html"; } /** * test2方法 * @param req * @param res * @return 跳转到test2.html */ public String test2(HttpServletRequest req,HttpServletResponse res){ return "test2.html"; } } 3.在webContent或者webapp下建立三个html页面,用来跳转。
index.html ---- index页面 测试FrameworkServlet
测试test1方法
测试test2方法 test1.html ---- test1页面 test1界面。 test2.html ---- test2页面 test2界面。 ---- 测试通过 ##about this mipo 王老师交给我们的mvc精简点对点控制跳转自定义框架,特此分享。
qq:1092017732
blog:http://blog.163.com/mg_blog/
gitoschina:http://git.oschina.net/mgang
github:https://github.com/mg0324
演示页:http://mg0324.github.io/FrameworkServlet