• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajax & Myfaces problem - pages reloads with commandButton.

 
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JSP page with simple MyFaces components like an inputText, a div and a commandButton. What I want is whatever the user types in the textbox should get into the innerHtml of the div element on click of the button. I am trying to use Ajax for this. I am using Strategy 3 from here
So I have a separate Servlet and the response is returned to the JSP.
When I test, I see that the response is captured by JSP page and the div element gets the data into it.... but just for a second or so. After that the page appears to reload and the div resets.

On further research, I found out that the page reload happens whenever I click on a commandButton in a JSF page, even if there is no Ajax call or action or onclick call. I cannot understand this specific behaviour of commandButton. The Ajax call works perfectly when I use onkeypress event on the textbox.

Can someone please advise what I must to do make the commandButton work with my Ajax call. Why is the page reloading when I click JSF commandButton component?

Thanks in advance.
[ November 24, 2006: Message edited by: A. Dusi ]
reply
    Bookmark Topic Watch Topic
  • New Topic