Folks,
The following code will show a working example of the Tapestry Radio buttons.
Special care should be taken for the TYPE of the parameters passed too and from
the
radio button as getting that wrong appears to silently blow out the
functionality.
Files Included:
peReportCriteria.page
peReportCriteria.html
PeReportCriteria.java
-------------------------------------------------------------------------------------
peReportCriteria.page
Radio button is not mentioned in the .page file.
-------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
<page-specification class="com.ingenix.freya.web.reporting.PeReportCriteria">
</page-specification>
-------------------------------------------------------------------------------------
peReportCriteria.html
selected="ognl:editErrorType" <-- This is the most important parameter. This
takes the preset value (which button should
be selected by default) and then after a
selection has been made, this parameter
will
be found to have the identity (CLAIM,
PATIENT,
etc.) of the choice they made.
-------------------------------------------------------------------------------------
<span jwcid="@If" condition="ognl:editErrorReport" conditionValue="ognl:true">
<table border="0" cellspacing="8" cellpadding="0" width="100%">
<TR>
<TD style="border:1px solid black;" width="100%">
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<TR style="line-height:24px;">
<TD colspan="5" bgcolor="#F2BE44" width="100%"><strong>Sort
By</strong></TD>
</TR>
<TR bgcolor="#E8ECF4" style="line-height:24px;">
<TD colspan="5" width=100%">
<SPAN jwcid="[EMAIL PROTECTED]" selected="ognl:editErrorType"
displayName="Sort By">
<input jwcid="@Radio" name="editErrorType" type="radio"
value="CLAIM" checked/>Claim
<input jwcid="@Radio" name="editErrorType" type="radio"
value="PATIENT"/>Patient
<input jwcid="@Radio" name="editErrorType" type="radio"
value="PROVIDER"/>Provider
<input jwcid="@Radio" name="editErrorType" type="radio"
value="PLAN"/>Plan
<input jwcid="@Radio" name="editErrorType" type="radio"
value="ACCOUNT"/>Account
</SPAN>
</TD>
</TR>
</table>
</TD>
</TR>
</table>
</span>
-------------------------------------------------------------------------------------
PeReportCriteria.java
Because this class contains pages of material not
related
to the radio button, I am just giving the pieces that
do.
If they appear in a special method, I will provide the
whole
method.
-------------------------------------------------------------------------------------
public abstract void setEditErrorType( String pEditErrorType );
public abstract String getEditErrorType();
// This method is called when the page loads.
public void finishLoad()
{
IRequestCycle cycle = this.getRequestCycle();
if( !cycle.isRewinding() )
{
//... irrelevant stuff omitted.
String eet = getEditErrorType();
if( eet == null )
{
setEditErrorType( "CLAIM" ); // This sets the preset.
}
}
}
// This is the listener method that is called when a user
// clicks on a button on the page. By the time this button
// has been clicked, the user should have made a selection
// on the radio button, although if they hadn't the default
// value will be sent back.
public void generateHTMLReport()
{
IRequestCycle cycle = getRequestCycle();
// ... irrelevant stuff omitted.
String editReportType = getEditErrorType();
cycle.setListenerParameters( ... , editReportType ) );
cycle.activate( "peReportGeneration" );
}
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Tacos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tacos-devel