Using Sitemesh to build a composite view-3. Other discussions
Using Sitemesh to build a composite view-1.hello
Use Sitemesh to build a composite view-2. adorners
Use Sitemesh to build a composite view-3. Other discussion <-now
The previous article is enough to apply Sitemesh to improve your application, but I find that there are other things that might help.
Printable interface Decoration previously said there are 1 types of printable adorners that allow you to use the other adorners (specified by yourself) when you access them in http://localhost/aaa/a.html?printable=true mode, giving the original page for printing ( Lest the fancy pictures of Header,footer etc be hooked up too.
Let's take a look at how to achieve him:
1. First set in Web-info/sitemesh.xml: <mapper class= " Com.opensymphony.module.sitemesh.mapper.PrintableDecoratorMapper "> <param name=" decorator "value=" printable "/> <param name=" parameter.name "value=" printable "/> <param name=" Parameter.value "value=" true "/> </mapper> This allows you to use the adorner named printable instead of the original adorner by using the printable=true.
2. Define the corresponding printable adorner in web-info/decorators.xml <decorator name= "printable" page= "printable.jsp"/>
3. Finally, the preparation of printable adorner/decorators/printable.jsp
<%@ taglib uri= "Sitemesh-decorator" prefix= "decorator"%>This allows an original page to be switched to a different adorner page through the printable=true switch.
Chinese problem because the default character set used in Sitemesh is iso-8859-1, the direct use will produce garbled, we can correct it by: Method 1: You can find it in the configuration file of application server that you use. There are no items to set encoding or CharSet, then set to GBK or Gb2312 Method 2: This is also the method we have been using. 1. In each JSP page set: <%@ page contenttype= "text/html;" CHARSET=GBK "%> to tell the server the character set you requested. 2. Defined in the head of each JSP page: <meta http-equiv= "Content-type" content= "text/html"; CHARSET=GBK "> To tell the browser the character set you are using. Summary: The most common way to use Sitemesh:
1. Configure the environment,
2. Describe the wrapper you will build in the Web-info/decroators.xml.
3. Develop the packaging described in the decroators.xml, preferably stored in the/_decorators directory
4.ok, you can look at the results of hard work:)
Resources:
To download the example of my ant build I provided under j2sdk-1_4_0,tomcat4.0.3 and TOMCAT5, please run/build.bat first to generate/dist/web.war file and then implement it to your server. Opensymphony team Project collection: Http://sourceforge.net/projects/opensymphony wiki:http://wiki.opensymphony.com/ Download the latest version of CVS from the SF CVS
About the Author:
Timmy, Xi ' an Dong soft company. As an avid programmer, I hope to grow and improve every day and hope to share our happiness and knowledge with you. Please contact him in the following ways: email chen56@msn.com
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.