wood burning stoves 2.0*
The moose likes Struts and the fly likes JSF hurts my head... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "JSF hurts my head..." Watch "JSF hurts my head..." New topic
Author

JSF hurts my head...

Kev D'Arcy
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
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?
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Yes even i wanna to learn JSF can any one tell me a good guide and the links having JSF jar's.


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
How about this http://www.javaranch.com/newsletter/200404/Journal200404.jsp#a3 from our Javaranch Staff ??


Spritle Software Blogs
Kev D'Arcy
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
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
Bartender

Joined: Jul 13, 2001
Posts: 3150
I think its better if you post JSF questions in our Web Application Frameworks forum.
Kev D'Arcy
Ranch Hand

Joined: Jul 26, 2001
Posts: 75
Oops! Didn't know there was one!
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Moving to the Web Applications Frameworks forum...


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Dushy Inguva
Ranch Hand

Joined: Jun 24, 2003
Posts: 264
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 ]

SJCP, SCBCD, SJCD, SCDJWS, SCEA (Part I)
Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
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
Marek Lapin
Greenhorn

Joined: Sep 19, 2004
Posts: 15
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)
Michael Rasmussen
Greenhorn

Joined: Nov 25, 2002
Posts: 9
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
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400
FacesContext.getCurrentInstance().getExternalContext() object can return you broad range of Map object like :
SessionMap, RequestMap, RequestHeaderMap , CookieMap etc. etc.


- Varun
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSF hurts my head...