JSP Inherits Rapid Library

Source: Internet
Author: User

If the JSP is not developed using inheritance, but instead uses standard instructions or action elements to include, it is too much repeating code.

Rapid-framework is a Google project, you can implement the JSP page inheritance, that is, the writing template page.

But the latest version of Maven is 4.0.5, the latest maintenance time is 2011, do not know whether the person is not much, or the project is over, confused ... So there's no easy way to find out about JSP template inheritance.

This reminds me of JSTL standard tag library, also the latest maintenance time 2011 years. is really not keeping up with the pace of the times, or these libraries have reached the expected function, so no longer maintained. Always confused, my reason for a long time not to maintain the project is not too daring to use, the Internet did not find a good answer (why no longer maintained).

Here's the MAVEN address for rapid: But by adding dependencies in Maven's way, many jar libraries are added automatically.

1 <!--Https://mvnrepository.com/artifact/com.googlecode.rapid-framework/rapid-core -2 <Dependency>3     <groupId>Com.googlecode.rapid-framework</groupId>4     <Artifactid>Rapid-core</Artifactid>5     <version>4.0.5</version>6 </Dependency>

After testing, direct download Rapid-core.jar individual files can be placed under LIB.

How the template page is written:

1 <%@ Page ContentType="Text/html;charset=utf-8"language="Java"pageencoding="UTF-8" %>2 <%@ taglib Prefix="C"URI="Http://java.sun.com/jsp/jstl/core" %>3 <%@ taglib Prefix="FMT"URI="http://java.sun.com/jsp/jstl/fmt" %>4 <%@ taglib Prefix="Rapid"URI="Http://www.rapid-framework.org.cn/rapid" %>5 <!DOCTYPE HTML>6 <HTML>7 <Head>8     <Rapid:blockname= "Head"></Rapid:block>9     <Linkhref=".. /css/common.css "rel= "stylesheet">Ten </Head> One <Body> A   <Div> -       <Rapid:blockname= "Body"></Rapid:block> -   </Div> the   <Div> -       <Rapid:blockname= "Foot"></Rapid:block> -   </Div> - </Body> + </HTML>

How to inherit pages:

1 <%@ Page ContentType="Text/html;charset=utf-8"language="Java"pageencoding="UTF-8" %>2 <%@ taglib Prefix="Rapid"URI="Http://www.rapid-framework.org.cn/rapid" %>3 <Rapid:overridename= "Head">4     <title>Login</title>5 </Rapid:override>6 7 <Rapid:overridename= "Body">8     <P>The value passed by the controller: ${username}</P>9 </Rapid:override>Ten  One <Jsp:includepage=".. /index.jsp "Flush= "true"></Jsp:include>

Note: The Include action element should be placed at the end, not in front, otherwise it will not work properly.

Rapid-core Download

JSP Inherits Rapid Library

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.