Announcement Announcement Module
Collapse
No announcement yet.
booking-faces sample app and PrimeFaces autoComplete Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • booking-faces sample app and PrimeFaces autoComplete

    I'm running the booking-faces sample that ships with WebFlow 2.3.1 - already uses PrimeFaces component library.

    Now I'm trying to incorporate the PrimeFaces autoComplete component and I cannot get it to work. The component loads on the page but no suggestions appear when I type into it. The suggestions are supposed to come from my backing bean. I've put a breakpoint in my backing bean method and it never hits.

    Can anyone help?

    I opened the Chrome JavaScript console to see what requests/responses were flowing and found the following response returned whenever I typed into the autoComplete field:
    Code:
    <partial-response><error><error-name>class com.sun.faces.context.FacesFileNotFoundException</error-name>
    <error-message><![CDATA[/WEB-INF/WEB-INF/test.xhtml Not Found in ExternalContext as a Resource]]></error-message></error></partial-response>
    Any ideas where things are broken? Thanks.

    PrimeFaces version: 3.1.1
    JSF version: Mojarra 2.1.7-jbossorg-2 (20120412-0335)
    AppServer: Jboss AS 7.1.2
    Spring framework version: 3.1.1
    Spring WebFlow version: 2.3.1

    I added an EL resolver to my faces-config.xml (I'm assuming this is necessary; why was it not in there already??):
    Code:
    <application>
    	<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
    	<message-bundle>JsfMessageResources</message-bundle>
    </application>
    Here's a snippet from test.xhtml
    Code:
    <h:form>
       <p:growl id="messages" showDetail="true" />
       <p:autoComplete value="#{scheduleBean.text}" completeMethod="#{scheduleBean.complete}" />
    </h:form>
    And here's my bean:
    Code:
    import org.springframework.stereotype.Component;
    import org.springframework.web.context.WebApplicationContext;
    
    @Component
    @Scope(WebApplicationContext.SCOPE_SESSION)
    public class ScheduleBean {
    
        private String text;
    
        public ScheduleBean() {
        }
    
        public List<String> complete(String query) {
       List<String> results = new ArrayList<String>();
       for (int i = 0; i < 10; i++)
           results.add(query + i);
       return results;
        }
    
        public String getText() {
       return text;
        }
    
        public void setText(String text) {
       this.text = text;
        }
    }
    Last edited by redparham; Jul 8th, 2012, 05:39 PM. Reason: adding tags
Working...
X