3

I am trying to use the primefaces-extensions ckEditor in my JSF application, as described here. I added the dependency to my pom.xml:

<dependency>
 <groupId>org.primefaces.extensions</groupId>
 <artifactId>primefaces-extensions</artifactId>
 <version>4.0.0</version>
</dependency>

This is how my view looks like:

<p:growl id="editorgrowl" showDetail="true" />
<pe:ckEditor id="editor" value="#{mbEditorController.content}"
 toolbar="[['Cut','Copy','Paste','PasteText','PasteFromWord','-', 'SpellChecker', 'Scayt']]">
 <p:ajax event="save"
 listener="#{mbEditorController.saveListener}"
 update="editorgrowl" />
</pe:ckEditor>

This is the controller (managed bean):

@ManagedBean(name = "mbEditorController")
@ViewScoped
public class EditorView implements Serializable {
 private static final long serialVersionUID = 6822767317343704211L;
 private String content;
 private String secondContent;
 public EditorView() {
 content = "Type in your text here...";
 secondContent = "This is a second editor";
 }
 public void saveListener() {
 content = content.replaceAll("\\r|\\n", "");
 final FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Content",
 content.length() > 150 ? content.substring(0, 100) : content);
 FacesContext.getCurrentInstance().addMessage(null, msg);
 }
 public void secondSaveListener() {
 secondContent = secondContent.replaceAll("\\r|\\n", "");
 final FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Second Content",
 secondContent.length() > 150 ? secondContent.substring(0, 100) : secondContent);
 FacesContext.getCurrentInstance().addMessage(null, msg);
 }
 // getters, setters
}

Unfortunately I can't see a toolbar, but just a text input area, as you can see in the following screenshot:

Missing toolbar in ckEditor

UPDATE

There is a javascript error in my console:

http://localhost:8080/MyApp/javax.faces.resource/ckeditor/ckeditor.js.xhtml?ln=primefaces-extensions&v=4.0.0 Failed to load resource: the server responded with a status of 404 (Not Found)

What could cause the problem? Am I missing something?

Jasper de Vries
20.4k6 gold badges68 silver badges107 bronze badges
asked May 30, 2016 at 7:35
4
  • 1
    Can you see any javascript errors in the console? Commented May 30, 2016 at 7:40
  • @tak3shi: Yes! Sorry, I should have do it before posting. But I still don't know, why it happens. Can you help? Updated my post. Commented May 30, 2016 at 7:53
  • Another hint can be found in your server log: Unable to find or serve resource, ckeditor/ckeditor.js, from library, primefaces-extensions. Commented Sep 16, 2016 at 13:58
  • Possible duplicate of Using ckeditor in jsf page Commented Sep 16, 2016 at 14:24

1 Answer 1

3

Add the following dependency:

<dependency>
 <groupId>org.primefaces.extensions</groupId>
 <artifactId>resources-ckeditor</artifactId>
 <version>4.0.0</version>
</dependency>
answered May 30, 2016 at 12:33
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much tak3shi! I was missing this.
Why oh why isn't this the first line in the showcase!? For 6.0.0 this is also required.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.