• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to duplicate part of page in layout.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
I want to duplicate buttons on my page what do I mean my pages could by very long.
Now i have button only on the bottom of my page but i want them also on the top.
I was wondering is there a way to do this through layout.
My layout is very basic
e.g.

Page example.

The best would be create "ui:insert" in "ui:insert" but this is impossible besides buttons must be the same "h:form".
Do you know some trick to duplicate some part of page?

I know i can clone part of my page using javascript/jQuery and "prependTo" to form but i was wondering can I do this in layout.
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I have done when I want something like this is to create a page component that holds the buttons (also search controls and whatever else I want for those zones in the page). Then I can include this component twice in the page layout - once before the content part, once after the content part.

I do not recommend putting these components in the same h:form as the content is using. It's better to define the component in its own form (since it's repeated, that will make 2 instances of that form in addition to the page content form, if any).

Although I can/have defined a separate backing bean for the "control-bar" component so that I can hold control-bar specific actions (and search arguments, etc.), I also often use "form-free" constructs on the control bars. In other words, my "buttons" are actually just URLs (h:outputLink's) that use CSS to appear like form buttons. The reason for this is that often these controls are things that people use after they've been sitting doing nothing, which means that use of a JSF actions (commandButton, commandLink) is more likely to result in a ViewExpiredException. Actual HTML links (<a href="...") such as the h:outputLink tag generates never expire.
reply
    Bookmark Topic Watch Topic
  • New Topic