• 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

Another parameter passing noob

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiyas, I've browsed through several posts related to parameter passing, and I'm still quite lost.

What I'm trying to do is:

1) Getting the input string value from 1st JSF page
2) Have the bean process it and launch 2nd JSF page
2) Pass to 2nd JSF page and commandLink to 3rd JSF page
3) Pass to 3rd JSF page
4) Use string value in bean related to 3rd JSF page

I kind of made up a simple code of what I wanted. From what I think, JSF Page 2 is able to read the pass string from JSF Page 1 is because the bean launches JSF Page 2.
But from JSF page 2, I'm unsure on how to assign the value in order to pass into JSF Page 3.
If I came off as confusing, I am sorry.
Much appreciated.

JSF Page 1


JSF Page 2


Pass bean
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't treat your View Definitions -and the EL - like they're some sort of programming language. That's not how it works.

In other words, don't code action method references like they were function calls:


Similarly, on property references:

 
Jason A Wong
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fixed it in code, doesn't solve anything though I think.
I've been looking online a lot, and most of the stuff that relates to keeping values in session across different JSF pages includes editing the faces-config.xml file.
Using NetBeans, faces-config.xml is supposedly not needed. So I was wondering if it was possible to create that xml file and just input what I needed into it.
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jason,
Welcome to the Ranch!

Your issue is not completely clear to me. You have said that the value is getting displayed in page 2, which means the session is working fine. Where do you get the problem?
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IDEs have nothing to do with this.

In JSF Version 1, the scope and initialization of JSF Managed Beans was defined in the faces-config.xml file. In JSF2, the option was added to define scope and initialization as Java annotations in the bean's class definition. If a conflicting bean declaration is found in faces-config.xml, that declaration will override the annotations, thereby making it easier to re-use code without editing and recompiling it. There are also some other things that are not possible to declare with code annotations, such as integration of the Spring Framework into the JSF EL context, so faces-config.xml isn't completely useless, even these days. Although if you don't use any of those features, you may omit that file entirely.

To get values from one View to another, the 2 Views (pages) need to be able to reference a common backing bean. This bean has to be Session Scoped or higher. Request Scoped beans are destroyed each time they're used, and View Scoped beans don't survive the transition from one View to the next. I'm ignoring Flash scope here, since that's better left until you have the basic concepts working for you.
 
Jason A Wong
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Found out what I needed to do, though it's not pretty looking.
Made beans SessionScoped, and passed parameters through JSF. Pretty sure there's an easier way. But it's a start.
 
It's a pleasure to see superheros taking such an interest in science. And 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