submit twice ?

Hello all.

I'm writing a jsf app that takes an input form, validates it, and then

forwards the user to a confirmation page.

Pretty straightforward, very similar to jsf tutorials.

However, once I added selectOneMenu items, I now find

myself having to submit the form twice before getting the

confirmation page.

The selectOneMenu items do have valueChangeListener

routines in the backing bean, because if I did not include

those, it would not return the value selected in the drop-down

boxes.

The form is submitted by a commandButton, which calls a

validate() routine in the backing bean, which returns null if

not validated or 'success' if validated, which should then

forward the browser to the confirm page.

I put System.out.println() messages in the valueChangeListener

as well as the validate() routine, and the first submit shows the

messages in valueChangeListener, the second shows the validate()

routine messages.

Maybe I'm missing something in the lifecycle order that may

cause this, but I have not been able to make it work right.

Has anyone come across this behavior in jsf ?

If anyone is interested, I can email a jar with the source,

xml (faces-config.xml, web.xml), and jsp files.

There seems no way to attach it in the forums.

I can, however, post snippets of how I code the drop-downs:

jsp file:

<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">

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

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

........

<td align="left">

<h:selectOneMenu value="#{data.state}"

valueChangeListener="#{data.stateSelected}">

<f:selectItems value="#{data.statelist}"/>

</h:selectOneMenu>

</td>

.........

java source:

(drop-downs populate fine......)

........

public Collection getStatelist(){

//System.out.println(getLogtime() + "DataBean: getStates()");

if (sdata==null)

{

try{

populateStates();

}catch(SQLException sqlEx){

logger.log(Level.SEVERE,"loginAction", sqlEx);

}catch(NamingException nameEx){

logger.log(Level.SEVERE,"loginAction", nameEx);

}catch(Exception Ex){

System.out.println(getLogtime() +"DataBean: getStates() Exception!");

//System.out.println(" nbr of state records: [" + sdata.size() + "]");

System.out.println("msg: [" + Ex.getMessage() +"]");

//return sdata;

}

}

//System.out.println(getLogtime() + "DataBean: nbr of State records: [" + sdata.size() + "]");

return sdata;

}

publicvoid populateStates()

throws SQLException, NamingException

{

//System.out.println("DataBean: populateStates()...");

//ctx = new InitialContext();

ctx =new InitialContext(System.getProperties());

if(ctx==null){

thrownew NamingException("DataBean: No initial context");

}

ds = (DataSource)ctx.lookup("java:/comp/env/jdbc/testdataDS");

if(ds==null){

System.out.println("DataBean: no data source!!");

thrownew NamingException("No data source");

}

//System.out.println("DataBean: getConnection...");

try{

conn = ds.getConnection();

if(conn==null){

System.out.println("DataBean: no connection!!");

thrownew SQLException("DataBean: No database connection");

}else{

PreparedStatement dataQuery = conn.prepareStatement(

"SELECT state_code, state_name FROM state ORDER BY state_code");

ResultSet result = dataQuery.executeQuery();

sdata =new ArrayList();

sdata.add(new SelectItem(" ","Please select one"));

if(!result.next()){

return;

}else{

sdata.add(new SelectItem(result.getString("state_code")

,result.getString("state_name")));

while(result.next()){

sdata.add(new SelectItem(result.getString("state_code")

,result.getString("state_name")));

}

}

}

}catch(SQLException se){

System.out.println("DataBean: populateStates() - connection/statement/execute : ");

System.out.println("message: [" + se.getMessage() +"]");

//se.printStackTrace();

// look at the warnings issued it should help you resolve the problem

SQLWarning warning =null;

try{

// Get SQL warnings issued

//warning = conget.getWarnings();

warning = (SQLWarning)se.getNextException();

if (warning ==null){

System.out.println("DataBean: populateStates()could not get sql warnings");

}else{

//while (warning != null) {

System.out.println("DataBean populateStates() - Warning: " + warning);

//warning = warning.getNextWarning();

//warning = (SQLWarning)se.getNextException();

//}

}

}catch (Exception we){

System.out.println("DataBean populateStates() - SQLException !!");

System.out.println("msg: [" + we.getMessage() +"]");

}

sdata =new ArrayList();

}catch (Exception e){

System.out.println("DataBean: populateStates() lookup exception:");

System.out.println(" msg: [" + e.getMessage() +"]");

e.printStackTrace();

sdata =new ArrayList();

}finally{

conn.close();

}

}

