• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF 1.2 - Custom component

 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,

I have a following doubt… let me know if you have any idea

Problem description:
I have following four xhtmls of simillar format.
1. page1ExcelExport.xhtml
2. page2ExcelExport.xhtml
3. page3ExcelExport.xhtml
4. page4ExcelExport.xhtml

Only some variables change in each page.

Requirement:
I want to define a template xhtml and substitute required values.
I know in JSF 2.0 we have this Composite component model. But in JSF 1.2 how can we do with minimum supporting model?


page1ExcelExport.xhtml listed below:





 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can use facelet insert tag (ui:insert). You can create multiple insert tag in your template page and can use them by define tag of facelet(ui:define). for example

in your template page-

<ui:insert name="title"></ui:insert>

and after including this template in your more specific page you can define it-
<ui: define name="tilte"> ABC </ui:define>

I hope it works for you
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

How can I use it to fill the attribute value? could you give me an example snippet?
 
Srinivasan thoyyeti
Ranch Hand
Posts: 558
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
instead of accessing the tempalte xhtml ...defined a POJO which exposes necessary attributes for template.

1. On click of excel export ...call action method if new POJO
2. based on request params fill in all properties
3. redirect to xhtml template
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!