I'd like to know if it's possible to generate richfaces tabs dynamically without binding the component to the backing bean and looping through an array to populate it? I ask this because the #ViewsScoped bug will make such a solution useless in many cases. Primefaces provides dynamically generated tabs for a number of their container components but I'd really prefer to use richfaces here for a number of reasons. Thanks for your input.
Related
PrimeFaces is a Java library which provides common frontend web components (e.g., dialogs, tables, select menus). The advantage of using PrimeFaces is that when you use a PrimeFaces component, you only need to tell it which data to use and which property you want to update server-side. The PrimeFaces library takes it from there, creating the component on the screen, displaying the data, and handling the Ajax interactions with the server-side code.
Is there any equivalent to this in the Ruby or Python web programming worlds? It seems to me like the alternative is coding your components up from scratch each time, manually handling the Ajax, etc., which sounds crazy.
How do non-Java web developers handle this?
Well, it may sound crazy, but I used RailsAdmin for this. It generates views, based on model fields and relationships. By 'generates views', I mean that it does it in a runtime (you're not going to have a copy of views in your application and etc.) Basically, this gem provides you basic functionality to manage your data from the beginning (without spending time on creating views and controllers). And ofc, it can't be used as a straight equivalent to PrimeFaces. But for prototyping stage, I think, it will do nicely.
I need to create ui components dynamically in jsf page using managed bean.
I have ui types(inputText,textArea,Calender etc...) stored in the database.
So using these data i want to create ui components such as textfields on jsf page.
Is it possible,if yes then how to do this.
Thanks in advance.
You may want to consider Metawidget for this task, as it does much of the hard work around dynamically creating components (including PrimeFaces components) for you.
If you'd rather roll your own implementation, here is the correct way to create dynamic components in JSF: http://blog.kennardconsulting.com/2010/10/safely-manipulating-component-tree-with.html
This question already has answers here:
Component to iterate and render a nested tree-like object structure in JSF
(2 answers)
Closed 7 years ago.
Description:
I am creating an e-shop in JSF. On the right side I want to have the all categories of my shop.
I use recursive method to go through all categories (category can have parent category).
So the way I have choosen to do it is creating my own component.
Is this thinking correct?
How to do it this way or maybe I should try something else?
My attempt of solving this problem:
Create custom component which extends UIComponentBase (maybe I should extends
something else).
Then create another components (CommandButtons) inside of this component ,
which will be added to host the component.
Another issue is how can I launch actionListener of my button?
Beacause they are not automatically launched?
Has anybody created these kinds of components?
You're basically looking for an UI component which can render a tree hierarchy. PrimeFaces already offers two tree based components out the box, the <p:tree> and <p:treeTable>. Click the links to see several showcase examples.
If you intend to have full freedom over the markup of a tree hierarchy, then you may find the OmniFaces <o:tree> more useful. It does not render any HTML, so you have all HTML freedom to markup the tree nodes accordingly.
Or if you really insist in developing your own and thus reinventing the wheel, look in the source code of those components. They are open source.
On a number of different document types, I have to add the same 3 native Umbraco data types
content picker
TextString
TextString
It was suggested to me to see if there is a way to create a new custom data type that would basically wrap those 3 datatypes into a new datatype.
I looked at nibble.be's site and see there is a couple different ways to go about creating custom data types (using the usercontrol wrapper, or 3 class approach). However, I am not sure that a custom data type for grouping existing datatypes would be the correct route.
For one thing, we are using MVC along side Umbraco with a heavy use of Razor views. Since the document type property alias is used to acquire values from Umbraco from the content page, I don't see how this would still be possible or how you would go about getting the property value of a custom datatype that has embedded datatypes.
Would there be a working way or a better way to accomplish this solution for having to add the same fields on any document type that they are needed? I though about hierarchical approach with a document type parent with only these 3 data types (content picker and 2 textstrings), but that would mean having to put any document type that a page would need under this parent document type simply for the fact to inherit these group of properties.
If you're looking to embed multiple properties into a single datatype:
There are a number of embedded datatypes available; DataType Grid, Embedded Content, and Repeatable Custom Content are the three I know of. All three store their information as xml which allows easy access via both xslt and razor.
The DataType Grid is part of uComponents and is therefore actively developed. It is also open source and therefore contributions are encouraged. Embedded Content and Repeatable Custom Content, while still useful, don't appear to have any current support and therefore no plans for improvement. I think they are licensed as open source, but the source isn't publicly available as far as I can tell.
I don't think you can set a limit on the number of rows/items stored in the DataType Grid, like you can in Embedded Content (perhaps a feature request).
Take a look at some of these solutions before you plan on rolling your own. But if you still feel the urge to code out your own data type, I'd recommend Tim Geyssens' articles on created custom datatypes using the user control wrapper, with data editor settings, and serializing the data as xml. His "Master of Datatypes" video is also really helpful and covers those topics as well.
If you're looking to organize your properties into groups:
Tom Fulton published a new package/data type recently called Document Type Fieldsets that may fit your needs. It allows you to group fields together in a fieldset. Here's a screen shot:
I realize this is an old question, so I'm just adding this for anyone searching for this functionality in the future: This is almost exactly what we use Widget Builder for in Umbraco 6.
Widget Builder is the predecessor to Umbraco 7's Archetype which is being pushed by the core team for near universal use. I believe it's going to become a part of the core.
Internally, WidgetBuilder and Archetype store their data as JSON and make it very easy to copy a custom data type from one project to another with an import/export feature.
I used to work with Archetype for some time until I discovered Nested Content which does the same thing but much easier to work with because it nests Document Types instead of Data Types which is much easier to work with, especially for Content Editors. Plus the resulting Data Types is normal built-in Umbraco ones, not Archetype Objects which add a new layer of Entity Mapping in your views.
I would like to create little higer-level framework on top of Struts2 which can take form element description from Action and render a complete form, in order to avoid having a separate JSP files with hardcoded form elements for every form in a large web application (so if I manage to do this I will have just a few generic JSPs for data form and few for layout). Application is extremely data-driven.
My idea is to create form description using custom objects in the Action (i.e. Button, TextInput etc.) and then to create a single JSP page that will render eveything out.
What is the best way of doing this? Can you propose some concrete way to do this?
I don't want to write something if I can reuse the existing code with some effort.
Any ideas are appreciated.
Kind regards,
Bozo
It seems to me you are trying to build a web framework on top of another, I doubt Struts2 is appropiate for that.
If you have a data-driven web app for which you dont want to write many similar JSP (or whatever view lang) pages, perhaps you'd better look at some frameworks with scaffolding abilities , eg Grails http://www.grails.org/Scaffolding
I did what I asked in the question myself - I have created a few generic JSP templates (list, edit etc.) which take application parameters and create output grids and forms using the struts2 and simple HTML tags. Using this method generic tiles definitions can also be created and used. So at the end using simple definition in the struts2 action, the grid and form is generated.