aspose file tools*
The moose likes JSF and the fly likes Parameter passing between request scope beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Parameter passing between request scope beans" Watch "Parameter passing between request scope beans" New topic
Author

Parameter passing between request scope beans

Pho Nghi
Greenhorn

Joined: Jul 28, 2011
Posts: 4
Can anyone point me in the right direction in passing parameters through request scoped beans? I can't find any examples. I'm using version 1.2 I can do it perfectly fine with a session scope but not getting it on a request scope.
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

Hi Pho Nghi,

Could you please be more specific of what you need and where you stuck?


Sun Certified Java Programmer with 93 percent
Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Why you still using JSF 1.2.1...
2.0 is better, isn't it?

Maybe you can set a value in your second request-scoped bean by the first request-scoped bean.
For example:
(I don't know if this can be work or not, this just a tips)



Or, you can just use @ApplicationScope or @SessionScope
Because, I use @RequestScope very very rarely.

Hope could helping.


Independent Programmer - Technology Enthusiast - JUG Leader from JUG Joglosemar
Pho Nghi
Greenhorn

Joined: Jul 28, 2011
Posts: 4
Using 1.2 because I was forced too

What I am doing is using rich faces to upload a document. So I have upload.jsp, uploadbean.java, uploadform.jsp, and uploadformbean.java
The upload.jsp will use rich faces to upload a document and grab some of it's properties and store them in the uploadbean.java. Once it is done uploading it will go to the next page uploadform.jsp and display some of the properties of that document which I was hoping to pass the parameters from uploadbean.java to uploadformbean.java. I wanted to keep this all request scope so I can learn on how to do it.

Is this much clearer?
Yosi Pramajaya
Ranch Hand

Joined: Jun 30, 2011
Posts: 46

Hohoho.. It's surprising me because I thought that we as a developer / programmer must not forcing anyone..

Anyway, I've no experience in creating web projects directly (go through server, upload and etc). But I still recommend the same things as before, maybe you should try it too.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16137
    
  21

Request scope doesn't work very well in JSF. Request scope objects have a lifecycle limited to a single request/response, and JSF often makes multiple requests per page. And in no case can you use request scope to define beans for pages yet undisplayed.

Beyond that, "parameter passing" isn't how JSF was designed to work. JSF is about Inversion of Control, and in IoC, you don't use a bunch of framework-specific APIs to get data passed around, you define bean wiring to the JSF framework, which then injects source beans into target beans, allowing them to trade info using POJO set/get methods.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parameter passing between request scope beans