• 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

JSF hurts my head...

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doing some investigation on JavaServer Faces... and having found loads of
articles and demo applications... I think (emphasis on think) I have a fair
idea of how it all hangs together... From what I've read, the basic premise
is to design the Java beans first that control the functionality of an
application and then wrap the JSP user interface and navigation around these
beans. No problems here so far... I know you can go back and forth between
faces and non-faces components, but this seems not to be the goal of JSF. So,
now to my question... If I stick with the pure JSF model, how do I access
application/session scope variables in my beans? Is there some static methods
in the JSF spec that I should be using? Should I just use non-faces components
to access them? Am I completely off the mark? Does anyone know of a really
good complete idiots guide to JSF?
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes even i wanna to learn JSF can any one tell me a good guide and the links having JSF jar's.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about this http://www.javaranch.com/newsletter/200404/Journal200404.jsp#a3 from our Javaranch Staff ??
 
Kev D'Arcy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Balaji!

I had seen a similar app on another site... That's basically the level I'm
at, though I still don't know how to access session/application scope
variables from within my code. Do I have to use non-faces (i.e. a servlet)
comonent or are there static methods in the JSF framework I can use?
 
Balaji Loganathan
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think its better if you post JSF questions in our Web Application Frameworks forum.
 
Kev D'Arcy
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops! Didn't know there was one!
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Web Applications Frameworks forum...
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To access Request/Session scope parameters you'd do this:



Thats pretty dumb though. Sad that Sun ALWAYS releases half cooked, useless products.

Since all of this is a pain, you might want to put these in a superclass or utility class.
[ November 24, 2004: Message edited by: Dushy Inguva ]
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi well the hole ide as i get it is that you dont have to get all the session and req params from the request the jsf model abstracts that. Insteed you will go throw listernes and valubinding mechanism insteed. A good place to begin at is www.jsfcentral.com buy some books and start hacking

ps. the backing beans can also have a bind to a jsfcomponent and in that way get the data and manupilate it.

//Rille
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try J2EE tutorial (from sun pages -> j2ee). There is one section for JSF (1.1) and it is good (well at least for me it was sufficient)
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this

<managed-bean>
<managed-bean-name>
myBean
</managed-bean-name>
<managed-bean-class>
mypackage.Myclass
</managed-bean-class>
<managed-property>
<property-name>aManagedProperty</property-name>
<value>#{aManagedProperty}</value>
</managed-property>
</managed-bean>

#{aManagedProperty} works like it does in the EL. You can use it to insert another session scope variable or whatever you want. Then in your bean you need a
getAManagedProperty()
and
setAManagedProperty(Object){
}
respectively
 
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FacesContext.getCurrentInstance().getExternalContext() object can return you broad range of Map object like :
SessionMap, RequestMap, RequestHeaderMap , CookieMap etc. etc.
 
reply
    Bookmark Topic Watch Topic
  • New Topic