You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by acec acec <to...@yahoo.ca> on 2009/11/18 20:26:13 UTC

change decorator-template.htm into decorator-template.jsp

I followed Quick Start Guide to test Border Template, everything works.

Then I want to use jsp instead of velocity.

So I changed my BorderPage class:
    public String getTemplate() {
	      //return "decorator-template.htm";
	      return "decorator-template.jsp";
	}

I also create one decorator-template.jsp under web root directory.
--------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Click Quickstart</title>
</head>
<body>
  <div id="header">
    <span class="title">aaaa</span>
  </div>

  <div id="container">
  </div>
</body>
</html>
--------------------------------------------------------------------

When I view that page, I can see the following on screen:
--------------------------------------------------------------------
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
--------------------------------------------------------------------
It seems click still use velocity to render jsp file.

How can I use jsp as a Template?

Thanks.
Tomcat Acec


      __________________________________________________________________
The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/

Re: change decorator-template.htm into decorator-template.jsp

Posted by Bob Schellink <sa...@gmail.com>.
Hi,

You'll also need to switch your Page template extension to ".jsp".

So a template, login.htm, will need to be renamed to login.jsp.

Also, when using a border template, you'll need to forward to the template JSP:

   <jsp:include page='${forward}' flush="true"/>

The Click-examples contains some JSP examples you can look at as well.

kind regards

bob

acec acec wrote:
> I followed Quick Start Guide to test Border Template, everything works.
> 
> Then I want to use jsp instead of velocity.
> 
> So I changed my BorderPage class:
>     public String getTemplate() {
> 	      //return "decorator-template.htm";
> 	      return "decorator-template.jsp";
> 	}
> 
> I also create one decorator-template.jsp under web root directory.
> --------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> <title>Click Quickstart</title>
> </head>
> <body>
>   <div id="header">
>     <span class="title">aaaa</span>
>   </div>
> 
>   <div id="container">
>   </div>
> </body>
> </html>
> --------------------------------------------------------------------
> 
> When I view that page, I can see the following on screen:
> --------------------------------------------------------------------
> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>  
> --------------------------------------------------------------------
> It seems click still use velocity to render jsp file.
> 
> How can I use jsp as a Template?
> 
> Thanks.
> Tomcat Acec
> 
> 
>       __________________________________________________________________
> The new Internet Explorer® 8 - Faster, safer, easier.  Optimized for Yahoo!  Get it Now for Free! at http://downloads.yahoo.com/ca/internetexplorer/
>