jQuery in Action, 3rd edition
The moose likes JSF and the fly likes GET method in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "GET method in JSF" Watch "GET method in JSF" New topic

GET method in JSF

Hussein Baghdadi
clojure forum advocate

Joined: Nov 08, 2003
Posts: 3479

Any way to use get method with JSF apps ?
I don't know what the hell they were thinking, Why they don't support GET method ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

They were thinking "there's a lot of glop that gets passed back and forth on JSF pages and GET has limitations size, so let's use POST".

If what you you really mean is "Why can't I call up JSF pages using Simple URLS?", you have a lot of company, and hopefully, someday someone will come up with a good solution.

It's perfectly permissible to mix ordinary JSPs/servlets and JSF pages in a webapp, however, so you can aways write something that supports GET, even if it's just going to forward to a JSF page.

An IDE is no substitute for an Intelligent Developer.
Gerardo Tasistro
Ranch Hand

Joined: Feb 08, 2005
Posts: 362
John it isn't that bad. You can call a JSF and use GET.

Suppose I want to call a page with eventID=1234 and the jsp file is init.jsp then


Will do the job. Just add the code below the taglib declaration in your JSP.

Now suppose I put a welcome declaration as index.jsp then write this and only this in the index.jsp file

Then you can call


And get the same result. For domain I mean the URL with or without 8080 depending on your config.

Now the handy thing about this is that if the eventID isn't set the eventID setter isn't called. So this gets really interesting for initialization purposes. If my faces is called through "GET" with a valid eventID then the eventID setter is called and I can do initialization steps. On all further requests to the faces the GET params are stripped so initialization is automatically skipped.

But yes JSF still gives me the "oh thats they way they wanted this done, hmmm"
Daniel De Leon

Joined: Jan 30, 2008
Posts: 1
An other option is in JSF on the JSP file.
Set the property before these Tags:
<jsp:root ../>
<jsp:directive.page ../>

<jsp:setProperty name="mySessionBeanLoadedFrom_faces-config.xml_file" property="eventID" />

and you Got it.

- With the power for do it..!
I agree. Here's the link: http://aspose.com/file-tools
subject: GET method in JSF
It's not a secret anymore!