学习jsf过程中遇到页面将el表达式当做字符串的解决办法。
2010-08-26 09:51
363 查看
今天做了一个jsf的小例子,什么写的都一样但是我的<f:inputText value="#{user.name}"
这里边el:"#{user.name}当成字符串使用了。
在网上找了一些文章可是不试用
找了很长时间终于找到了。
我用的是myeclipse 6.0+ jdk 1.6+tomcat6.0
我做的这个例子的jar包都是在jsf教程上下的,所以才出这样的问题,如何你是在 用myeclipse引JSF的话可以就不会出错了.
如何还出错的话那你在看看是不是和我出一样的错.
<!--
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-->
这样是不行的.
------------------------------------------------------------------------------------
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
这样是正确的
---------------------------------------------------------------------------------------
如何你是用tomcat 6.0的话,你改完web.xml的话。要把tomcat 下/work/Catalina的文件册掉,把tomcat 你的项目删掉,在引进,重启tomcat就行了.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--
-->
<description>JSF Demo</description>
<display-name>JSF Demo</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-cofnig PUBLIC
"-//sun Microsystems,Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-cofnig>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>
jing.lian.kui.bean.UserBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-cofnig>
这里边el:"#{user.name}当成字符串使用了。
在网上找了一些文章可是不试用
找了很长时间终于找到了。
我用的是myeclipse 6.0+ jdk 1.6+tomcat6.0
我做的这个例子的jar包都是在jsf教程上下的,所以才出这样的问题,如何你是在 用myeclipse引JSF的话可以就不会出错了.
如何还出错的话那你在看看是不是和我出一样的错.
<!--
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-->
这样是不行的.
------------------------------------------------------------------------------------
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
这样是正确的
---------------------------------------------------------------------------------------
如何你是用tomcat 6.0的话,你改完web.xml的话。要把tomcat 下/work/Catalina的文件册掉,把tomcat 你的项目删掉,在引进,重启tomcat就行了.
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-->
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--
-->
<description>JSF Demo</description>
<display-name>JSF Demo</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.faces</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-cofnig PUBLIC
"-//sun Microsystems,Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-cofnig>
<navigation-rule>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>login</from-outcome>
<to-view-id>/welcome.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>
jing.lian.kui.bean.UserBean
</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-cofnig>
相关文章推荐
- iOS 学习笔记二【cocopods安装使用和安装过程中遇到的问题及解决办法】
- 自己学习Struts2过程中遇到的问题及解决办法(第一天)
- CSS学习过程中遇到的问题及解决办法
- 记录linux学习过程中,遇到的问题与解决办法
- 【转】EVC学习过程中遇到的错误以及解决办法总结
- 转载一些学习centOS过程中会遇到的问题及解决办法
- (转)EVC学习过程中遇到的错误以及解决办法总结
- 学习H5页面遇到的一些问题与解决办法汇总
- shell在进行字符串截取的过程中,报的错bad substitution 解决办法
- 小白学习Hibernate遇到的错误以及解决办法(GenerationTarget encountered exception accepting command : Error executing)
- ASIHTTPRequest使用过程中遇到的问题及解决办法
- numpy scipy 安装过程遇到的问题及解决办法
- Git 使用过程中遇到的问题以及解决办法
- repo使用过程中遇到的一些问题及解决办法
- ASIHTTPRequest使用过程中遇到的问题及解决办法
- 学习VC、MFC中遇到的各种问题及解决办法
- 学习两天Vue.js遇到的问题及解决办法。
- jsp页面中EL表达式被当成字符串处理不显示值问题的解决方法
- JSON(3):Java的Date类型转换为符合json语法的字符串遇到的问题及其解决办法
- Jenkins遇到问题一:jenkins配置权限不对导致无法登陆或者空白页面解决办法