Everything in the form works just fine, except that if I press enter the form get submitted in a postback, and reloads the whole page. If I could just set an empty form-action I believe this would work just as I want it to.
...or perhaps I should do this in a totally different way?
Toto, I have a feeling we�re not in Kansas anymore
You can't do it that way. Normally, a JSF post will carry a lot of invisible freight without which it can't maintain proper context from page view to page view.
An IDE is no substitute for an Intelligent Developer.
Joined: Oct 27, 2008
Regarding the invisible parts: is there anything outside of the <form></form> tags that needs to be posted? Everything between the form-tags are posted (using prototype's serialize-function) and the form(s) seems to work just fine, except that when I press enter I get a postback of the whole page.
ANY submit request will normally cause the entire page to be reloaded. RichFaces can tap AJAX to limit the reload to specific parts of the page using the "reRender" attribute. And yes, RichFaces does inject JSF context into form submits, so it will post both everything within the form and as much of the surrounding JSF context as it finds necessary.
HTML should be limited or non-existent on a well-designed JSF page. HTML is all about presentation and JSF is about function. Instead of using DIV tags, consider using one of the JSF or RichFaces equivalents, such as Panel.
I highly recommend spending some time looking over the RichFaces Live Demo at http://livedemo.exadel.com, especially the AJAX Support components and the Rich Output components.
Joined: Oct 27, 2008
I know that I'm not doing things here the way JSF, and RichFaces, was intended to be used, but I'm converting a (~75% finished) PHP-project that I started a while ago. Since I haven't been too impressed by the standard JSP/Servlet way of doing things I decided to try JSF for some parts (mostly forms) of the site. I might convert the whole, somewhat complicated, layout to JSF/*Faces later, but right now I'm just using it for selected parts.
I've looked at the RichFaces demos, but I haven't found anything that does exactly what I need right now: something like prototypes Ajax Updater (http://www.prototypejs.org/api/ajax/updater) where I actually load a (jsf)page, containing a form, inside a div as opposed to creating (a large number of) hidden forms that expands.
All DIV really is is a way of framing a chunk of page with the understanding that the div resets horizontal page position. It's otherwise equivalent to a SPAN, which frames a chunk of page without resetting horizontal page position.
But neither one are generally a good way to lay out JSF. First, because part of the design of JSF is that you might want to output the page in other formats than HTML, so the page should not assume HTML by explicitly including HTML content (unfortunately, sometimes we've got no choice).
Secondly, the effects of things like DIV are normally produced in JSF by using JSF constructs. If I read your complaint correctly, you were objecting to using dynamic display components to frame static parts of your page. And you shouldn't - the basic JSF grid controls are sufficient for that. JSF generates its own divs when it needs to, by the way.
Just as a side comment, I think if there's one thing that people laying out JSF pages dislike more than anything else, it's the fact that the core JSF tags don't include any sort of table or grid component capable of creating a row- or column-spanning table. You end up having to nest simpler components to get that effect.
Joined: Oct 27, 2008
Thanks for you input, again. I'm back to palying around with RichFaces instead of going for the ugly JSF hack-attempts. I haven't been able to do exactly what I want, yet, but I'm getting there.
Eventually, I will try to go for the full-blown JSF layout, but at the moment I just want to get this site up and running as fast as possible.
On a side note I have to say that it is a bit worrying that the (main)menu at livedemo.exadel.com doesn't, fully, work in my Browser (Firefox 3.0.3, Windows XP), but Firefox 3 isn't officially supported at the moment, as far as I can see.