有JavaServer Faces高手吗?遇到麻烦了,急!!!

05-12-12 diven_net
我下载了jsf-1_1_01压缩包,把里面的LIB目录下的JAR文件拷贝到了TOMCAT5.5的../WEB-INF/lib/下,编译的时候出现错误:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /validatorTest.jsp(8,1) No tag "use_faces" defined in tag library imported with prefix "f"

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)

org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)

org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:196)

org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1317)

org.apache.jasper.compiler.Parser.parseElements(Parser.java:1573)

org.apache.jasper.compiler.Parser.parse(Parser.java:126)

org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)

org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)

org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:146)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)

com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)

com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)

com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)

com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)

javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)

note The full stack trace of the root cause is available in the Apache Tomcat/5.5.12 logs.

还有JAR文件没有关联进来,但jsf-1_1_01压缩包也就那么几个JAR文件?该怎么弄啊........

恳请留下您的QQ,谢谢!!!

diven_net
2005-12-12 20:06
我把jakarta-taglibs-standard-1.1.2 和jsf-1_1_01目录下的lib目录下的jar都拷到了Web项目的WEB-INF/lib下

报这个错误:org.apache.jasper.JasperException: /validatorTest.jsp(8,1) No tag "use_faces" defined in tag library imported with prefix "f"

代码:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<html>

<head>

<title>Validator Test</title>

</head>

<body>

<f:use_faces>

<h:form formName="myForm">

Enter a minimum of 6 characters here:

<h:input_text>

<f:validate_length minimum="6"/>

</h:input_text>

<br/>

<h:commad_button label="Submit" commandName="submit"/>

<br/>

<h:output_errors>

</h:form>

</f:use_faces>

</body>

</html>

怎么会没着标签呢,是书上的例子啊,这书h 和f标签是不是都弄错了,还是版本太老?《JavaServer Faces编程》(美)Budi Kurniawan 著 清华大学出版社

diven_net
2005-12-12 20:07
怎么代码看不到?

这书的标签都写成:<f:use_faces> <f:validate_length><h:input_text>

diven_net
2005-12-12 20:11

//
<f:use_faces>
<h:form formName="myForm">
    Enter a minimum of 6 characters here:
   <h:input_text><f:validate_length minimum="6"></h:input_text>
<br/>
<h:command_button label="submit" commandName="submit"/>
<br/>
<h:output_errors/>
</h:form>
</f:use_faces> 

<p>

diven_net
2005-12-12 20:25

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<html>
<head>
<title>Validator Test</title>
</head>
<body>
 <f:view>
   <h:form>
      Enter a minimum of 6 characters here:
	  <h:inputText>
	    <f:validateLength minimum="6"/>
	  </h:inputText>
	  <br/>
	  <h:commandButton value="Submit" />
	  <br/>
  </h:form>
 </f:view>
</body>
</html>

通过修改终于可以执行了,不过显示错误消息的该是哪个标签呢?

难道那本书真的搞错了?还是 2005年1月第一次印刷 的,其实这书讲的挺好的,怎么会把标签弄错了呢...........

哪位前辈推荐几本好书吧.................

banq
2005-12-13 10:26
这么简单的标签怎么错?可能是你的标签库之前没有引入正确。

diven_net
2005-12-13 11:32

<f:use_faces><h:form formName="myForm">    Enter a minimum of 6 characters here:   <h:input_text><f:validate_length minimum="6"></h:input_text><br/><h:command_button label="submit" commandName="submit"/><br/><h:output_errors/></h:form></f:use_faces> 

标签库都引入正确,书上这个标签怎么这样写的,这和类库的文档也不一样

另外一本书上是这样写的:

<f:view>   <h:form>      Enter a minimum of 6 characters here:	  <h:inputText>	    <f:validateLength minimum="6"/>	  </h:inputText>	  <br/>	  <h:commandButton value="Submit" />	  <br/>  </h:form> </f:view>

lijinlinlin
2005-12-13 20:42
<f:use_faces>
<h:input_text>
<p>

这些标签如果没有印错的话,应该使用的是自定义标签吧,JSF自带的标签里好像是没这些吧。

要使用自定义标签,也要把自定义标签放到相应目录下的

diven_net
2005-12-14 19:16
郁闷啊,大家进这个页面看看,好象也不是自定义标签,越来越昏了.......

进这里查看

blueoxygen
2005-12-16 10:31
显然是tomcat5.5的毛病。

你换成5.0.x跑跑,绝对没问题。

自己英文google一下。

njava
2005-12-16 14:18
<f:use_faces>

这种写法是测试阶段(1.0版本)的

1.1是<f:view>写法

好好看看吧

njava
2005-12-16 14:19

<f:use_faces><h:input_text>

这种是1.0的写法

diven_net
2005-12-20 17:22
我想应该也是1.0版本的写法

猜你喜欢