Expand my Community achievements bar.

SOLVED

Rendering a blank Page when viewing page [Component/Template]

Avatar

Level 9

Hi All,

I have created simple template and component and componet's jsp has belo html tags.

<%@include file="/libs/foundation/global.jsp"%>
<%--
  customer service form component.

  <%@page session="false" %>  
--%>
<html>
<head>
<title>Hello World !!!</title>
</head>
<body>
<h1>Hello Sling Servlet!!!</h1>
<h2>This page will post data to an Adobe CQ Sling Servlet</h2>
</body>
</html>

I could able to create page with this template but when i try to view page a blank page is rendering.I am seeing 14.02.2015 10:44:01.044 *ERROR* [172.19.236.14 [1423932241041] GET /wcm_author/content/csfsample.html HTTP/1.1] org.apache.sling.servlets.get.impl.DefaultGetServlet No renderer for extension html, cannot render resource JcrNodeResource, type=customer-service/components/page/csf, superType=null, path=/content/csfsample/jcr:content  error in error.log.

Can someone help me in fixing this issue.

Thanks,

Kishore

1 Accepted Solution

Avatar

Correct answer by
Level 10

That happens when you make a typo or mistake when creating the template. Create the template and page component again. Try following:

To create an application folder structure:

  1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
  2. Select CRXDE Lite.
  3. Right-click the apps folder (or the parent folder), select Create, Create Folder.
  4. Enter the folder name into the Create Folder dialog box. Enter firstOSGI
  5. Repeat steps 1-4 for each folder specified in the previous illustration. 
  6. Click the Save All button.

Note:

You have to click the Save All button when working in CRXDELite for the changes to be made.

Create a template

You can create a template by using CRXDE Lite. A CQ template enables you to define a consistent style for the pages in your application. A template comprises of nodes that specify the page structure.

To create a template, perform these tasks:
1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
2. Select CRXDE Lite.
3. Right-click the template folder (within your application), select Create, Create
Template.
4. Enter the following information into the Create Template dialog box:

  • Label: The name of the template to create. Enter keyTemplate
  • Title: The title that is assigned to the template.
  • Description: The description that is assigned to the template.
  • Resource Type: The component's path that is assigned to the template and copied to implementing pages. Enter firstOSGI/components/page/keyTemplate.
  • Ranking: The order (ascending) in which this template will appear in relation to other templates. Setting this value to 1 ensures that the template appears first in the list.

5. Add a path to Allowed Paths. Click on the plus sign and enter the following value: /content(/.*)?.
6. Click Next for Allowed Parents.
7. Select OK on Allowed Children.
 

Create a Page Rendering Compnent

 

Components are re-usable modules that implement specific application logic to render the content of your web site. You can think of a component as a collection of scripts (for example, JSPs, Java servlets, and so on) that completely realize a specific function. In order to realize this functionality, it is your responsibility as a CQ developer to create scripts that perform specific functionality. 

By default, a component has at least one default script, identical to the name of the component. To create a render component, perform these tasks:

1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
2. Select CRXDE Lite.
3. Right-click /apps/firstOSGI/components/page, then select Create, Create Component.
4. Enter the following information into the Create Component dialog box:

  • Label: The name of the component to create. Enter keyTemplate
  • Title: The title that is assigned to the component.
  • Description: The description that is assigned to the template.

5. Select Next for Advanced Component Settings and Allowed Parents.
6. Select OK on Allowed Children.
7. Open the slingTemplateJCR.jsp located at:/apps/firstOSGI/components/page/keyTemplate/keyTemplate.jsp.
8. Enter the following JSP code.

     
1
2
3
4
5
6
7
8
9
<html>
<head>
<title>Hello World !!!</title>
</head>
<body>
<h1>Hello Key Service!!!</h1>
<h2>This page will post data to a Key Service</h2>
</body>
</html>

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

That happens when you make a typo or mistake when creating the template. Create the template and page component again. Try following:

To create an application folder structure:

  1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
  2. Select CRXDE Lite.
  3. Right-click the apps folder (or the parent folder), select Create, Create Folder.
  4. Enter the folder name into the Create Folder dialog box. Enter firstOSGI
  5. Repeat steps 1-4 for each folder specified in the previous illustration. 
  6. Click the Save All button.

Note:

You have to click the Save All button when working in CRXDELite for the changes to be made.

Create a template

You can create a template by using CRXDE Lite. A CQ template enables you to define a consistent style for the pages in your application. A template comprises of nodes that specify the page structure.

To create a template, perform these tasks:
1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
2. Select CRXDE Lite.
3. Right-click the template folder (within your application), select Create, Create
Template.
4. Enter the following information into the Create Template dialog box:

  • Label: The name of the template to create. Enter keyTemplate
  • Title: The title that is assigned to the template.
  • Description: The description that is assigned to the template.
  • Resource Type: The component's path that is assigned to the template and copied to implementing pages. Enter firstOSGI/components/page/keyTemplate.
  • Ranking: The order (ascending) in which this template will appear in relation to other templates. Setting this value to 1 ensures that the template appears first in the list.

5. Add a path to Allowed Paths. Click on the plus sign and enter the following value: /content(/.*)?.
6. Click Next for Allowed Parents.
7. Select OK on Allowed Children.
 

Create a Page Rendering Compnent

 

Components are re-usable modules that implement specific application logic to render the content of your web site. You can think of a component as a collection of scripts (for example, JSPs, Java servlets, and so on) that completely realize a specific function. In order to realize this functionality, it is your responsibility as a CQ developer to create scripts that perform specific functionality. 

By default, a component has at least one default script, identical to the name of the component. To create a render component, perform these tasks:

1. To view the CQ welcome page, enter the URL http://[host name]:[port] into a web browser. For example, http://localhost:4502.
2. Select CRXDE Lite.
3. Right-click /apps/firstOSGI/components/page, then select Create, Create Component.
4. Enter the following information into the Create Component dialog box:

  • Label: The name of the component to create. Enter keyTemplate
  • Title: The title that is assigned to the component.
  • Description: The description that is assigned to the template.

5. Select Next for Advanced Component Settings and Allowed Parents.
6. Select OK on Allowed Children.
7. Open the slingTemplateJCR.jsp located at:/apps/firstOSGI/components/page/keyTemplate/keyTemplate.jsp.
8. Enter the following JSP code.

     
1
2
3
4
5
6
7
8
9
<html>
<head>
<title>Hello World !!!</title>
</head>
<body>
<h1>Hello Key Service!!!</h1>
<h2>This page will post data to a Key Service</h2>
</body>
</html>

Avatar

Level 9

Thanks You So much and now the page is rendering properly.

I am new to components/templates designing and implementing.Can i find and good material to learn these concepts and get hands on experience.

If you have any pointers please share with me that information.

Thanks Once Again