• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to duplicate part of page in layout.  RSS feed

 
hubert paluch
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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.
 
Tim Holloway
Bartender
Posts: 18715
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!