在websphere6.1上开发jsf常见问题解决方案

来源:互联网 发布:win10关闭windows聚焦 编辑:程序博客网 时间:2024/06/05 13:32

1)JSF中的JSTL标签没有被正确翻译,一个示例的错误如下:

jsf           W com.sun.faces.renderkit.html_basic.HtmlBasicRenderer getForComponent Unable to find component with ID 'firstNumber' in view.

 

原因:

1)如将servlet容器的规范升级到2.4,因为

Standard-1.1 (JSTL 1.1) requires a JSP container that supports the Java Servlet 2.4 and JavaServer Pages 2.0 specifications.

Standard-1.0 (JSTL 1.0) requires a JSP container that supports the Java Servlet 2.3 and JavaServer Pages 1.2 specifications.

并且

WebSphere Application Server Version 6.0.x supports JavaServer Faces 1.0 at a runtime level.

WebSphere Application Server Version 6.1.x supports JavaServer Faces 1.1 at a runtime level.

 

方法如下:

<?xml version="1.0" encoding="UTF-8"?>   
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">  

<webapp>

 

改为

 

<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  

 

 

2)将下列页面指令加入每个jsp文件的头部

 <%@ page isELIgnored="false" %>

 

3)将以下内容加入到配置文件(具体那个文件,我以后有空研究一下)

<jsp-property-group>
    <el-ignored>false</el-ignored>
</jsp-property-group>

原创粉丝点击