JSF, automatic execution of backing bean action

M

Micke

Hi,
I am new to JSF and can not quite figure out how to solve the following
problem.

I would like to be able to call JSF like a servlet, by having the
request parameters mapped to a managed bean in request scope. Then have
an action executed automatically which processes the request parameters
and returns control to an ordinary JSF page. It would be nice to have
the action prepare the data to be displayed, and then have a normal JSF
page display it.

Example of the URL style I am thinking of:
http://www.hello.com/tool/getJob.jsf?id=abracadabra&tool=toolname&sorting=col2

(This would only be a small part of a larger applicaton, otherwise I
would have used a servlet to do this.)

Is it at all possible and sane to use JSF in this way.
Other stategy:

Thank you, Mikael
 
H

HGA03630

I think your problem could be readily solved by a proper
navigation-rule
entry in your faces-config.xml.
request parameters mapped to a managed bean
<h:textInput id="abracadabra" value="myBackingBean.foo" ..... />
 
M

Micke

Hi,
the thing is that I don't want the user to have to click on a link, but
have and action method on a backing bean be i invoked without the user
having to do anything. I also was thinking I could wire the request
parameters to the backing bean in the faces-config.xml file (when I set
up the managed bean).

Thanks, Mikael
 
H

HGA03630

Micke ã®ãƒ¡ãƒƒã‚»ãƒ¼ã‚¸:
Hi,
the thing is that I don't want the user to have to click on a link, but
have and action method on a backing bean be i invoked without the user
having to do anything. I also was thinking I could wire the request
parameters to the backing bean in the faces-config.xml file (when I set
up the managed bean).

Thanks, Mikael
If the component is a <h:inputText />, you could use some attributes
including valueChangeListener, converter, validator and variety of
onXXXXXs. In some cases you could even use setter methods for bean
properties to do something. Wiring the request parameter to the backing
bean will also be done via simple EL expression on the JSF component.
 
M

Micke

Hi,
thanks for you replies, but I'm not sure they solve my problem.

I want the example URL to execute Java logic immediately without the
user having to press a link or button, just like when calling an
ordinary servlet (doPost() ). I don't think your proposals help me do
that, do they?

Cheers, Mikael
 
Joined
Jan 7, 2011
Messages
1
Reaction score
0
Hi,

Did someone find a way to do this?
I have the exact same problem!

Thank you,

Remy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top