I do not know too much about JSF but, as I understand it requires a
lot of XML coding and that is what web2py people (particularly me) do
not like. Yet in the last year many things have changed, in
particular:
- plugins and components
- a new more portable DAL
- a better routing mechanism
- more configuration options for built-in functions
components in particular help you do some of what JSF can do. They
allow to insert a {{=LOAD('controller','function',ajax=True)}} in a
web2py view and the actions /app/controller/function will manage its
own content. It can also communicate with other components and trigger
events. For example (complete program):
# models/db.py
db=DAL()
db.define_table('post',Field('body',notnull=True))
from gluon.tools import *
crud=Crud(globals(),db)
# controllers/default.py
def reload_posts(form):
response.js="web2py_ajax_page('get','%s',null,'posts')" %
URL('posts')
def index(): return dict()
def post(): return crud.create(db.post,onaccept=reload_posts)
def posts(): return SQLTABLE(db(db.post).select())
# views/index.html
{{extend 'layout.html'}}
{{=LOAD('default','post',ajax=True)}}
{{=LOAD('default','posts',ajax=True,target='posts')}}
post and posts are components embedded in the index page. submitting
an invalid post does not reload the page, only the component with its
errors and flash message. Submitting a valid post form, results in a
call (serverside) to reload_posts with sends a JS commend to the
client which forces an ajax reload of the list of previous posts.
On Feb 16, 8:55 am, sebastian <[email protected]> wrote:
> Hi Guys,
>
> I have used web2py successfully for few commercial projects in the
> past and I it saved me a LOT of time compared with J2EE + Spring/
> Struts + Hibernate etc... In fact most of the effort was for the UI as
> the business part was taken care by web2py !
>
> Now I am working on a project with JSF 2.0 (Primeface ) and I have to
> say that I am impressed. I can add Ajax components very easily (see
> the primecase showcase) and the business part (Java) is incredibly
> easy bound the the components... (it is just a class with an
> annotation)
>
> As I haven't used web2py seriously for over a year, just wondering if
> web2py has added something similar (or better !) to JSF2.
>
> Thanks