..........

faces-config.xml:

<?xml version='1.0' encoding='UTF-8'?>

<!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>

<application>

<locale-config>

<default-locale>en</default-locale>

<supported-locale>en</supported-locale>

<supported-locale>en_US</supported-locale>

<!-- supported-locale>de</supported-locale -->

</locale-config>

<!-- message-bundle>

de.laliluna.tutorial.messageresource.MessageResources

</message-bundle -->

</application>

<!-- managed beans of the simple hello world app -->

<managed-bean>

<managed-bean-name>data</managed-bean-name>

<managed-bean-class>edu.msu.hit.data.DataBean</managed-bean-class>

<managed-bean-scope>session</managed-bean-scope>

</managed-bean>

<!-- Navigation rules -->

<navigation-rule>

<description>Test select one page</description>

<from-view-id>/testSelectOnePage.jsp</from-view-id>

<!-- navigation-case>

<from-outcome>ticketsfailure</from-outcome>

<to-view-id>/ticketsonline.jsp</to-view-id>

</navigation-case -->

<navigation-case>

<from-outcome>success</from-outcome>

<to-view-id>/testSelectOneConfirm.jsp</to-view-id>

</navigation-case>

</navigation-rule>

</faces-config>

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>MyFaces Demo</display-name>

<description>a Myfaces demo page</description>

<!-- Listener, that does all the startup work (configuration, init). -->

<!-- listener>

<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>

</listener -->

<!-- Faces Servlet -->

<servlet>

<servlet-name>Faces Servlet</servlet-name>

<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<!-- Faces Servlet Mapping -->

<servlet-mapping>

<servlet-name>Faces Servlet</servlet-name>

<url-pattern>*.faces</url-pattern>

</servlet-mapping>

<resource-ref>

<description>Sybase Datasource resource</description>

<res-ref-name>jdbc/testdataDS</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

<welcome-file-list>

<welcome-file>index.html</welcome-file>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

<context-param>

<param-name>com.sun.faces.validateXml</param-name>

<param-value>false</param-value>

<description>

Setthis flag totrueif you want the JavaServer Faces

Reference Implementation to validate the XML in your

faces-config.xml resources against the DTD. Default

value is false.

</description>

</context-param>

<context-param>

<param-name>log4jConfigLocation</param-name>

<param-value>/WEB-INF/log4j.properties</param-value>

</context-param>

<!-- context-param>

<param-name>javax.faces.CONFIG_FILES</param-name>

<param-value>

/WEB-INF/faces-config.xml

</param-value>

<description>

Comma separated list of URIs of (additional) faces config files.

(e.g. /WEB-INF/my-config.xml)

See JSF 1.0 PRD2, 10.3.2

</description>

</context-param -->

<context-param>

<param-name>javax.faces.STATE_SAVING_METHOD</param-name>

<param-value>client</param-value>

<description>

State saving method:"client" or"server" (=default)

See JSF Specification 2.5.2

</description>

</context-param>

<context-param>

<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>

<param-value>true</param-value>

<description>

This parameter tells MyFacesif javascript code should be allowed in the

rendered HTML output.

If javascript is allowed, command_link anchors will have javascript code

that submits the corresponding form.

If javascript is not allowed, the state saving info and nested parameters

will be added as url parameters.

Default:"true"

</description>

</context-param>

<context-param>

<param-name>org.apache.myfaces.PRETTY_HTML</param-name>

<param-value>true</param-value>

<description>

If true, rendered HTML code will be formatted, so that it is"human readable".

i.e. additional line separators and whitespace will be written, thatdo not

influence the HTML code.

Default:"true"

</description>

</context-param>

<context-param>

<param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>

<param-value>false</param-value>

</context-param>

