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