5

Question 1) I would like to know whether ruby on rails have gems with functionality similar to primefaces. why i am asking is

if you go with primefaces ( http://www.primefaces.org/showcase-labs/ui/home.jsf ) developer no need to worry about javascript or jquery stuffs.

As far as my knowledge JSF is an spec , on based the spec various implementations available , primefaces is an ui framework for those implementations , primefaces has so many components based on jquery and javascript libs. More or less primefaces simply serves as a javascript wrapper. I you use primefaces , you mainly concentrate on business logic no need to worry about UI.

i was heavily inspired by ruby on rails approach and there are lot of gems available.

what my question is , Is there an gem or UI framework available for ruby on rails similar to UI magic driven by primefaces

note: i am not looking for pure jquery or dojo stuffs, i am looking for UI component driven stuffs for ruby on rails. Guys who worked on projects using primefaces and projects using rails will understand my question 100 %.

Question 2) I would like to know list of gems related to user interface. what i am asking is inorder to create very niche user interface on ruby on rails what are the stuffs(frameworks or gems) needed.

0

2 Answers 2

5

Many parts of the previous answer simply aren't true. It sounds like the answer-er hasn't used JSF2.0, which is what Primefaces is. JSF v1 was horribly complex and an awful experience for everyone. JSF2.0 is nothing like JSF v1, so be careful about the naysayers who admit not using JSF2.0.

JSF2.0 is an awesomely productive and fun web framework to use. It's not "corporate-ity" at all (but gets that reputation from JSF v1). It's lightweight and stays out of your way. Because it's Java (which is eventually compiled, not interpreted), it's also pretty quick.

At it's core is a templating framework: You're not limited to components, by default it's free form HTML. You have the option to use smart tags called components that can maintain state through the request lifecycle, which is handy for doing things like validation and ajax (both are really simple tasks in JSF2.0).

JSF2.0 also manages lifecycles of beans (small stateful objects you define) that can be bound to different scopes, like request, the view, session, or even application. Controllers are a simliar concept in Rails, but JSF2.0 doesn't have the concept of routes, instead you pass function objects using an EL, so it has the concept of actions instead. This makes it incredibly free-form; you can use whatever software pattern you like: I like MVVM over MVC, and I tend to use that pattern, whereas Rails is fairly strict MVC.

Component libraries are a bundle of java code and html fragments that can be plopped onto the page. Primefaces is a component library of commonly used UI widgets. Essentially, you write some JSF/HTML code and it drivers JQuery UI on the browser.

Could you use JSF2.0 with Ruby? I bet you could using JRuby. If it is possible to annotate Ruby objects with the JSF2.0 annotations (like @ManagedBean), I'm fairly certain you could make this work with a little experimentation.

Good luck and post back if you have any end up doing this!

2
  • everything seems quite simple once we master it :) be assured that even with 2.0 improvements it's still somehow component oriented ... also it seems that today we actually write more JavaScript by hand instead of generating it (since we have JavaScript libraries) - you hardly touched these 2 things I criticized to be an advantage over a web-framework such as Rails. anyway, I strongly suspect this answer to be quite biased since the author as well as the answerer seems to be primarily Java developers.
    – kares
    Sep 9, 2012 at 12:40
  • I have developed in both Frameworks (JSF 2.0 and Rails) and I agree with this answer. Rails is so productive and basically easy to use but not as flexible as JSF 2.0.
    – ehsun7b
    Oct 17, 2012 at 4:16
4

I really thing you're kind of asking the "wrong" question here - due my previous experience with JSF (mostly MyFaces) and Rails.

I assume you're mostly at your beginnings with Rails - forget JSF, forget components and maybe even forget how you wrote JavaScript (on a JSF project). RoR is a different world and the more you get into it the more you neglect components, at least that was my case. I also kind of reinvented "simple" web programming with Ruby on Rails and gained some "valuable" JavaScript experience, but I had to let go some of my previous "wisdom" from Java land :)

There's no such UI "magic driven framework" for Rails as far as I know and I believe there's no demand for it either. The view layer, including the JavaScript integration, is (conceptually) different in a (component based) JSF application than it is in Ruby on Rails.

I personally only see JSF as a good choice for "corporate-form" applications that are written once, evolve minimally and require very little component customizations (or require some but than the time spent coming up with custom components should be reused on other apps).

JSF's view layer tends to limit you with the components you have - instead of thinking clearly about the layout of your "widget"'s HTML you tend to think about adapting an existing component to your needs, it's not unusual to hit the limits in a real use-case requirement and than you end up spending a lot of time examining the component for possible extensions and hacks. Not to mention it might be harder to adapt generated pieces of HTML + JavaScript that you have not wrote, even if written carefully it's still laying there and you have to learn yet another "small" API for each and every component.

If you look at Rails it's by design different - you write "plain-old" views (that initially take some time), for re-use you split them logically into partials (most likely as new requirements come in). When reused, partials can easily be adapted to new scenarios, not to mention you're in control of the JavaScript that comes with the markup.

Besides lots of new apps are written as fat JavaScript clients with a REST API, I can't imagine how JSF here would not be a burden as you most of the time need complete control over your HTML and JavaScript. You must and want to worry about the UI and certainly do not need yet another server + client JavaScript wrapper. If you prefer thinking in components I would rather recommend you looking at client-side component libraries such as Ext-JS.

Not the answer you're looking for? Browse other questions tagged or ask your own question.