You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jeff Cooper <jc...@resqsoft.com> on 2004/04/12 16:45:10 UTC
Help with nullpointerexception on valid
Could someone please help me to see why i am getting a nullpointerexception
on the property "names". I'm including my html template, the page file, and
java class. This screen consists of a button that when clicked will save
the changes to a in-memory database. There is one pulldown that the users
use to select the record they would like to edit. This screen used to work,
but received a new html template from our web-designers and that is when it
'broke'. Any time i do a getNames() the data is null. On the error page, i
see that 'inputName' consists of the updated data i want.
TermOfBusiness.page:
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification
class="com.freddiemac.flexpoint_prototype.ui.TermOfBusiness">
<bean name="delegate"
class="com.freddiemac.flexpoint_prototype.ui.TermOfBusinessValidationDelegat
e"/>
<bean name="nameValidator"
class="org.apache.tapestry.valid.StringValidator"
lifecycle="page">
<set-property name="required" expression="true"/>
<set-property name="minimumLength" expression="5"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<bean name="dateValidator"
class="org.apache.tapestry.valid.DateValidator"
lifecycle="page">
<set-property name="required" expression="false"/>
<set-property name="clientScriptingEnabled" expression="true"/>
</bean>
<property-specification name="agreements" type="java.util.List"/>
<property-specification name="initialValue" type="java.lang.Boolean"/>
<property-specification name="termOfBusiness"
type="com.freddiemac.flexpoint_prototype.biz.TermOfBusinessDTO" />
<property-specification name="names" type="java.lang.String"/>
<component id="selectItem" type="PropertySelection">
<binding name="model" expression="termOfBusinessModel"/>
<binding name="value" expression="termOfBusiness"/>
<binding name="submitOnChange" expression="true"/>
</component>
<component id="inputName" type="ValidField">
<static-binding name="displayName"
value="Deal Type"/>
<binding name="validator"
expression="beans.nameValidator"/>
</component>
</page-specification>
TermOfBusiness.java:
/*
* Created on Mar 25, 2004
*
* To change the template for this generated file go to
* Window - Preferences - Java - Code Generation - Code and Comments
*/
package com.freddiemac.flexpoint_prototype.ui;
import java.io.IOException;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.tapestry.IBinding;
import org.apache.tapestry.IComponent;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.RedirectException;
import org.apache.tapestry.event.PageEvent;
import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.form.IFormComponent;
import org.apache.tapestry.form.IPropertySelectionModel;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.request.RequestContext;
import org.apache.tapestry.valid.IValidationDelegate;
import org.apache.tapestry.valid.ValidationConstraint;
import com.freddiemac.flexpoint_prototype.biz.AgreementDTO;
import com.freddiemac.flexpoint_prototype.biz.ICsPrototypeServices;
import com.freddiemac.flexpoint_prototype.biz.TermDTO;
import com.freddiemac.flexpoint_prototype.biz.TermOfBusinessDTO;
/**
* @author jcooper
*
* To change the template for this generated type comment go to Window -
* Preferences - Java - Code Generation - Code and Comments
*/
public abstract class TermOfBusiness extends BasePage{
public abstract void setName(String name);
public abstract String getNames();
public abstract void setInitialValue(Boolean value);
public abstract void setTermOfBusiness(TermOfBusinessDTO termOfBusiness);
// public abstract void setCreationDate(Date creationDate);
// public abstract Date getCreationDate();
public abstract TermOfBusinessDTO getTermOfBusiness();
/**
* Method obtains an instance of ICsPrototypeServices currently used in
* the system and returns to the calling code.
*
* @return ICsPrototypeServices An instance of ICsPrototypeServices
*/
private ICsPrototypeServices getICsPrototypeServices() {
ICsPrototypeServices services = (ICsPrototypeServices) this
.getRequestCycle().getRequestContext().getSession()
.getServletContext().getAttribute(Keys.I_CS_PROTOTYPE_SERVICES);
return services;
}
/**
* getTermOfBusinessModel gets the model for the selectlist for the Term
* Of Business page.
*
* *** Note that this goes to the database for every submit; since
* prototype code will not investigate further, but wanted to note here in
* case we use Tapestry further.
*
* @return
*/
public IPropertySelectionModel getTermOfBusinessModel() {
ICsPrototypeServices service = getICsPrototypeServices();
return new TermOfBusinessModel(service);
}
/**
* formSubmit is called
*
* @param cycle
*/
public void formSubmit(IRequestCycle cycle) {
IValidationDelegate delegate = (IValidationDelegate) getBeans()
.getBean("delegate");
TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
//check the required fields; since we have blank for a <add new> on
// name. The
//submitting of the form falsely states that an validation error has
// occured.
if (termOfBusiness.getName().equals("")) {
setInitialValue(new Boolean(true));
} else {
//Not a validation error; more than likely <Add New> was
// selected, thus name
//field is blank.
setInitialValue(new Boolean(false));
delegate.clear();
}
// if (delegate.getHasErrors()) {
// return;
// }
if (termOfBusiness != null
&& !termOfBusiness.getName().equals("<Add New>")) {
setName(termOfBusiness.getName());
// setCreationDate(termOfBusiness.getCreationDate());
} else {
setName("");
}
}
private void error(
IValidationDelegate delegate,
String componentId,
String message,
ValidationConstraint constraint)
{
IFormComponent component =
(IFormComponent) getComponent(componentId);
delegate.setFormComponent(component);
delegate.record(message, constraint);
}
public void exitSubmitAction(IRequestCycle cycle) {
// HttpServletRequest request =
// cycle.getRequestContext().getRequest();
HttpServletResponse response = cycle.getRequestContext().getResponse();
String context = cycle.getRequestContext().getRequest()
.getContextPath();
try {
response.sendRedirect(context);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void saveSubmitAction(IRequestCycle cycle) {
//Check to see if adding new
ICsPrototypeServices service = this.getICsPrototypeServices();
TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
if (termOfBusiness != null) {
if (termOfBusiness.getName().equalsIgnoreCase("<Add New>")) {
addNewTermOfBusiness(cycle);
} else {
updateTermOfBusiness(cycle);
}
}
}
private void addNewTermOfBusiness(IRequestCycle cycle) {
ICsPrototypeServices service = this.getICsPrototypeServices();
String theName = getNames();
//Date creationDate = (Date) cycle.getPage().getProperty("creationDate");
TermOfBusinessDTO newDTO = new TermOfBusinessDTO(theName);
//newDTO.setCreationDate(creationDate);
service.addTermOfBusiness(newDTO);
}
private void updateTermOfBusiness(IRequestCycle cycle) {
ICsPrototypeServices service = this.getICsPrototypeServices();
TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
String theName = getNames();
String a = (String)cycle.getPage().getProperty("names");
//Date creationDate = (Date) cycle.getPage().getProperty("creationDate");
termOfBusiness.setName(theName);
//termOfBusiness.setCreationDate(creationDate);
service.updateTermOfBusiness(termOfBusiness);
}
public void deleteSubmitAction(IRequestCycle cycle) {
ICsPrototypeServices service = this.getICsPrototypeServices();
TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
if(termOfBusiness!=null&&!termOfBusiness.getName().equals("<Add
New>")){
service.deleteTermOfBusiness(termOfBusiness);
}
//Default name back to blank
}
}
TermOfBusiness.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body jwcid="$content$">
<span jwcid="@Border">
<span jwcid="@Conditional" condition="ognl:initialValue">
<span jwcid="@Conditional"
condition="ognl:beans.delegate.hasErrors">
<table class="error">
<tr valign="top">
<td>
<span jwcid="@Delegator"
delegate="ognl:beans.delegate.firstError">
Error Message
</span>
</td>
</tr>
</table>
</span>
</span>
<br/>
<form jwcid="@Form" listener="ognl:listeners.formSubmit"
delegate="ognl:beans.delegate">
<TABLE WIDTH=45% BORDER=0>
<tr class=row>
<TD NOWRAP COLSPAN=1 ROWSPAN=1 VALIGN=MIDDLE ALIGN=LEFT CLASS=text>
Term of Business:
</td>
<TD NOWRAP COLSPAN=1 ROWSPAN=1 VALIGN=MIDDLE ALIGN=LEFT CLASS=text>
<select class="control" jwcid="selectItem"/>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="760" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" rowspan="3" valign="top" bgcolor="eeeeee">
<div align="center">
<p> </p>
<p>
<input class="control" type="submit" jwcid="@Submit"
listener="ognl:listeners.saveSubmitAction" value="Save Agreement"/>
</p>
<p>
<input class="control" type="submit" jwcid="@Submit"
listener="ognl:listeners.exitSubmitAction"
onClick="form.onsubmit=null;"value="Exit"/>
</p>
</div></td>
<td align="left"> <table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><br> <table width="600"
border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="20" class="tableheader1"><font
color="#666699">.</font>Deal
Information</td>
</tr>
<tr>
<td><table width="100%" border="0">
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<TD CLASS=text>
<span jwcid="@FieldLabel" field="ognl:components.inputName">
Name:
</span>
</td>
<td width="29%">
<input class="control" type="text" jwcid="inputName" value="ognl:names"
size="50" /> </td>
<td width="24%" class="displaylabel">Deal
Status:</td>
<td width="23%"
class="displaydata"><Status></td>
</tr>
<tr>
<td class="displaylabel">Deal#:</td>
<td class="displaydata"><Category
Name></td>
<td width="24%"
class="displaylabel">Mailed
Date:</td>
<td width="24%"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td class="displaylabel">S/S#s:<br> </td>
<td valign="top"
class="displaydata">123456</td>
<td valign="top"
class="displaylabel">Completed
Date:</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td class="displaylabel">Seller Name:</td>
<td valign="top" class="displaydata">ABC
Organization</td>
<td valign="top"
class="displaylabel">Superseded
Date:</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td rowspan="2" align="left" valign="top"
class="displaylabel">Other
S/S#s:</td>
<td class="displaydata">123456</td>
<td valign="top"
class="displaylabel">Canceled
Date:</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td class="displaydata">123456</td>
<td valign="top" class="displaylabel">Deny
Date:</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td rowspan="2" valign="top"
class="displaylabel">Other
Seller Names:</td>
<td class="displaydata">ABC
Organization</td>
<td class="displaylabel">Current
Master:</td>
<td
class="displaydata"><Yes/No></td>
</tr>
<tr>
<td class="displaydata">ABC
Organization</td>
<td colspan="2" class="displaylabel"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
</table></td>
</tr>
</table>
<br> <table width="600" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="20" class="tableheader1"><font
color="#666699">.</font>Master
Agreement Information</td>
</tr>
<tr>
<td><table width="100%" border="0">
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<td width="24%"
class="displaylabel">Master
Agreement #:</td>
<td width="29%" class="displaydata"><MA
#></td>
<td width="24%" class="displaylabel">DPM
Products:</td>
<td width="23%"
class="displaydata"><Product
Name></td>
</tr>
<tr>
<td class="displaylabel">Effective
Date:</td>
<td
class="displaydata"><mm/dd/yyyy></td>
<td class="displaylabel"> </td>
<td class="displaydata"><Product
Name></td>
</tr>
<tr>
<td class="displaylabel">Expiration
Date:<br>
</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
<td valign="top" class="displaylabel"><img
src="images/spacer.gif" width="10" height="10"></td>
<td valign="top"
class="displaydata"><Product
Name></td>
</tr>
<tr>
<td class="displaylabel">MA Amount:</td>
<td class="displaydata">$12,345,678</td>
<td rowspan="2" valign="top"
class="displaylabel">Associated
Master Commitments:</td>
<td valign="top"
class="displaydata"><MC#></td>
</tr>
<tr>
<td colspan="2" class="displaylabel"><img
src="images/spacer.gif" width="10" height="10"></td>
<td valign="top"
class="displaydata"><MC#></td>
</tr>
<tr>
<td colspan="2" class="displaylabel"><img
src="images/spacer.gif" width="10" height="10"></td>
<td valign="top" class="displaylabel"><img
src="images/spacer.gif" width="10" height="10"></td>
<td valign="top"
class="displaydata"><MC#></td>
</tr>
</table></td>
</tr>
</table>
<br> <table border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td height="20" class="tableheader1"><font
color="#666699">.</font>Master
Commitment Information</td>
</tr>
<tr>
<td align="left" valign="top"> <table
width="100%" border="0">
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<td width="24%"
class="displaylabel">Master
Commitment #:</td>
<td width="29%" class="displaydata"><MC
#></td>
<td width="24%" valign="top"
class="displaylabel">Commitment
Type: </td>
<td width="23%" valign="top"
class="displaydata"><Commitment
Type></td>
</tr>
<tr>
<td class="displaylabel">Effective
Date:</td>
<td
class="displaydata"><mm/dd/yyyy></td>
<td rowspan="2"
class="displaylabel">Associated
Master Agreement:</td>
<td rowspan="2"
class="displaydata"><MA#></td>
</tr>
<tr>
<td class="displaylabel">Expiration
Date:<br>
</td>
<td valign="top"
class="displaydata"><mm/dd/yyyy></td>
</tr>
<tr>
<td class="displaylabel">MC Amount:</td>
<td class="displaydata">$12,345,678</td>
<td rowspan="2" valign="top"
class="displaylabel">Minimum
Servicing Spread - Fixed:</td>
<td rowspan="2" class="displaydata">xxxx
bps</td>
</tr>
<tr>
<td class="displaylabel">Lower
Tolerance:</td>
<td class="displaydata">xx%</td>
</tr>
<tr>
<td class="displaylabel">Upper
Tolerance:</td>
<td class="displaydata">xx%</td>
<td rowspan="2" valign="top"
class="displaylabel"><p>Minimum
Servicing Spread - ARMS:</p></td>
<td rowspan="2" class="displaydata">xxxx
bps</td>
</tr>
<tr>
<td class="displaylabel">MC Total
Including
Tolerance:</td>
<td class="displaydata">$12,345,678</td>
</tr>
<tr>
<td class="displaylabel">Available MC
Balance:</td>
<td class="displaydata">$12,345,678</td>
<td rowspan="2" valign="top"
class="displaylabel">Minimum
Servicing Spread - Balloons:</td>
<td rowspan="2" class="displaydata">xxxx
bps</td>
</tr>
<tr>
<td class="displaylabel">Actual
Balance:</td>
<td class="displaydata">$12,345,678</td>
</tr>
<tr>
<td valign="top"
class="displaylabel">Execution
Method: </td>
<td valign="top"
class="displaydata"><Execution
Method ></td>
<td colspan="2" valign="top"
class="displaylabel"><img src="images/spacer.gif" width="10"
height="10"></td>
</tr>
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<td colspan="4" valign="top"
class="tableheader">Product
Eligibility </td>
</tr>
<tr >
<td colspan="4" valign="top"
class="displaylabel">This
MC Accepts these selling Systems</td>
</tr>
<tr >
<td colspan="4" valign="top"
class="displaylabel"><img src="images/spacer.gif" width="10"
height="10"></td>
</tr>
<tr>
<td rowspan="3" valign="top"
class="displaylabel">PE
Contract Products:</td>
<td valign="top"
class="displaydata"><Contract
Product> </td>
<td rowspan="3" valign="top"
class="displaylabel">Guide
Contract Products:</td>
<td valign="top"
class="displaydata"><Pooling
Product> </td>
</tr>
<tr>
<td valign="top"
class="displaydata"><Contract
Product></td>
<td valign="top"
class="displaydata"><Pooling
Product> </td>
</tr>
<tr>
<td valign="top"
class="displaydata"><Contract
Product></td>
<td valign="top"
class="displaydata"><Pooling
Product> </td>
</tr>
<tr>
<td valign="top"
class="displaylabel">Guide
Pooling Products:</td>
<td valign="top"
class="displaydata"><Pooling
Product> </td>
<td colspan="2" valign="top"
class="displaylabel"><img src="images/spacer.gif" width="10"
height="10"></td>
</tr>
<tr>
<td colspan="4" valign="top"
class="displaylabel"><table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="24%" align="left"
valign="top" class="displaylabel">
<p>Negotiated Contract Products:
</p></td>
<td width="38%" align="left"
valign="top" class="displaylabel">
<input type="checkbox"
name="checkbox" value="checkbox">
15 Year Convertible Biweekly<br>
<input type="checkbox" name="checkbox2" value="checkbox">
30 Year Convertible Biweekly<br>
<input type="checkbox" name="checkbox3" value="checkbox">
15 Year Non-Convertible
Biweekly<br>
<input type="checkbox"
name="checkbox4" value="checkbox">
30 Year Non-Convertible
Biweekly<br>
</td>
<td width="38%" align="left"
valign="top" class="displaylabel">
<input type="checkbox"
name="checkbox5" value="checkbox">
15 Year Fixed Rate FHA/Va<br>
<input type="checkbox" name="checkbox52" value="checkbox">
20 Year Fixed Rate FHA/Va<br>
<input type="checkbox" name="checkbox53" value="checkbox">
30 Year Fixed Rate FHA/Va </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr>
<td colspan="4" valign="top"
class="tableheader">Servicing
Terms </td>
</tr>
<tr>
<td valign="top"
class="displaylabel">Prepayment
Remittance Due Days:</td>
<td>
<select name="select" size="1">
<option selected>5</option>
<option>------------</option>
</select></td>
<td valign="top"
class="displaylabel">Interest/Principle
Remittance Type:</td>
<td><select name="select3" size="1">
<option
selected>Scheduled/Scheduled</option>
<option>------------</option>
</select></td>
</tr>
<tr>
<td valign="top" class="displaylabel">Flex
Option:</td>
<td valign="top"><select name="select2"
size="1">
<option selected>No</option>
<option>------------</option>
</select></td>
<td colspan="2" valign="top"
class="displaylabel"><img src="images/spacer.gif" width="10"
height="10"></td>
</tr>
<tr>
<td colspan="4"><img
src="images/spacer.gif" width="10" height="10"></td>
</tr>
<tr align="center" valign="middle">
<td colspan="4"> <table width="98%"
border="0" cellpadding="0" cellspacing="0">
<tr class="tableheader">
<td class="tableheader2"><div
align="left">Remittance
Cycle Option</div></td>
<td
class="tableheader2">Allowed</td>
<td
class="tableheader2">Mandatory/Option</td>
<td class="tableheader2">Float
Value</td>
<td class="tableheader2">Remittance
Day</td>
</tr>
<tr class="tablelightrow">
<td align="left"
class="tablelightrow"><div align="left">Gold
Guarantor</div></td>
<td class="tablelightrow">Yes</td>
<td
class="tablelightrow">Optional</td>
<td
class="tablelightrow">Locked</td>
<td
class="tablelightrow"> </td>
</tr>
<tr class="tabledarkrow">
<td align="left"
class="tabledarkrow"><div align="left">SuperARC
Remittance Day</div></td>
<td class="tabledarkrow">Yes</td>
<td
class="tabledarkrow">Mandatory</td>
<td
class="tabledarkrow">Prevailing</td>
<td class="tabledarkrow"> </td>
</tr>
<tr>
<td align="left"
class="tablelightrow"><div align="left">Super
ARC</div></td>
<td class="tablelightrow">Yes</td>
<td class="tablelightrow">N/A</td>
<td class="tablelightrow">N/A</td>
<td class="tablelightrow"><input
name="textfield" type="text" size="15"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>
<br></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<p> </p>
<p> </p></td>
</tr>
</table>
<p> </p>
</form>
</span>
</body>
</html>
Thanks for any help,
Jeff Cooper
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Help with nullpointerexception on valid
Posted by John Studarus <st...@jhlconsulting.com>.
You have some that are name and others that are names (plural).
The setName is probably bailing since there is no property "Name" (it is "Names").
<property-specification name="names" type="java.lang.String"/>
public abstract void setName(String name);
public abstract String getNames();
John
On Mon, Apr 12, 2004 at 10:45:10AM -0400, Jeff Cooper wrote:
> Could someone please help me to see why i am getting a nullpointerexception
> on the property "names". I'm including my html template, the page file, and
> java class. This screen consists of a button that when clicked will save
> the changes to a in-memory database. There is one pulldown that the users
> use to select the record they would like to edit. This screen used to work,
> but received a new html template from our web-designers and that is when it
> 'broke'. Any time i do a getNames() the data is null. On the error page, i
> see that 'inputName' consists of the updated data i want.
>
> TermOfBusiness.page:
> <?xml version="1.0"?>
> <!DOCTYPE page-specification PUBLIC
> "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
> "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
>
> <page-specification
> class="com.freddiemac.flexpoint_prototype.ui.TermOfBusiness">
> <bean name="delegate"
>
> class="com.freddiemac.flexpoint_prototype.ui.TermOfBusinessValidationDelegat
> e"/>
>
> <bean name="nameValidator"
> class="org.apache.tapestry.valid.StringValidator"
> lifecycle="page">
> <set-property name="required" expression="true"/>
> <set-property name="minimumLength" expression="5"/>
> <set-property name="clientScriptingEnabled" expression="true"/>
> </bean>
> <bean name="dateValidator"
> class="org.apache.tapestry.valid.DateValidator"
> lifecycle="page">
> <set-property name="required" expression="false"/>
> <set-property name="clientScriptingEnabled" expression="true"/>
> </bean>
>
> <property-specification name="agreements" type="java.util.List"/>
> <property-specification name="initialValue" type="java.lang.Boolean"/>
> <property-specification name="termOfBusiness"
> type="com.freddiemac.flexpoint_prototype.biz.TermOfBusinessDTO" />
> <property-specification name="names" type="java.lang.String"/>
> <component id="selectItem" type="PropertySelection">
> <binding name="model" expression="termOfBusinessModel"/>
> <binding name="value" expression="termOfBusiness"/>
> <binding name="submitOnChange" expression="true"/>
> </component>
> <component id="inputName" type="ValidField">
> <static-binding name="displayName"
> value="Deal Type"/>
> <binding name="validator"
> expression="beans.nameValidator"/>
> </component>
>
>
> </page-specification>
>
> TermOfBusiness.java:
> /*
> * Created on Mar 25, 2004
> *
> * To change the template for this generated file go to
> * Window - Preferences - Java - Code Generation - Code and Comments
> */
> package com.freddiemac.flexpoint_prototype.ui;
> import java.io.IOException;
> import java.util.Date;
> import javax.servlet.ServletException;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import org.apache.tapestry.IBinding;
> import org.apache.tapestry.IComponent;
> import org.apache.tapestry.IRequestCycle;
> import org.apache.tapestry.RedirectException;
> import org.apache.tapestry.event.PageEvent;
> import org.apache.tapestry.event.PageRenderListener;
> import org.apache.tapestry.form.IFormComponent;
> import org.apache.tapestry.form.IPropertySelectionModel;
> import org.apache.tapestry.html.BasePage;
> import org.apache.tapestry.request.RequestContext;
> import org.apache.tapestry.valid.IValidationDelegate;
> import org.apache.tapestry.valid.ValidationConstraint;
>
> import com.freddiemac.flexpoint_prototype.biz.AgreementDTO;
> import com.freddiemac.flexpoint_prototype.biz.ICsPrototypeServices;
> import com.freddiemac.flexpoint_prototype.biz.TermDTO;
> import com.freddiemac.flexpoint_prototype.biz.TermOfBusinessDTO;
> /**
> * @author jcooper
> *
> * To change the template for this generated type comment go to Window -
> * Preferences - Java - Code Generation - Code and Comments
> */
> public abstract class TermOfBusiness extends BasePage{
> public abstract void setName(String name);
> public abstract String getNames();
> public abstract void setInitialValue(Boolean value);
> public abstract void setTermOfBusiness(TermOfBusinessDTO termOfBusiness);
> // public abstract void setCreationDate(Date creationDate);
> // public abstract Date getCreationDate();
> public abstract TermOfBusinessDTO getTermOfBusiness();
> /**
> * Method obtains an instance of ICsPrototypeServices currently used in
> * the system and returns to the calling code.
> *
> * @return ICsPrototypeServices An instance of ICsPrototypeServices
> */
> private ICsPrototypeServices getICsPrototypeServices() {
> ICsPrototypeServices services = (ICsPrototypeServices) this
> .getRequestCycle().getRequestContext().getSession()
> .getServletContext().getAttribute(Keys.I_CS_PROTOTYPE_SERVICES);
> return services;
> }
> /**
> * getTermOfBusinessModel gets the model for the selectlist for the Term
> * Of Business page.
> *
> * *** Note that this goes to the database for every submit; since
> * prototype code will not investigate further, but wanted to note here in
> * case we use Tapestry further.
> *
> * @return
> */
> public IPropertySelectionModel getTermOfBusinessModel() {
> ICsPrototypeServices service = getICsPrototypeServices();
> return new TermOfBusinessModel(service);
> }
> /**
> * formSubmit is called
> *
> * @param cycle
> */
> public void formSubmit(IRequestCycle cycle) {
> IValidationDelegate delegate = (IValidationDelegate) getBeans()
> .getBean("delegate");
> TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
> //check the required fields; since we have blank for a <add new> on
> // name. The
> //submitting of the form falsely states that an validation error has
> // occured.
> if (termOfBusiness.getName().equals("")) {
> setInitialValue(new Boolean(true));
> } else {
> //Not a validation error; more than likely <Add New> was
> // selected, thus name
> //field is blank.
> setInitialValue(new Boolean(false));
> delegate.clear();
> }
> // if (delegate.getHasErrors()) {
> // return;
> // }
> if (termOfBusiness != null
> && !termOfBusiness.getName().equals("<Add New>")) {
> setName(termOfBusiness.getName());
> // setCreationDate(termOfBusiness.getCreationDate());
> } else {
> setName("");
> }
> }
> private void error(
> IValidationDelegate delegate,
> String componentId,
> String message,
> ValidationConstraint constraint)
> {
> IFormComponent component =
> (IFormComponent) getComponent(componentId);
> delegate.setFormComponent(component);
> delegate.record(message, constraint);
> }
> public void exitSubmitAction(IRequestCycle cycle) {
> // HttpServletRequest request =
> // cycle.getRequestContext().getRequest();
> HttpServletResponse response = cycle.getRequestContext().getResponse();
> String context = cycle.getRequestContext().getRequest()
> .getContextPath();
> try {
> response.sendRedirect(context);
> } catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> public void saveSubmitAction(IRequestCycle cycle) {
> //Check to see if adding new
> ICsPrototypeServices service = this.getICsPrototypeServices();
> TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
> if (termOfBusiness != null) {
> if (termOfBusiness.getName().equalsIgnoreCase("<Add New>")) {
> addNewTermOfBusiness(cycle);
> } else {
> updateTermOfBusiness(cycle);
> }
> }
> }
> private void addNewTermOfBusiness(IRequestCycle cycle) {
> ICsPrototypeServices service = this.getICsPrototypeServices();
> String theName = getNames();
> //Date creationDate = (Date) cycle.getPage().getProperty("creationDate");
> TermOfBusinessDTO newDTO = new TermOfBusinessDTO(theName);
> //newDTO.setCreationDate(creationDate);
> service.addTermOfBusiness(newDTO);
> }
> private void updateTermOfBusiness(IRequestCycle cycle) {
> ICsPrototypeServices service = this.getICsPrototypeServices();
> TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
> String theName = getNames();
> String a = (String)cycle.getPage().getProperty("names");
>
> //Date creationDate = (Date) cycle.getPage().getProperty("creationDate");
> termOfBusiness.setName(theName);
>
> //termOfBusiness.setCreationDate(creationDate);
> service.updateTermOfBusiness(termOfBusiness);
> }
> public void deleteSubmitAction(IRequestCycle cycle) {
> ICsPrototypeServices service = this.getICsPrototypeServices();
> TermOfBusinessDTO termOfBusiness = getTermOfBusiness();
> if(termOfBusiness!=null&&!termOfBusiness.getName().equals("<Add
> New>")){
> service.deleteTermOfBusiness(termOfBusiness);
> }
> //Default name back to blank
> }
> }
>
> TermOfBusiness.html:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
> <html>
> <body jwcid="$content$">
> <span jwcid="@Border">
> <span jwcid="@Conditional" condition="ognl:initialValue">
> <span jwcid="@Conditional"
> condition="ognl:beans.delegate.hasErrors">
> <table class="error">
> <tr valign="top">
> <td>
> <span jwcid="@Delegator"
> delegate="ognl:beans.delegate.firstError">
> Error Message
> </span>
> </td>
> </tr>
> </table>
> </span>
> </span>
> <br/>
> <form jwcid="@Form" listener="ognl:listeners.formSubmit"
> delegate="ognl:beans.delegate">
> <TABLE WIDTH=45% BORDER=0>
> <tr class=row>
> <TD NOWRAP COLSPAN=1 ROWSPAN=1 VALIGN=MIDDLE ALIGN=LEFT CLASS=text>
> Term of Business:
> </td>
> <TD NOWRAP COLSPAN=1 ROWSPAN=1 VALIGN=MIDDLE ALIGN=LEFT CLASS=text>
> <select class="control" jwcid="selectItem"/>
> </td>
> </tr>
> </table>
>
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td><table width="760" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td><table width="760" border="1" cellspacing="0" cellpadding="0">
> <tr>
> <td width="150" rowspan="3" valign="top" bgcolor="eeeeee">
> <div align="center">
> <p> </p>
> <p>
> <input class="control" type="submit" jwcid="@Submit"
> listener="ognl:listeners.saveSubmitAction" value="Save Agreement"/>
> </p>
> <p>
> <input class="control" type="submit" jwcid="@Submit"
> listener="ognl:listeners.exitSubmitAction"
> onClick="form.onsubmit=null;"value="Exit"/>
> </p>
> </div></td>
> <td align="left"> <table width="100%" border="0"
> cellspacing="0" cellpadding="0">
> <tr>
> <td align="left" valign="top"><br> <table width="600"
> border="0" align="center" cellpadding="0" cellspacing="0">
> <tr>
> <td height="20" class="tableheader1"><font
> color="#666699">.</font>Deal
> Information</td>
> </tr>
> <tr>
> <td><table width="100%" border="0">
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr>
> <TD CLASS=text>
> <span jwcid="@FieldLabel" field="ognl:components.inputName">
> Name:
> </span>
> </td>
> <td width="29%">
> <input class="control" type="text" jwcid="inputName" value="ognl:names"
> size="50" /> </td>
> <td width="24%" class="displaylabel">Deal
> Status:</td>
> <td width="23%"
> class="displaydata"><Status></td>
> </tr>
> <tr>
> <td class="displaylabel">Deal#:</td>
> <td class="displaydata"><Category
> Name></td>
> <td width="24%"
> class="displaylabel">Mailed
> Date:</td>
> <td width="24%"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td class="displaylabel">S/S#s:<br> </td>
> <td valign="top"
> class="displaydata">123456</td>
> <td valign="top"
> class="displaylabel">Completed
> Date:</td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td class="displaylabel">Seller Name:</td>
> <td valign="top" class="displaydata">ABC
> Organization</td>
> <td valign="top"
> class="displaylabel">Superseded
> Date:</td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td rowspan="2" align="left" valign="top"
> class="displaylabel">Other
> S/S#s:</td>
> <td class="displaydata">123456</td>
> <td valign="top"
> class="displaylabel">Canceled
> Date:</td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td class="displaydata">123456</td>
> <td valign="top" class="displaylabel">Deny
> Date:</td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td rowspan="2" valign="top"
> class="displaylabel">Other
> Seller Names:</td>
> <td class="displaydata">ABC
> Organization</td>
> <td class="displaylabel">Current
> Master:</td>
> <td
> class="displaydata"><Yes/No></td>
> </tr>
> <tr>
> <td class="displaydata">ABC
> Organization</td>
> <td colspan="2" class="displaylabel"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> </table></td>
> </tr>
> </table>
> <br> <table width="600" border="0" align="center"
> cellpadding="0" cellspacing="0">
> <tr>
> <td height="20" class="tableheader1"><font
> color="#666699">.</font>Master
> Agreement Information</td>
> </tr>
> <tr>
> <td><table width="100%" border="0">
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr>
> <td width="24%"
> class="displaylabel">Master
> Agreement #:</td>
> <td width="29%" class="displaydata"><MA
> #></td>
> <td width="24%" class="displaylabel">DPM
> Products:</td>
> <td width="23%"
> class="displaydata"><Product
> Name></td>
> </tr>
> <tr>
> <td class="displaylabel">Effective
> Date:</td>
> <td
> class="displaydata"><mm/dd/yyyy></td>
> <td class="displaylabel"> </td>
> <td class="displaydata"><Product
> Name></td>
> </tr>
> <tr>
> <td class="displaylabel">Expiration
> Date:<br>
> </td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> <td valign="top" class="displaylabel"><img
> src="images/spacer.gif" width="10" height="10"></td>
> <td valign="top"
> class="displaydata"><Product
> Name></td>
> </tr>
> <tr>
> <td class="displaylabel">MA Amount:</td>
> <td class="displaydata">$12,345,678</td>
> <td rowspan="2" valign="top"
> class="displaylabel">Associated
> Master Commitments:</td>
> <td valign="top"
> class="displaydata"><MC#></td>
> </tr>
> <tr>
> <td colspan="2" class="displaylabel"><img
> src="images/spacer.gif" width="10" height="10"></td>
> <td valign="top"
> class="displaydata"><MC#></td>
> </tr>
> <tr>
> <td colspan="2" class="displaylabel"><img
> src="images/spacer.gif" width="10" height="10"></td>
> <td valign="top" class="displaylabel"><img
> src="images/spacer.gif" width="10" height="10"></td>
> <td valign="top"
> class="displaydata"><MC#></td>
> </tr>
> </table></td>
> </tr>
> </table>
> <br> <table border="0" align="center"
> cellpadding="0" cellspacing="0">
> <tr>
> <td height="20" class="tableheader1"><font
> color="#666699">.</font>Master
> Commitment Information</td>
> </tr>
> <tr>
> <td align="left" valign="top"> <table
> width="100%" border="0">
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr>
> <td width="24%"
> class="displaylabel">Master
> Commitment #:</td>
> <td width="29%" class="displaydata"><MC
> #></td>
> <td width="24%" valign="top"
> class="displaylabel">Commitment
> Type: </td>
> <td width="23%" valign="top"
> class="displaydata"><Commitment
> Type></td>
> </tr>
> <tr>
> <td class="displaylabel">Effective
> Date:</td>
> <td
> class="displaydata"><mm/dd/yyyy></td>
> <td rowspan="2"
> class="displaylabel">Associated
> Master Agreement:</td>
> <td rowspan="2"
> class="displaydata"><MA#></td>
> </tr>
> <tr>
> <td class="displaylabel">Expiration
> Date:<br>
> </td>
> <td valign="top"
> class="displaydata"><mm/dd/yyyy></td>
> </tr>
> <tr>
> <td class="displaylabel">MC Amount:</td>
> <td class="displaydata">$12,345,678</td>
> <td rowspan="2" valign="top"
> class="displaylabel">Minimum
> Servicing Spread - Fixed:</td>
> <td rowspan="2" class="displaydata">xxxx
> bps</td>
> </tr>
> <tr>
> <td class="displaylabel">Lower
> Tolerance:</td>
> <td class="displaydata">xx%</td>
> </tr>
> <tr>
> <td class="displaylabel">Upper
> Tolerance:</td>
> <td class="displaydata">xx%</td>
> <td rowspan="2" valign="top"
> class="displaylabel"><p>Minimum
> Servicing Spread - ARMS:</p></td>
> <td rowspan="2" class="displaydata">xxxx
> bps</td>
> </tr>
> <tr>
> <td class="displaylabel">MC Total
> Including
> Tolerance:</td>
> <td class="displaydata">$12,345,678</td>
> </tr>
> <tr>
> <td class="displaylabel">Available MC
> Balance:</td>
> <td class="displaydata">$12,345,678</td>
> <td rowspan="2" valign="top"
> class="displaylabel">Minimum
> Servicing Spread - Balloons:</td>
> <td rowspan="2" class="displaydata">xxxx
> bps</td>
> </tr>
> <tr>
> <td class="displaylabel">Actual
> Balance:</td>
> <td class="displaydata">$12,345,678</td>
> </tr>
> <tr>
> <td valign="top"
> class="displaylabel">Execution
> Method: </td>
> <td valign="top"
> class="displaydata"><Execution
> Method ></td>
> <td colspan="2" valign="top"
> class="displaylabel"><img src="images/spacer.gif" width="10"
> height="10"></td>
> </tr>
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr>
> <td colspan="4" valign="top"
> class="tableheader">Product
> Eligibility </td>
> </tr>
> <tr >
> <td colspan="4" valign="top"
> class="displaylabel">This
> MC Accepts these selling Systems</td>
> </tr>
> <tr >
> <td colspan="4" valign="top"
> class="displaylabel"><img src="images/spacer.gif" width="10"
> height="10"></td>
> </tr>
> <tr>
> <td rowspan="3" valign="top"
> class="displaylabel">PE
> Contract Products:</td>
> <td valign="top"
> class="displaydata"><Contract
> Product> </td>
> <td rowspan="3" valign="top"
> class="displaylabel">Guide
> Contract Products:</td>
> <td valign="top"
> class="displaydata"><Pooling
> Product> </td>
> </tr>
> <tr>
> <td valign="top"
> class="displaydata"><Contract
> Product></td>
> <td valign="top"
> class="displaydata"><Pooling
> Product> </td>
> </tr>
> <tr>
> <td valign="top"
> class="displaydata"><Contract
> Product></td>
> <td valign="top"
> class="displaydata"><Pooling
> Product> </td>
> </tr>
> <tr>
> <td valign="top"
> class="displaylabel">Guide
> Pooling Products:</td>
> <td valign="top"
> class="displaydata"><Pooling
> Product> </td>
> <td colspan="2" valign="top"
> class="displaylabel"><img src="images/spacer.gif" width="10"
> height="10"></td>
> </tr>
> <tr>
> <td colspan="4" valign="top"
> class="displaylabel"><table width="100%" border="0" cellspacing="0"
> cellpadding="0">
> <tr>
> <td width="24%" align="left"
> valign="top" class="displaylabel">
> <p>Negotiated Contract Products:
> </p></td>
> <td width="38%" align="left"
> valign="top" class="displaylabel">
> <input type="checkbox"
> name="checkbox" value="checkbox">
> 15 Year Convertible Biweekly<br>
> <input type="checkbox" name="checkbox2" value="checkbox">
> 30 Year Convertible Biweekly<br>
> <input type="checkbox" name="checkbox3" value="checkbox">
> 15 Year Non-Convertible
> Biweekly<br>
> <input type="checkbox"
> name="checkbox4" value="checkbox">
> 30 Year Non-Convertible
> Biweekly<br>
> </td>
> <td width="38%" align="left"
> valign="top" class="displaylabel">
> <input type="checkbox"
> name="checkbox5" value="checkbox">
> 15 Year Fixed Rate FHA/Va<br>
> <input type="checkbox" name="checkbox52" value="checkbox">
> 20 Year Fixed Rate FHA/Va<br>
> <input type="checkbox" name="checkbox53" value="checkbox">
> 30 Year Fixed Rate FHA/Va </td>
> </tr>
> </table></td>
> </tr>
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr>
> <td colspan="4" valign="top"
> class="tableheader">Servicing
> Terms </td>
> </tr>
> <tr>
> <td valign="top"
> class="displaylabel">Prepayment
> Remittance Due Days:</td>
> <td>
> <select name="select" size="1">
> <option selected>5</option>
> <option>------------</option>
> </select></td>
> <td valign="top"
> class="displaylabel">Interest/Principle
> Remittance Type:</td>
> <td><select name="select3" size="1">
> <option
> selected>Scheduled/Scheduled</option>
> <option>------------</option>
> </select></td>
> </tr>
> <tr>
> <td valign="top" class="displaylabel">Flex
> Option:</td>
> <td valign="top"><select name="select2"
> size="1">
> <option selected>No</option>
> <option>------------</option>
> </select></td>
> <td colspan="2" valign="top"
> class="displaylabel"><img src="images/spacer.gif" width="10"
> height="10"></td>
> </tr>
> <tr>
> <td colspan="4"><img
> src="images/spacer.gif" width="10" height="10"></td>
> </tr>
> <tr align="center" valign="middle">
> <td colspan="4"> <table width="98%"
> border="0" cellpadding="0" cellspacing="0">
> <tr class="tableheader">
> <td class="tableheader2"><div
> align="left">Remittance
> Cycle Option</div></td>
> <td
> class="tableheader2">Allowed</td>
> <td
> class="tableheader2">Mandatory/Option</td>
> <td class="tableheader2">Float
> Value</td>
> <td class="tableheader2">Remittance
> Day</td>
> </tr>
> <tr class="tablelightrow">
> <td align="left"
> class="tablelightrow"><div align="left">Gold
> Guarantor</div></td>
> <td class="tablelightrow">Yes</td>
> <td
> class="tablelightrow">Optional</td>
> <td
> class="tablelightrow">Locked</td>
> <td
> class="tablelightrow"> </td>
> </tr>
> <tr class="tabledarkrow">
> <td align="left"
> class="tabledarkrow"><div align="left">SuperARC
> Remittance Day</div></td>
> <td class="tabledarkrow">Yes</td>
> <td
> class="tabledarkrow">Mandatory</td>
> <td
> class="tabledarkrow">Prevailing</td>
> <td class="tabledarkrow"> </td>
> </tr>
> <tr>
> <td align="left"
> class="tablelightrow"><div align="left">Super
> ARC</div></td>
> <td class="tablelightrow">Yes</td>
> <td class="tablelightrow">N/A</td>
> <td class="tablelightrow">N/A</td>
> <td class="tablelightrow"><input
> name="textfield" type="text" size="15"></td>
> </tr>
> </table></td>
> </tr>
> </table></td>
> </tr>
> </table>
>
> </td>
> </tr>
> </table>
> <br></td>
> </tr>
> </table></td>
> </tr>
> <tr>
> <td> </td>
> </tr>
> </table>
> <p> </p>
> <p> </p></td>
> </tr>
> </table>
> <p> </p>
> </form>
> </span>
> </body>
> </html>
>
> Thanks for any help,
> Jeff Cooper
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org