• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP with two forms

 
chandra chatterjee
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed. It's the nesting of h:forms that can confuse JSF. I should have been more clear.

Tim is absolutely right.

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic