[jboss-user] [JBoss Eclipse IDE (users)] - javax.servlet.ServletException: Cannot get value for express
tahirakramch
do-not-reply at jboss.com
Fri Aug 4 05:46:18 EDT 2006
I m having problem with running of my JSP page which is calling managed bean properties. I dont know wht thing is missing but I hope with review of u ppl I will got the solution..
convert.jsp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
| <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
| <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
| <html>
| <head>
| </head>
| <body>
| <f:view>
| <html>
| <head>
| <title>Celsius converter</title>
| </head>
| <body>
| <h1>Celcius Convertersss</h1>
| <hr>
| <h:form>
| <h:inputText value="#{pageBean.celsius}" />
| <h:outputText value="Celsius" /><br/>
| <h:outputText value="#{pageBean.fahrenheit}" />
| <h:outputText value="Fahrenheit" /><br/>
| <h:commandButton value="Convert" action="#{pageBean.convertToFahrenheit}" />
|
| </h:form>
| </body>
| </html>
| </f:view>
|
| </body>
| </html>
faces-config.xml:
<?xml version="1.0"?>
| <!DOCTYPE faces-config PUBLIC
| "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
| "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
|
| <faces-config>
| <!--Now this config file is empty-->
|
|
| <managed-bean>
| <managed-bean-name>pageBean</managed-bean-name>
| <managed-bean-class>jsfbean.PageBean</managed-bean-class>
| <managed-bean-scope>request</managed-bean-scope>
| </managed-bean>
|
| </faces-config>
|
PageBean:
package jsfbean;
|
| public class PageBean {
| private Double celsius = null;
| private Double fahrenheit = null;
|
| public PageBean(){
| }
|
| public void setCelsius(Double celsius){
| this.celsius = celsius;
| }
|
| public Double getCelsius(){
| return celsius;
| }
|
| public void setFahrenheit(Double fahrenheit){
| this.fahrenheit = fahrenheit;
| }
|
| public Double getFahrenheit(){
| return fahrenheit;
| }
|
| public void convertToFahrenheit(){
| setFahrenheit(new Double(getCelsius().doubleValue() * 1.8 + 32));
| }
| }
|
web.xml:
<?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">
| <web-app>
| <display-name>The simplest JSF application.</display-name>
| <servlet>
| <servlet-name>Faces Servlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| </servlet>
| <servlet-mapping>
| <servlet-name>Faces Servlet</servlet-name>
| <url-pattern>*.jsf</url-pattern>
| </servlet-mapping>
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
| </web-app>
|
Please share if u have solve this problem....
Thx
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963126#3963126
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963126
More information about the jboss-user
mailing list