<context-param>

<param-name>org.apache.myfaces.AUTO_SCROLL</param-name>

<param-value>true</param-value>

<description>

If true, a javascript function will be rendered that is able to restore the

former vertical scroll on every request. Convenient featureif you have pages

withlong lists and youdo not want the browser page to always jump to the top

if you trigger a link or button action that stays on the same page.

Default:"false"

</description>

</context-param>

<!-- the following context-params arefor jsf 1.1 -->

<!-- tjc 2007-02-07 -->

<context-param>

<param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>

<param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>

</context-param>

<context-param>

<param-name>org.apache.myfaces.redirectTracker.POLICY</param-name>

<param-value>org.apache.myfaces.redirectTracker.NoopRedirectTrackPolicy</param-value>

</context-param>

<context-param>

<param-name>org.apache.myfaces.redirectTracker.MAX_REDIRECTS</param-name>

<param-value>20</param-value>

</context-param>

<context-param>

<param-name>org.apache.myfaces.COMPRESS_STATE_IN_SESSION</param-name>

<param-value>false</param-value>

</context-param>

<context-param>

<param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>

<param-value>false</param-value>

</context-param>

</web-app>

I'm running jsf 1.1, tomcat v5.5.20, apache 2.059, JK 1.2.18

Thanks to anyone for insight.

[18160 byte] By [tjclifforda] at [2007-11-26 19:19:54]
# 1

[nobr]Hello. Me again.

I did not post the JSP file that was using the above code, so I

decided to post it, and mention that if I use:

onchange="submit();"

within the <h:selectOneMenu> tag, the form does not need to be

submitted twice, but takes the values and validates them.

On the other hand, if your form is long enough, and you have to scroll

down to change the drop-down box, the form is submitted, and

so it takes you to the top of the page again.

I guess that I could design the page so that the entire form fits

within the browser without scrolling, but that would depend on

how big the user makes their browser window.

Anyway, here is the JSP:

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

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

<f:view>

<%

/*

* MOCF ball tickets order form.

*/

%>

<jsp:include page="./headerform.jsp">

<jsp:param name="pagetitle" value="MOCF Ball Tickets Purchase Page" />

<jsp:param name="page" value="tickets" />

</jsp:include>

<center>

<h:form>

<table border="2" cellspacing=1 cellpadding=2>

<tr>

<td align=center>

<h:outputText value="#{mocfBall.mocfyear}"/>

<h:outputText value="#{mocfBall.mocftitle}"/><br>

<b><i>

<h:outputText value="#{mocfBall.mocfslogan}"/>

</i></b><br>

<h:outputText value="#{mocfBall.mocflocation}"/><br>

<h:outputText value="#{mocfBall.mocfcity}"/><br>

<h:outputText value="#{mocfBall.mocfdate}"/><br>

</td>

</tr>

</table>

<table border="0" cellspacing=1 cellpadding=2 width="90%">

<tr>

<td align=center>

MOCF Ball Tickets PURCHASE FORM

</td>

</tr>

<tr>

<td align=center>

Date/Time:

<h:outputText value="#{mocfBall.currentdatetime}"/>

</td>

</tr>

<!-- tr>

<td align=center>

<a href="./ticketsprint.jsp">

LINK to PRINTABLE FORM<br>

(You can click here, then print the page,<br>

and send it in the mail with your check.)

</a>

</td>

</tr -->

<tr>

<td align=center>

<font size="2" face="arial">

You may print this form and fill in the fields by hand,

<br>or<br>

fill in the fields now by typing, then print the form with the

PRINT button in the browser menu above, or the "Print Page"

button below.

<br><br>

For questions, please contact:<br>

<h:outputText value="#{mocfBall.mocfcontactname}"/>

at

<h:outputText value="#{mocfBall.mocfcontactphone}"/>

or by email at

<h:outputText value="#{mocfBall.mocfcontactemail}"/>

<br><br>

To use the postal service instead of online submission,

please mail this form, with your check, to:<br>

<h:outputText value="#{mocfBall.mocfsnailtitle}"/><br>

