[PJUG Javamail] problem getting JSF to work on NB 6.7.1 - PLEASE HELP
Michael Phoenix
michaelandrewphoenix at gmail.com
Wed Sep 16 21:22:49 EDT 2009
OK, got it. Apparently the problem was the form attribute
enctype="multipart/form-data". The app I cloned this from was doing
some file uploading and required it. Apparently when you don't set up
all the filters associated with file uploads properly, this attribute
causes the problem I was experiencing.
On Wed, Sep 16, 2009 at 1:55 PM, Michael Phoenix
<michaelandrewphoenix at gmail.com> wrote:
> Still having problems here can somebody please help? It is really
> frustrating because I have written apps like this before in fact I
> used one as a model to create an even simpler app and still can't get
> it to work. I ran it through the debugger and it stops in the
> constructor so it looks like the bean object is being created, but the
> setUid method and the testit method are not being entered when I click
> on the enter commandbutton. Can somebody PLEASE give me an idea as to
> what might be going on? I am totally stumped and this is holding up
> some important work I need to get done. Any help would be greatly
> appreciated:
>
> web.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
> <context-param>
> <param-name>com.sun.faces.verifyObjects</param-name>
> <param-value>false</param-value>
> </context-param>
> <context-param>
> <param-name>com.sun.faces.validateXml</param-name>
> <param-value>true</param-value>
> </context-param>
> <context-param>
> <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
> <param-value>client</param-value>
> </context-param>
> <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>
> <session-config>
> <session-timeout>
> 30
> </session-timeout>
> </session-config>
> <welcome-file-list>
> <welcome-file>faces/welcomeJSF.jsp</welcome-file>
> </welcome-file-list>
> </web-app>
>
>
> faces-config.xml:
>
> <?xml version='1.0' encoding='UTF-8'?>
>
> <!-- =========== FULL CONFIGURATION FILE ================================== -->
>
> <faces-config version="1.2"
> xmlns="http://java.sun.com/xml/ns/javaee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
> http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
>
>
> <managed-bean>
> <managed-bean-name>testbean</managed-bean-name>
> <managed-bean-class>com.lingosys.quoteest.testbean</managed-bean-class>
> <managed-bean-scope>session</managed-bean-scope>
> </managed-bean>
>
> <navigation-rule>
> <from-view-id>/go.jsp</from-view-id>
> <navigation-case>
> <from-outcome>correct</from-outcome>
> <to-view-id>/ok.jsp</to-view-id>
> <redirect/>
> </navigation-case>
> </navigation-rule>
>
> </faces-config>
>
> go.jsp:
>
> <%@page contentType="text/html" pageEncoding="UTF-8"%>
>
> <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
> <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
>
> <%--
> This file is an entry point for JavaServer Faces application.
> --%>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
> <title>JSP Page</title>
> </head>
> <body>
> <f:view>
> <h1>JAS Generator</h1>
> <p/>
> <h:form id="testForm" enctype="multipart/form-data" >
> <p/>Both fields are required.
> <p/>Enter Test ID: <h:inputText id="pid"
> value="#{testbean.uid}" required="true"/>
> <p/><h:commandButton value="Enter"
> action="#{testbean.testit}"/>
> </h:form>
> </f:view>
> </body>
> </html>
>
> testbean.java:
>
> /*
> * To change this template, choose Tools | Templates
> * and open the template in the editor.
> */
>
> package com.lingosys.quoteest;
>
> /**
> *
> * @author mphoenix
> */
> public class testbean {
> private String uid;
>
> public testbean() {
> int x=0;
> }
>
> public String getUid() {
> return uid;
> }
>
> public void setUid(String uid) {
> this.uid = uid;
> }
>
> public String testit() {
> return "correct";
> }
> }
>
More information about the Javamail
mailing list