This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JSF and the fly likes Managed Bean problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Managed Bean problem" Watch "Managed Bean problem" New topic
Author

Managed Bean problem

Mike Halford
Ranch Hand

Joined: Jul 13, 2005
Posts: 31
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

Joined: Jul 13, 2005
Posts: 31
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

Joined: Jul 13, 2005
Posts: 31
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?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Managed Bean problem
 
Similar Threads
commandLink param problem
connection b/w Two pages
inputText tag not working properly
JSF <h:commandButton action> not working
Simple form: inputText does not reset