Skip to main content

Can I use JSF 2 to catch a request from a PDF form?

2 replies [Last post]
ukalumni
Offline
Joined: 2010-09-01
Points: 0

I have a project that would like to use as a pilot to start developing in JSF 2, but one of the requirements is that users be able to submit a form from a PDF to the server, and the response to the browser will contain all of the fields that were submitted.

Can this be done? I'm used to working with Servlets where I would have a Servlet instance to catch the request and respond with the fields from the request.

In my limited knowledge of JSF 2, it seems that if you have an HTML form on a page, there is a corresponding backing bean that the form submits to, and they're somewhat tied together.

So my question is, if this is possible with a PDF, where do I submit the form to? I'm afraid I don't yet know enough to properly ask the question.

Thank you for any help.

--Michael

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
andrewlaughlin
Offline
Joined: 2010-03-19
Points: 0

Hi Michael, I'm not sure I understand exactly what you're wanting to accomplish.

Form submission via a PDF is certainly possible. As long as the PDF document can perform an HTTP GET or POST, this part of the process (the submission) will work. Submitting the PDF form to a Servlet will work, or you could submit the form to an .xhtml page. It depends on your particular setup, but XHTML pages are usually processed by the FacesServlet.

As an example, your PDF form could submit to an XHTML page using an HTTP GET request:

http://myDomain.com/myContext/myPage.xhtml?myFormValue=bling

myPage.xhtml would contain a declaration in the body, similar to the following:



where BlingBean is a Java class following the java bean naming convention. The FacesServlet will take the request parameter 'myFormValue' and call the method BlingBean.setNeedBling( "bling" ). Then, in myPage.xhtml you can do this.

#{BlingBean.needBling}

Again, I'm not sure if that's what you're looking for.

Andrew

ukalumni
Offline
Joined: 2010-09-01
Points: 0

Thanks very much for your reply. That is exactly what I was looking for, but I didn't think of submitting to an xhtml page. As I said, this is my first attempt at a JSF project, and I'm still trying to figure it out.

Thanks again.