• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use multiple scopes in a page?

 
Binnie Fabian
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day,


After trying to figure out how to do it, I failed.

Can somebody give me a hint on how to do it?

This was my problem yesterday,

Use SessionScope and RequestScope at the same time?

Thanks in advance.


Binnie

 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you post a new thread instead of continuing with the old one? There seems to be no reason for this and you even refer your own thread here!

Also, post your current code so we can determine where you went wrong.
 
Binnie Fabian
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day,

Sorry about that,

Well here's my code.

Session Scoped


Request Scoped


view.jsp



add.jsp



The index.jsp just calls the two jsp pages.



Regards,

Binnie







 
Ilari Moilanen
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not very familiar with RichFaces but I don't see any obvious problems here. What exactly is the problem anyway? Does doing something throw an exception? And what that exception is?

You say in your previous topic that "When I tried to use them inside the page, only the RequestScopeBean functions." so is that still the problem? And what do you mean by "not functioning"? If you put logging lines inside your methods (including getters and setters) you can see what exactly gets called (and and in what situation) and what does not.

EDIT: and you seem to be doing the basic mistake of catching exceptions in you code but not logging what that exception was so at least all those exceptions do go unnoticed.
 
Binnie Fabian
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good Day,


Here is my situation;

Back then I have a running drop down menu that displays the description of the selected item on a text area.

It is running with a SessionScopedBean, coz if I use RequestScoped, the text area wont populate.

Every thing seems fine until I added a new feature which is to ADD records.

I used a modalPanel (RichFaces) to add records and it only works (based on my output) inside a RequestScopedBean.

If I use SessionScoped, I'll get this error:

/jobPosition/view.jsp(26,12) '#{jobPositionBeanRequestScoped.jobPositionList}' Error reading 'jobPositionList' on type com.practice.bean.JobPositionBeanRequestScoped

(Note: I was only using one backing bean for the above statement.)


That is why I asked back then if it is possible to use them both at the same time.

Mr. Tim and you replied that it is possible.

Knowing that it is possible, I tried it on my own first but I failed.

Then I asked again and made this topic.

And again I'm sorry for making another one.


Everything is working the way I wanted it now.

Thanks for your time.


BTW thanks for these, it helped me a lot.

  • If you put logging lines inside your methods (including getters and setters) you can see what exactly gets called (and and in what situation) and what does not.
  • EDIT: and you seem to be doing the basic mistake of catching exceptions in you code but not logging what that exception was so at least all those exceptions do go unnoticed.



  • Regards,

    Binnie
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic