• 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

made progress with Ajax and JSF 2.0, need help please

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a simple JSF 2.0 form sent to the server with Ajax :

<h:form prependId="false" id="form">
<h:inputText value="#{securityResponsibleManagedBean.adminName}" /><br />
<h:inputSecret value="#{securityResponsibleManagedBean.adminPwd}" /><br />
<h:commandButton action="#{securityResponsibleManagedBean.adminLogin}" value="Intra">
<f:ajax event="action" execute="@form" onevent="afterAdminLogin()"/>
</h:commandButton><br />
</h:form>


This form is sent to :

@ManagedBean(eager=true)
@ApplicationScoped
public class SecurityResponsibleManagedBean {
private String adminName;
private String adminPwd;

public void setAdminName(String adminName) {
this.adminName = adminName;
}
public String getAdminName() {
return adminName;
}
public void setAdminPwd(String adminPwd) {
this.adminPwd = adminPwd;
}
public String getAdminPwd() {
return adminPwd;
}

public void adminLogin() {
System.err.println("Admin name : " adminName);
System.err.println("Admin pwd : " adminPwd);
}
}


After the adminLogin method is called, the Ajax response arrives in the browser and my afterAdminLogin javascript function is called.
How do I set the Ajax response to be as such :

<login>
<status>CORRECT</correct>
</login>

and how I pass the xmlHttp.responseXML to my afterAdminLogin javascript function?
 
Let me tell you a story about a man named Jed. He made this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic