primefaces codeMirror doesn't load his own css and js

前提是你 提交于 2019-12-24 16:13:55

问题


I want to use codeMirror from primeface-extension with an sql syntax.

I've got a 404 error when the page who contains this component load. The Css and javascript component not found.

My code is the same as the example from showcase-ext codeMirror.

Using primefaces 5.1 and primefaces-ext 2.1.0.

Does anyone have this problem?

Thank you in advance.

edit:

my jsf:

    <pe:codeMirror id="codeMirror"
    value="#{sandboxBean.content}" lineNumbers="true"/>  

    <p:commandButton actionListener="#{sandboxBean.changeMode}" update="codeMirror"  
             value="Change mode with AJAX" style="margin-top:10px;"/>

my bean:

private String content;  
private String mode = "javascript";  

public void changeMode() {  
    if (mode.equals("css")) {  
        mode = "javascript";  
    } else {  
        mode = "css";  
    }  
}  

public List<String> complete(final CompleteEvent event) {  
    final ArrayList<String> suggestions = new ArrayList<String>();  

    suggestions.add("context: " + event.getContext());  
    suggestions.add("token: " + event.getToken());  

    return suggestions;  
}  

public String getContent() {  
    return content;  
}  

public void setContent(final String content) {  
    this.content = content;  
}  

public String getMode() {  
    return mode;  
}  

public void setMode(final String mode) {  
    this.mode = mode;  
}

The error on my browser console: 404 (Introuvable) for css and js of primefaces component.

The other primefaces component load correctly so i doesn't understand why this one not work.

What's wrong in my code ?


回答1:


I have got the same error and managed to make it work adding resources-codemirror dependency to my pom.xml

    <dependency> 
        <groupId>org.primefaces.extensions</groupId> 
        <artifactId>primefaces-extensions</artifactId> 
        <version>3.2.0</version> 
    </dependency>       
    <dependency>
        <groupId>org.primefaces.extensions</groupId>
        <artifactId>resources-codemirror</artifactId>
        <version>1.2.1</version>
    </dependency>


来源:https://stackoverflow.com/questions/26422935/primefaces-codemirror-doesnt-load-his-own-css-and-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!