jWebapp MVC 框架

我要开发同款
匿名用户2008年09月07日
45阅读
开发技术Java
所属分类Web应用开发、Web框架
授权协议BSD

作品详情

jWebApp是一个基于Servlet的MVC框架,目的是为了简化小型web项目的开发复杂度。

示例:

jWebAppisliterallythissimple:

   publicclassHelloWorldextendsRequestHandler{

       publicStringprocessHello(ServerInterfaceserverInterface){

           serverInterface.setAttribute("helloWorld","HelloWorld");

           return"/WEB-INF/helloWorld.jsp";

         }

       publicStringprocessHelloAgain(ServerInterfaceserverInterface){

           serverInterface.setAttribute("helloWorld","HelloWorldAgain");

           return"/WEB-INF/helloWorld.jsp";

         }

     }

 

JustplainHTMLandyourfavoritetemplatemarkup

   <divalign="center">

       <h3>Hello,ThisIsASimple"HelloWorld"Example.</h3>

       <h2>${helloWorld}</h2>

       <p><ahref="${jwaContextPath}/helloWorld/hello">HelloWorld</a>

       <p><ahref="${jwaContextPath}/helloWorld/helloAgain">HelloAgain</a>

   </div>

Thefollowingservletconfigurationisallthatisneeded(outsideourcontrol,it'saservletthing).

   <servlet>

       <servlet-name>jwaRequestServlet</servlet-name>

       <servlet-class>jwebapp.RequestServlet</servlet-class>

   </servlet>

 

   <servlet-mapping>

       <servlet-name>jwaRequestServlet</servlet-name>

       <url-pattern>/helloWorld/hello</url-pattern>

   </servlet-mapping>

 

   <servlet-mapping>

       <servlet-name>jwaRequestServlet</servlet-name>

       <url-pattern>/helloWorld/helloAgain</url-pattern>

   </servlet-mapping>

 

   <welcome-file-list>

       <welcome-file>index.jsp</welcome-file>

   </welcome-file-list>

 

And,callingtheaboveissimple!

   https://host/context/helloWorld/hello

   https://host/context/helloWorld/helloAgain

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论