1

I have a Java-EE application that works with JSF (ManagedBean, ManagedProperty, ect ...) and Spring framework. I need to be able to retrieve data via a javascript form sent from an external website. I have opened the rights to authorize the CORS (Cross Origin or Cross Domain).

I would like to know what is the best way to grab an external form with JSF so that it is processed by my ManagedBean.

To make my question more explicit I made a diagram

==============
EDIT
The application works with JSF, I'm looking for a way to retrieve data (from a Javascript form on an external site) in a ManagedBean under JSF. I tried to retrieve this data by creating a Java-EE standard servlet and using the doPost ... methods of HttpServlet. But this solution does not work (this was the subject of my previous question on S.O). Several people told me that in a web application do not mix Java-EE standard and JSF, it is either Servlet or JSF. I made a diagram (above) explaining quickly what I am trying to do.

To recap: I would like to retrieve data from an external website (via a Javascript form) in the ManagedBean of my application.

==============

I've already tried with a standard Java-EE servlet but it's not the right way. Indeed, with a standard servlet I can recover the data from the form but I can not access the ManagedBean. I must therefore have abandoned this hypothesis.

I did not find a similar question about Stackoverflow, If necessary I can give more indications.

Thank you for your help.

  • 'Best'; way is opinion based and hence not a question for Stackoverflow. It should however work with servlets (with preconditions), it could work with a separate rest api, it could work with bookmarkable urls (https://stackoverflow.com/questions/13249844/bookmarkability-via-view-parameters-feature) so several options... – Kukeltje Jul 25 '17 at 12:41
  • You are right, 'Best way' is not suitable but I am looking for a solution to set up to solve my problem or at least one track. I changed the title –  Jul 25 '17 at 12:45
  • There are still several options... As mentioned in my first comment. Search for them. Or post the specific problem you had using a servlet... – Kukeltje Jul 25 '17 at 12:54
  • What preconditions do you speak about servlets ? I've already tried with a standard Java-EE servlet. With a standard servlet I can recover the data from the form but I can not access the ManagedBean. Bookmarkable urls do not seem to be a solution to my problem. –  Jul 25 '17 at 13:20
  • You can get the data from the request in the servlet you mean (instead of 'recover from the form, since there is no form in a servlet). And _"I cannot access the ManagedBean"_ means you do something wrong: https://stackoverflow.com/questions/20244697/accessing-a-session-scoped-jsf-managed-bean-in-a-servlet-is-this-guaranteed-to or https://stackoverflow.com/questions/3578622/accessing-a-jsf-managedbean-from-a-servlet and bookmarkable urls is what the topic is called, the priciple behind it can be used to pre-populate forms to... – Kukeltje Jul 25 '17 at 13:27
  • The [spring] tag adds too much ambiguity to the question. What exactly is it being used for? Managing beans? So you don't have JSF managed beans in first place? – BalusC Jul 25 '17 at 14:37
  • You are right @BalusC I have brought some explanations. Thank you for your help –  Jul 25 '17 at 14:57

0 Answers0