All JSF actions work by Post unfortunately - you will have to use a normal anchor etc to do a get...
ph34r my 133t j4v4 h4><0r1ng sk177z
Bruce Jin
Ranch Hand
Joined: Sep 20, 2001
Posts: 666
posted
0
Thanks. What is "normal anchor"? Thanks.
Rick Beaver
Ranch Hand
Joined: Dec 14, 2004
Posts: 464
posted
0
Hi
I mean you will have to use a normal "a" tag or another standard HTML navigation method.
You can reference a get URL as a src within a JSF component - for an image for example.
Bruce Jin
Ranch Hand
Joined: Sep 20, 2001
Posts: 666
posted
0
What I meant was that in a servlet doGet() is the entry point where I can retrieve request parameters etc. How to code such a entry point in JSF bean if my JSF is evoked by url instead of POST? Thanks.
Rick Beaver
Ranch Hand
Joined: Dec 14, 2004
Posts: 464
posted
0
Ah, I think I see. So you want to set parameters in your bean via a get instead of a post. To be honest I dont think there is an easy way to do this. There may be a way by querying the FacesContext from your bean but your bean would not actually be able to do anything without a method being called on it - which, in JSF, needs to be done by post.
Can you provide the context of the problem and then it may be easier to provide a workable solution for you?
Michael Valentino
Ranch Hand
Joined: Nov 01, 2005
Posts: 96
posted
0
Been a little while since I used JSF, but I believe you can access the request parameters from the FacesContext (not sure if that's the correct name or not) object. Check the JSF API for the JSF implementation which you're using. This should work regardless of a GET or POST method.
I have a JSF that displays monthly orders. I want to put URL links in regular html page so that each link only gives orders in a particular month:
It seems that bean functions can be associated with JSF tags so that when user clicks submit button these function will be executed. But how to evoke bean functions when JSF is accessed from URL as shown avove?
will probably work. I think there's a cleaner way, but I don't recall it. I've learned to avoid using FacesContext where possible, but sometimes it's not possible.
Customer surveys are for companies who didn't pay proper attention to begin with.
Bruce Jin
Ranch Hand
Joined: Sep 20, 2001
Posts: 666
posted
0
Thanks Tim;
In which bean function do we use FacesContext to get values in queryString? In servlet we have doGet() function. What would be the counterpart of doGet() in JSF?
Thanks.
g madhava
Ranch Hand
Joined: Sep 14, 2001
Posts: 85
posted
0
Based on the code below:
you are going to show to the user the "order.jsp" jsp page. This JSP page needs to interact with the managed bean. Let's say you are displaying "order.jsp" as a table below.
Now you have the JSF Managed Bean declared as "jsf_mb_OrderDisplayBean" in the faces-config.xml corresponding to the class,let's say "com.javaranch.OrderDisplayBean"
This class has a method that "getOrders()" that will display the list of orders
In this method, you can use the code supplied by "Tim Holloway" or my code as below. The one given by "Tim" returns String[].
You ** DO NOT ** need to implement either the doGet() method or either the doPost() method.