This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF Project: How to submit data to and process with Faces Servlet without form? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Project: How to submit data to and process with Faces Servlet without form?" Watch "JSF Project: How to submit data to and process with Faces Servlet without form?" New topic
Author

JSF Project: How to submit data to and process with Faces Servlet without form?

J. Frederik
Greenhorn

Joined: Mar 06, 2013
Posts: 16
I have a CommandButton that executes "onclick" some javascript that does a client side Google Maps request.
Now I want the Callback function to forward the response to my server via an AJAX request.

I know how I can submit a form via Javascript


But how can I do it without a form?

And how can I make the Faces Servlet process this request (in Java) in a certain way?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

I think you're over-concerned about the FacesServlet.

JSF is not a jealous platform. If you have something that needs doing that doesn't benefit from JSF, don't ram it through JSF. A classic example of that is when people want to produce PDF or spreadsheet documents. I'm constantly cautioning people that a plain old servlet is better for that part of the webapp than hijacking the internals of JSF. Sometimes they even listen to me. :cool:


Customer surveys are for companies who didn't pay proper attention to begin with.
J. Frederik
Greenhorn

Joined: Mar 06, 2013
Posts: 16
Thank you for your answer.
Of course this is still connected to JSF. But using an extra servlet I do not see the possibility to create validation messages for example as the FacesContext is missing.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

If what you are looking to do is embed a Google Map in a JSF page and make it so that acting on the map (via JavaScript) initiates actions on the server via JSF, that's OK. I actually have such an app, in fact. You click on points on the map and the location gets posted to a database via JSF.

However, the primary architectural constraint is that not only JSF, but HTTP itself requires a form. While you could issue a straight HTTP GET request via AJAX without a form, that doesn't give the benefits that a full JSF form postback would.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF Project: How to submit data to and process with Faces Servlet without form?
 
Similar Threads
AJAX handle struts success/failure
Checking a href value in servlet
Request dispatcher doesn't redirect to the jsp page
Servlet processing termination
JWS - A Good Way To Demo Apps