You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by nazarhussain_s <na...@gmail.com> on 2011/04/14 06:37:31 UTC
Help required in using AJAX Functionality in Tapestry 4.1
Hi,
I am new to tapestry and have a requirement to implement AJAX
Functionality in Tapestry 4.0. I am writing a simple program wherein i
enter a value in a textfield and click on the submit button and that value
has to be displayed in the same page without the page being
refreshed.Currently I am following Kent Tong's Enjoying Web Framework with
Tapestry 3rd Edition wherein a huge example program on AJAX is given which i
am finding hard to follow and implement.
Here is the Home.page,Home.html and java file for my program
Please guide me whether i have written the right code for meeting the above
functionality
Home.html
-------------
Home.page
-------------
<?xml version="1.0" ?>
<!DOCTYPE page-specification PUBLIC "-//Apache Software
Foundation//Tapestry Specification 4.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd">
Home.java
-------------
package com.tapestry;
import org.apache.hivemind.util.PropertyUtils;
import org.apache.tapestry.html.BasePage;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IPage;
import org.apache.tapestry.annotations.*;
public abstract class HelloWorld extends BasePage {
public IRequestCycle cycle;
@InjectPage("Home")
public abstract IPage getResultPage();
public abstract String getUserName();
public abstract String getUserName1();
public abstract void setUserName1(String userName1);
public IPage onFormSubmit(IRequestCycle cycle){
setUserName1(getUserName());
IPage resultPage = getResultPage();
String temp = "test :";
PropertyUtils.write(getResultPage(),"userName1",temp + new
String(getUserName1()));
return resultPage;
}
}
P.S - I being a novice to both AJAX and Tapestry do not know much in details
.Please provide brief about any corrections to be done to this code.
Regards
Nazar
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Help-required-in-using-AJAX-Functionality-in-Tapestry-4-1-tp6271536p6271536.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Help required in using AJAX Functionality in Tapestry 4.1
Posted by LLTYK <LL...@mailinator.com>.
I never looked into how to receive values back in T4 ajax, I only did the
send part. Although doing a search on that annotation I mentioned before
might help.
--
View this message in context: http://tapestry-users.832.n2.nabble.com/Help-required-in-using-AJAX-Functionality-in-Tapestry-4-1-tp6271536p6272286.html
Sent from the Tapestry Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org