• 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

Calling a method during onload

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

i am new to JSF.

i have 2 JSP Pages and both of them share the same Managed bean.

For Eg.
EnterpriseLogin.jsp
UserLogin.jsp

Both share the same backing bean and managed bean. For enterprise login additional validations are required in the managed bean.
When the user navigates to UserLogin.jsp it should call userLogin(in managed bean) method during onload. Similarly onload of EnterpriseLogin.jsp it should call enterpriseLogin (in managed bean) method.

please suggest me how to achieve this functionality.

Currently i am using 2 different managed bean with common methods present in both of the classes.
For calling a method during onload, i am placing the method call in the constructor of the Managed bean.

thanks
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ganesh Ra " welcome to Javaranch
please check your private messages.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Create two methods for intialization for the each page in your backing bean like as mentioned below. And include your page specific validation code in these methods.

public String getInitEnterpriseLogin() and
public String getInitUserLogin()

And call these methods in your jsp at the begining of the page using h:outputText.

<h:outputText value="#{backingbean.initUserLogin}"/>
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was also seeking the solution for similar issue.
It Works for me! Thanks!!!
 
What's that smell? I think this tiny ad may have stepped in something.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic