• Post Reply Bookmark Topic Watch Topic
  • New Topic

Managed Bean problem

 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, here's another JSF /Managed Bean question.
I want to pass parameters from one server to another using a custom tag. The Tag writes out a form and submits it using javascript. That bit works fine. The form gets POSTed to the JSF app on the 2nd sever ok.
When I look at the request values received on the jsf page they are all there. The problem I have is getting the request parameter values into a managed bean that has session scope.
Using ..

etc in faces-config.xml I can get populate a managed-bean with request scope OK. However, it doesn't seem to work if the bean has session scope.

So, I've removed the managed property stuff from faces-config.xml and populated a jsf form using ....

in MyManagedBean I have

However, this has caused me a few dilemmas.
1) When debugging, the only time the submit button seems call MyManagedBean.initialise is when I output the values using which means there isn't anything in the request

2) Even when MyManagedBean.initialise is called it seems to ignore the navigation rule..

3) I've tried binding the input fields to the Managedbean and set the value from the param, using:


Stepping through the code in the debugger (I'm using Eclipse +Tomcat), the MyManagedBean ctor is called but after that I just get a page not found error in the browser, If this was any ordinary jsp app i would suspect a complilation error, but I can't find any in the tomcat log.
 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I have a solution..
I have two ManagedBeans, one with request scope,the other with session scope. The first page populates the request bean, The action method of that copies the request version of mybean into the session.
 
Mike Halford
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so I solved the navigation rule problem in the initial question, I had put a .jsf extension on the navigation rule instead of .jsp :roll:

The workaraound I have is a bit cludgy (to say the least ), especially as I have to do


to submit the form automatically, I don't reallt want the user to see the form so I'm going have to create some invisible button or link to call the
initialiseMap() method.

So, the question is still what is the best way to populate a bean in session scope with values coming in via POST request?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!