<h:outputText value="#{mocfBall.mocfsnailaddr1}"/><br>

<h:outputText value="#{mocfBall.mocfsnailaddr2}"/><br>

<h:outputText value="#{mocfBall.mocfsnailaddr3}"/><br>

</font>

</td>

</tr>

<tr>

<td align=right>

<a href=<h:outputText value="#{mocfBall.mocfhome}"/>>MOCF Ball Home</a>

</td>

</tr>

</table>

<table width="90%" border="1" cellpadding="2" cellspacing="0">

<tr>

<td width="100%" valign="top" colspan="2" align="center">

(* = field required)

</td>

</tr>

<tr>

<td align="right" valign="top">

*Salutation:

</td>

<td align="left" valign="top">

<h:selectOneMenu id="formSalutations"

valueChangeListener="#{ticketsformBean.mocfsalutationSelected}"

value="${ticketsformBean.mocfsalutation}">

<f:selectItems value="#{ticketsformBean.allsalutations}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.salutationerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*First name:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocffirstname}" size="40"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.firstnameerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Last name:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocflastname}" size="40"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.lastnameerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Address1:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfaddress1}" size="40"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.address1error}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Address2:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfaddress2}" size="40"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.address2error}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*City:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfcity}" size="30"/>

<font size="-2px" color="red">

<br>

<h:outputText value="#{ticketsformBean.cityerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*State:

</td>

<td align="left" valign="top">

<h:selectOneMenu id="states"

valueChangeListener="#{ticketsformBean.mocfstateSelected}"

value="${ticketsformBean.mocfstate}">

<f:selectItems value="#{ticketsformBean.allstates}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.stateerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Zip:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfzip}" size="10"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.ziperror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Phone:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfphone}" size="10"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.phoneerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

Fax:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocffax}" size="10"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.faxerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Email:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfemail}" size="60"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.emailerror}"/>

</font>

</td>

</tr>

</table>

<table width="90%" border="1" cellpadding="2" cellspacing="0">

<tr>

<td align="right" valign="top">

*Number of tickets to reserve:

</td>

<td align="left" valign="top">

<h:selectOneMenu id="ticketcount"

valueChangeListener="#{ticketsformBean.mocfnbrofticketsSelected}"

value="${ticketsformBean.mocfnbroftickets}">

<f:selectItems value="#{ticketsformBean.allticketcounts}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.nbrticketserror}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Name1:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfname1}" size="30"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.name1error}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Name2:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfname2}" size="30"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.name2error}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Name3:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfname3}" size="30"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.name3error}"/>

</font>

</td>

</tr>

<tr>

<td align="right" valign="top">

*Name4:

</td>

<td align="left" valign="top">

<h:inputText value="#{ticketsformBean.mocfname4}" size="30"/>

<font class="formerror">

<br>

<h:outputText value="#{ticketsformBean.name4error}"/>

</font>

</td>

</tr>

<tr>

<td align="center" valign="top" colspan="2">

<h:commandButton value="Submit tickets order"

action="#{ticketsformBean.validate}"/>

</td>

</tr>

</table>

</h:form>

<br>

<table border="0" cellspacing=1 cellpadding=2>

<tr>

<td align=center>

<input type="hidden" name="form" value="print">

<INPUT TYPE="button" name="printMe" onClick="print()" value="Print Page">

</td>

</tr>

</table>

</center>

<h:messages />

<jsp:include page="./footerform.jsp" />

</f:view>

[/nobr]

tjclifforda at 2007-7-9 21:37:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]My mistake. Posted the wrong JSP, but the same thing applies.

Here is the one that goes with the code above:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

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

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

<html>

<head>

<title>Test selectOneMenu</title>

<link rel="stylesheet" type="text/css" href="./css/data.css" />

</head>

<body>

<f:view>

<h5>selectOnePage test</h5>

<h:form>

<f:verbatim><br/><br/></f:verbatim>

<table border="1" cellpadding="1" cellspacing="1">

<tr>

<td align="right">

Name:

</td>

<td align="left">

<h:inputText value="#{data.name}" size="40"/>

<font class="formerror">

<br>

