开发者

Problem with PrimeFaces taglib in using JSF

开发者 https://www.devze.com 2023-02-24 01:05 出处:网络
I downloaded and added primefaces-3.0.M1.jar file to my project. Then, I added this code to my JSP page:

I downloaded and added primefaces-3.0.M1.jar file to my project.

Then, I added this code to my JSP page:

<%@ taglib uri="http://primefaces.prime.com.tr/ui" prefix="p" %>

But it gives the error:

Can not find the tag library descriptor for "h开发者_开发知识库ttp://primefaces.prime.com.tr/ui"

Can anyone guide me how to overcome this problem?


In the primefaces forum there are some comments that Primefaces 2.x and above won't work with JSP. Use Facelets instead.

A facelet page using primefaces looks like this:

    <?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:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:p="http://primefaces.prime.com.tr/ui">
      <h:head>
        ... put your header info here
      </h:ead>
      <h:body>
        .. put your content here
      </h:body>
    </html>

There are some more things to pay attention to if you want to switch from jsp to facelets. I think you start reading some tutorials or this related question and answers.


You could try the following workaround:

<% response.setContentType("application/xhtml+xml"); %>


just add primefaces to your project buildpath.

Problem with PrimeFaces taglib in using JSF

0

精彩评论

暂无评论...
验证码 换一张
取 消