Hmmm.
Thanks Erik.
I defined a method in my base class with a getter for getting a ValidationDelegate, and loading the page no longer throws an error.
However, when I submit the form, and the validation is triggered, an runtime exception is thrown "Component InvestorEditor does not define a bean name delegate." The stack trace shows tapestry is looking to the bean provider to provide a delegate bean.
Here's my page spec
<?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.ughm.app.view.tapestry.pages.entities.users.investor.InvestorEditorPage">
<property-specification name="editUser"
type="com.ughm.entities.users.Investor"
persistent="no"/> <bean name="required"
class="org.apache.tapestry.valid.StringValidator"
lifecycle="page">
<set-property name="required" expression="true"/>
</bean><component id="editForm" type="Form">
<binding name="listener" expression="listeners.formSubmit" />
<binding name="delegate" expression="investorDelegate" />
</component> </page-specification>
Note I have an accessor expression "investorDelegate" that should resolve to the following method on the base class :
public InvestorUserDelegate getInvestorDelegate()
{ return new InvestorUserDelegate();
}
Not sure what I'm doing wrong, but it appears Tapestry is expecting a bean to be found for the delegate binding.
??
Thanks for any help here !
tappapp
Erik Hatcher wrote:
You don't need to use <bean> to define these things. You can simply return an IValidator and ValidationDelegate from anywhere you like. I've often used a base page class with getters for this purpose.
Erik
On Apr 30, 2005, at 4:23 PM, Random Tapestry User wrote:
Hey all,
I think I'm missing something simple. I've read the book, but not sure if I came across how to do this, or wasn't sure what I was looking at if I did.
I have a number of pages, that use the same component.
Here's what I have.
I have a user registration page, "RegisterUser.page", with a first and last name component, and html template, named "UserNameElements.jwc", and "UserNameElements.html".
I also have a user update page, "EditUser.page" which uses the same "UserNameElements.jwc" component.
The first and last name, are required elements in the "UserNameElements.jwc", however, I find I'm having to define the "required" bean, and my form "delegate" bean in both the "RegisterUser.page" and in the "EditUser.page".
Since only the "UserNameElements.jwc" use the "required" and "delegate" beans (in this simple example), isn't there somewhere I can define those, perhaps in the "UserNameElements.jwc" ?
Thanks all, tappapp
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