<h:outputText value="#{data.nameerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right">

Select one state:

</td>

<td align="left">

<h:selectOneMenu value="#{data.state}"

onchange="submit();"

valueChangeListener="#{data.stateSelected}">

<f:selectItems value="#{data.statelist}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{data.stateerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right">

Select one ethnic group:

</td>

<td align="left">

<h:selectOneMenu value="#{data.ethnic}"

onchange="submit();"

valueChangeListener="#{data.ethnicSelected}">

<f:selectItems value="#{data.ethniclist}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{data.ethnicerror}"/>

</font>

</td>

</tr>

<tr>

<td align="right">

Select one gender:

</td>

<td align="left">

<h:selectOneMenu value="#{data.gender}"

onchange="submit();"

valueChangeListener="#{data.genderSelected}">

<f:selectItems value="#{data.genderlist}"/>

</h:selectOneMenu>

<font class="formerror">

<br>

<h:outputText value="#{data.gendererror}"/>

</font>

</td>

</tr>

<tr>

<td align="center" colspan=2>

<h:commandButton value="Submit name"

action="#{data.validate}"

/>

</td>

</tr>

</table>

</h:form>

<h:outputText value="#{user.email}" />

</f:view>

<br>

<a href="http://localhost/jsftest06/">App home</a>

</body>

</html>

[/nobr]

tjclifforda at 2007-7-9 21:37:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Hi,

I did not read through all of your code, but have one question. You said that you have a valueChangeListener. What do you need it for? If you want to just normally submit a form and get the selected value, you don't need this one, I think.

The valueChangeListener is needed if you need an event on the server whenever the user selects a different entry in the list.

Couldn't you do without the valueChangeListener?

Wiebke

Wiebke82a at 2007-7-9 21:37:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hello Wiebke, thanks for your reply.

I have tried it without the valueChangeListener, and when I

do that, I still have to submit the form twice,

and the System.out.println() statements in the getters and

setters for the submitOneMenu fields show me that the

backing bean fields -are- being populated.

When I remove the valuechangelistener method from the backing

bean altogether (along with removing the valuechangelistener

statement from the selectOneMenu tag in the jsp file,

it gives me a servlet exception saying the method is not

found....?

tjclifforda at 2007-7-9 21:37:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

One more thing.....

I removed the references to valuechangelistener in the JSP file,

then I commented out the valuechangelistener methods in

the backing bean, then re-ran the app from scratch, and it

seems that the setter methods for the drop-down boxes

are never getting run when the form is submitted.

I call the getter methods in the validate() routine, and those return

either blank or null. Aren't the selectOneMenu tags supposed to

run the setter methods when the form is submitted ?

one drop down:

<h:selectOneMenu id="formSalutations"

value="${ticketsformBean.mocfsalutation}">

<f:selectItems value="#{ticketsformBean.allsalutations}"/>

</h:selectOneMenu>

backing bean:

public void setMocfsalutation(String salutation) {

System.out.println("MocfFormBean: setMocfsalutation: [" + salutation + "]");

if (salutation.equals(" ")) {

mocfsalutation = "Hon.";

} else {

mocfsalutation = salutation;

}

}

public String getMocfsalutation() {

System.out.println("MocfFormBean: getMocfsalutation: [" + mocfsalutation + "]");

if (mocfsalutation.equals("")) {

return " ";

} else {

return mocfsalutation;

}

}

....shouldn't the 'value="${ticketsformBean.mocfsalutation}">'

code in the selectOneMenu tag indicate that when the form is

submitted, the 'setMocfsalutation' method should be run ?

One thing that may not be clear......the backing bean, 'TicketsFormBean',

is inherited from 'MocfFormBean', because the demographics for

the form are all held in MocfFormBean. There are 5 forms in the

application, all of which have the demographics, but differ in the

fields after that, so I set up backing beans for each form, which

inherit the demographics bean. So the setMocfsalutation is called

from the inherited bean, not the inheriting bean.

You would think it really should not make a difference, but I wanted

to mention it......

Thx.

tjclifforda at 2007-7-9 21:37:13 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...