2017-05-19 1 views
0

Primefaces 확장자 CKeditor를 사용하려고하는데 작동하지 못합니다. 그래서 SO에 관한 비슷한 질문은 모두 자원 - 편집인을 포함시키지 않은 것에 기인 한 것입니다. 브라우저에서 자바 스크립트 오류가 발생했을 가능성이 있습니다. 아래 코드는 크기 조절이 가능한 텍스트 영역 상자 만 렌더링합니다. Primefaces CKeditor가 렌더링되지 않습니다

<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:h="http://xmlns.jcp.org/jsf/html" 
     xmlns:pe="http://primefaces.org/ui/extensions" 
     xmlns:f="http://xmlns.jcp.org/jsf/core"> 
    <h:head> 
     <title>Facelet Title</title> 
    </h:head> 
    <f:view> 
    <h:body> 
     <h:form> 
     <pe:ckEditor id="editor" value="Test"> 
     </pe:ckEditor> 
     </h:form> 
    </h:body> 
    </f:view> 
</html> 

이 내가 브라우저

test.xhtml:8 Uncaught ReferenceError: $ is not defined 

얻을 오류 내 POM

<dependency> 
      <groupId>org.primefaces</groupId> 
      <artifactId>primefaces</artifactId> 
      <version>6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.primefaces.extensions</groupId> 
      <artifactId>primefaces-extensions</artifactId> 
      <version>6.1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.primefaces.extensions</groupId> 
      <artifactId>resources-ckeditor</artifactId> 
      <version>6.1.0</version> 
     </dependency> 

입니다 그리고 이것은 브라우저

<h:inputText></h:inputText><textarea id="editor" name="editor">test</textarea><script id="editor_s" type="text/javascript">$(function(){PrimeFaces.cw("ExtCKEditor","widget_editor",{id:"editor",height:"200px",width:"600px",readOnly:false,advancedContentFilter:true});});</script> 
에 출력 관련 HTML 코드

나는 왜 th에 완전히 당혹 스럽다. 모든 것이 옳은 것처럼 보입니다.

+0

'$ is not defined '는 적절한 jQuery 라이브러리를 가져 오는 것을 잊어 버린 것을 의미합니다. – Tiny

+1

@Tiny, 고마워요. JSF 나 Primefaces가 어딘가에서 깨 졌음을 의미합니다. 프레임 워크가이를 처리 할 것으로 생각하기 때문입니다. 그것 또는 Maven은 필요한 종속성을 다운로드하지 않을 수도 있습니다. – JHRS

답변

0

Primeface가 리소스 (js, css)를 헤드에 주입하도록 트리거하려면 페이지에 적어도 1 개의 Primefaces 구성 요소가 있어야한다고 생각합니다.

에 한번 예를

<p:outputLabel style="display:none"/> 

를 들어, 거기에 뭔가를 넣고 네임 스페이스 (xmlns:p="http://primefaces.org/ui")도 추가합니다.

+0

답장을 보내 주셔서 감사합니다. – JHRS

관련 문제