Hi,
I have been writing in awfully often. If this is not appreciated, please
let me know.
This is my problem. I am trying to use Tapestry's built in field
validation... and I am running into trouble.
I have a text control handled by the Tapestry component 'ValidField' - the
source of my problem.
I am getting a NullPointer Exception. I have included the stack trace at
the end of this mail.
My code is mostly copied from the Tutorials.
Can anyone help me?
Thanks in advance!
Regards,
Manoj
----------------------------- This is the TestForm.jwc file
-----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: Home.jwc,v 1.6 2002/05/13 14:00:37 hship Exp $ -->
<!DOCTYPE specification PUBLIC
"-//Howard Lewis Ship//Tapestry Specification 1.2//EN"
"http://tapestry.sf.net/dtd/Tapestry_1_2.dtd">
<specification class="items.Test.TestForm">
<bean name="delegate" class="net.sf.tapestry.valid.ValidationDelegate"/>
<component id="loginForm" type="Form">
<binding name="delegate" property-path="beans.delegate"/>
<binding name="listener" property-path="listeners.formSubmit"/>
</component>
<component id="testField" type="ValidField">
<binding name="value" property-path="testField"/>
<static-binding name="displayName">Ticker ID</static-binding>
<field-binding name="validator" field-name
="net.sf.tapestry.valid.StringValidator.REQUIRED"/>
</component>
<!--
<component id="okSubmit" type="Submit">
<binding name="listener" property-path="listeners.okSubmit"/>
</component>
-->
</specification>
----------------------------- This is the TestForm.java file
-----------------------------
public class TestForm extends BasePage
{
private String testField = "asdf";
public void okSubmit(IRequestCycle cycle)
{
cycle.setPage("Two");
}
public void formSubmit(IRequestCycle cycle)
{
cycle.setPage("Two");
}
public String getTestField ()
{
return testField;
}
public void setTestField (String val)
{
testField = val;
}
public void detach()
{
System.out.println( "detach" );
super.detach();
}
}
----------------------------- This is the TestForm.html file
-----------------------------
...
<form jwcid="loginForm">
<table cellpadding="4">
<tr>
<td>Test Field:</td>
<td><input jwcid="testField" /></td>
</tr>
<tr align="right">
<td colspan="2">
<input type="submit" value="Login"/>
<!-- <input jwcid="okSubmit" type="Submit" value="Login" /> -->
</td>
</tr>
</table>
</form>
...
----------------------------- This is the Stack Trace
-----------------------------
net.sf.tapestry.RequestCycleException
component:
items.Test.TestForm@384065[TestForm]
java.lang.NullPointerException
Stack Trace:
*
net.sf.tapestry.valid.BaseValidator.processValidatorScript(BaseValidator.java:269)
*
net.sf.tapestry.valid.StringValidator.renderValidatorContribution(StringValidator.java:178)
* net.sf.tapestry.valid.ValidField.beforeCloseTag(ValidField.java:211)
*
net.sf.tapestry.form.AbstractTextField.renderComponent(AbstractTextField.java:122)
* net.sf.tapestry.valid.ValidField.renderComponent(ValidField.java:186)
* net.sf.tapestry.AbstractComponent.render(AbstractComponent.java:891)
* net.sf.tapestry.AbstractComponent.renderBody(AbstractComponent.java:665)
* net.sf.tapestry.form.Form.renderComponent(Form.java:325)
* net.sf.tapestry.AbstractComponent.render(AbstractComponent.java:891)
* net.sf.tapestry.BaseComponent.renderComponent(BaseComponent.java:460)
* net.sf.tapestry.AbstractComponent.render(AbstractComponent.java:891)
* net.sf.tapestry.AbstractPage.renderPage(AbstractPage.java:303)
* net.sf.tapestry.engine.RequestCycle.renderPage(RequestCycle.java:413)
*
net.sf.tapestry.engine.AbstractEngine.renderResponse(AbstractEngine.java:610)
* net.sf.tapestry.engine.PageService.service(PageService.java:94)
* net.sf.tapestry.engine.AbstractEngine.service(AbstractEngine.java:735)
* net.sf.tapestry.ApplicationServlet.doService(ApplicationServlet.java:176)
* net.sf.tapestry.ApplicationServlet.doGet(ApplicationServlet.java:144)
* javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
* javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
* org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:371)
* org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:613)
* org.mortbay.http.HttpContext.handle(HttpContext.java:1387)
* org.mortbay.http.HttpContext.handle(HttpContext.java:1326)
* org.mortbay.http.HttpServer.service(HttpServer.java:757)
* org.mortbay.http.HttpConnection.service(HttpConnection.java:741)
* org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:914)
* org.mortbay.http.HttpConnection.handle(HttpConnection.java:756)
* org.mortbay.http.SocketListener.handleConnection(SocketListener.java:151)
* org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:287)
* org.mortbay.util.ThreadPool$JobRunner.run(ThreadPool.java:715)
* java.lang.Thread.run(Thread.java:484)
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer