It seems PrimeFaces is returning the real path to the facelet client in order to send autocomplete ajax requests.
1. I created a Servlet to map urlPatterns to a facelets located at /WEB-INF/view/
using
Code: Select all
request.getRequestDispatcher("/WEB-INF/view"+userPath+".faces")
.forward(request, response);
at /WEB-INF/view/faceletClient.xhtml
2. In the facelet client I have a autocomplete element initialized as follows:
Code: Select all
<p:autoComplete id="countryCode" value="#{CountryBean.text}" completeMethod="#{CountryBean.complete}" maxResults="100"/>
Code: Select all
public List<String> complete(String query) {
List<String> results = new ArrayList<String>();
List<Country> queryResults = countryFacade.findByName(query);
for (int i = 0; i < queryResults.size(); i++) {
results.add(queryResults.get(i).getCountry());
}
return results;
}
http://localhost.8080/myapp/admin/faceletClient
5. I looked at the source code where the autocomplete widget is declared and realized it is using /WEB-INF/view/faceletClient.faces as the request url.
Obviously this url is unaccessible to ajax requests and autocomplete will never populate.
On the contrary, if the faceletClient.xhtml is located in the webroot, url is well formed and the requests are done correctly.
Is there any way I can get this url to point to the url pattern that is recognized by the servlet?
Should I completely abandon the Idea of using Servlets as controllers for my application?
I am using PrimeFaces v2.2.1, Mojarra JSF implementation
In addition to PrimeFaces I am using only smoothness.jar and mysql/j connector libraries
Application server is glassfish 3.1, I am using servlet 3.0
Any advice is appreciated!