aspose file tools*
The moose likes JSF and the fly likes JSP with two forms Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSP with two forms" Watch "JSP with two forms" New topic
Author

JSP with two forms

chandra chatterjee
Greenhorn

Joined: May 13, 2009
Posts: 18
Hello all,

I am new to JSF i wan to create an application that takes user input and display the results below. I dont want to use frames . I created jsp with two forms and kept the submit in second form, but my page seems to refresh when I hit the commandButton Submit.

As i have to display the results dynamically what is the best way to display the result ?

I am using myfaces, if there is any good documentation can you please give the links too.

Thanks in advance
Kalam.
lynn fann
Ranch Hand

Joined: Oct 15, 2006
Posts: 115
Exploring the Ajax4Jsf Library, where you can Rerender some components of the UI.
http://www.javabeat.net/articles/19-introduction-to-ajax4jsf-2.html
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Be careful with two forms. JSF will want all of your key input components, like textfields and radio buttons, within a single, common, h:form tag. You can have multiple buttons that invoke different actions or do methods, but it will all want one h:form tag, not two.

-Cameron McKenzie
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16014
    
  20

Cameron Wallace McKenzie wrote:Be careful with two forms. JSF will want all of your key input components, like textfields and radio buttons, within a single, common, h:form tag. You can have multiple buttons that invoke different actions or do methods, but it will all want one h:form tag, not two.

-Cameron McKenzie


That doesn't mean you CAN'T have more than one form on a page. However each form only submits the data that's packaged within that form. Sometimes that's what you want. A lot of times it isn't.


Customer surveys are for companies who didn't pay proper attention to begin with.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Indeed. It's the nesting of h:forms that can confuse JSF. I should have been more clear.

Tim is absolutely right.

-Cameron McKenzie
 
Don't get me started about those stupid light bulbs.
 
subject: JSP with two forms