AjaxFormLoop - Communication with the server failed: undefined
Hi, i have issue with AjaxFormLoop after i`ve updated from 5.2.6 to 5.3.1. When i click on AddRow link following javascript error occurs (copy/paste from firebug): Communication with the server failed: undefined consolefn consolefn.call(console, message); t5-console.js (line 61) Ajax failure: Status 200 for /Katalog/cs/settings/userinfo.contacts.rowinjector:inject?t:ac=1t:formcomponentid=settings/UserInfo:settingsformt:formid=settingsForm: undefined Here is the AjaxFormLoop: t:form class=full-form t:id=settingsForm... div t:type=AjaxFormLoop t:id=contacts source=employee.contactList value=employeeContact t:encoder=encoder div class=fields t:select t:id=contactType value=employeeContact.type blankOption=never/ t:textfield t:id=contactNumber class=phoneField value=employeeContact.number/ t:removerowlink${message:remove}/t:removerowlink /div /div /t:form Please help, thanks a lot. -- View this message in context: http://tapestry.1045711.n5.nabble.com/AjaxFormLoop-Communication-with-the-server-failed-undefined-tp5437779p5437779.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Referencing the context path from within Javascript?
On Sat, 28 Jan 2012 17:43:17 -0200, Julien Martin bal...@gmail.com wrote: Hello, Hi! How can I achieve this with T5? As a general answer, you can @Inject HttpServletRequest and use its getContextPath() method. Depending on who handles this URL (a Tapestry page? a Tapestry page event handler method), the response would be different. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Referencing the context path from within Javascript?
2012/1/28 Julien Martin bal...@gmail.com Hello Thiago, It is on a page template. The advice you provide does work. However, I am realizing I need to concatenate the protocol+host+etc. which is a bit cumbersome. The problem I have is that I don't understand how the path is worked out. My javascript is located at the following path: /context-path/account/childminderRegistration and I need to resolve the following path: /context-path/utils/JSonPostcodesWithQueryParam for the url javascript variable. Is there a simpler way for my script to hit the proper path? Regards, J. 2012/1/28 Thiago H. de Paula Figueiredo thiag...@gmail.com On Sat, 28 Jan 2012 17:43:17 -0200, Julien Martin bal...@gmail.com wrote: Hello, Hi! How can I achieve this with T5? As a general answer, you can @Inject HttpServletRequest and use its getContextPath() method. Depending on who handles this URL (a Tapestry page? a Tapestry page event handler method), the response would be different. -- Thiago H. de Paula Figueiredo Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, Ars Machina Tecnologia da Informação Ltda. http://www.arsmachina.com.br
Reusing tapestry hibernate session in a thread
Hi, I have a batch job that sends email to users based on a query in my database. AppModule starts it up like so in a: @Startup public static void scheduleJobs(PeriodicExecutor executor, final BulkEmailer emailer, @Value(${liftyourgame.url}) String urlIn, @Value(${liftyourgame.subject}) String subjectIn, final SendEmail sendEmail ) { final String url = urlIn; final String subject = subjectIn; executor.addJob(new CronSchedule(0 0/5 * * * ?), BulkEmailer, new Runnable() { public void run() { emailer.execute(url + /liftyourgame/, subject, sendEmail); } }); } In order to query the database the thread needs a hibernate session of its own as hibernate sessions are per thread. Currently it creates a session and DAO like so: public synchronized void execute(String url, String subject, SendEmail sendEmail) { // For each mailout fetch url and send mailout if (factory == null) { Configuration cfg = new Configuration(); factory = cfg.configure().buildSessionFactory(); } Session session = factory.openSession(); userDAO = new UserDAOImpl(session); / This means I need to add all of my entities in hibernate.cfg.xml: mapping package=com.liftyourgame.application.entities/ mapping class=com.liftyourgame.application.entities.Action/ mapping class=com.liftyourgame.application.entities.DailyQuote/ mapping class=com.liftyourgame.application.entities.Goal/ mapping class=com.liftyourgame.application.entities.Image/ mapping class=com.liftyourgame.application.entities.LygEntity/ mapping class=com.liftyourgame.application.entities.Measure/ mapping class=com.liftyourgame.application.entities.Measurement/ mapping class=com.liftyourgame.application.entities.Role/ mapping class=com.liftyourgame.application.entities.User/ Tapestry doesn't seem to need these mappings for my web application as tapestry-hibernate seems to scan all classes in the entities package. Is there some way I could use tapestry-hibernate to setup a session for my thread? Regards, Greg - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Reusing tapestry hibernate session in a thread
In answer to my own question: Inject HibernateSessionSource and call its create() method to get a new session. public synchronized void execute(String url, String subject, SendEmail sendEmail, HibernateSessionSource sessionSource) { // For each mailout fetch url and send mailout logger.debug(BulkEmailerImpl.execute was called ); Session session = sessionSource.create(); userDAO = new UserDAOImpl(session); I just need to find a better way of instantiating the DAO. Regards, Greg Original Message Subject:Reusing tapestry hibernate session in a thread Date: Sun, 29 Jan 2012 11:28:41 +1000 From: Greg Pagendam-Turner g...@liftyourgame.com Organization: Liftyourgame To: Tapestry users scheduled thread users@tapestry.apache.org Hi, I have a batch job that sends email to users based on a query in my database. AppModule starts it up like so in a: @Startup public static void scheduleJobs(PeriodicExecutor executor, final BulkEmailer emailer, @Value(${liftyourgame.url}) String urlIn, @Value(${liftyourgame.subject}) String subjectIn, final SendEmail sendEmail ) { final String url = urlIn; final String subject = subjectIn; executor.addJob(new CronSchedule(0 0/5 * * * ?), BulkEmailer, new Runnable() { public void run() { emailer.execute(url + /liftyourgame/, subject, sendEmail); } }); } In order to query the database the thread needs a hibernate session of its own as hibernate sessions are per thread. Currently it creates a session and DAO like so: public synchronized void execute(String url, String subject, SendEmail sendEmail) { // For each mailout fetch url and send mailout if (factory == null) { Configuration cfg = new Configuration(); factory = cfg.configure().buildSessionFactory(); } Session session = factory.openSession(); userDAO = new UserDAOImpl(session); / This means I need to add all of my entities in hibernate.cfg.xml: mapping package=com.liftyourgame.application.entities/ mapping class=com.liftyourgame.application.entities.Action/ mapping class=com.liftyourgame.application.entities.DailyQuote/ mapping class=com.liftyourgame.application.entities.Goal/ mapping class=com.liftyourgame.application.entities.Image/ mapping class=com.liftyourgame.application.entities.LygEntity/ mapping class=com.liftyourgame.application.entities.Measure/ mapping class=com.liftyourgame.application.entities.Measurement/ mapping class=com.liftyourgame.application.entities.Role/ mapping class=com.liftyourgame.application.entities.User/ Tapestry doesn't seem to need these mappings for my web application as tapestry-hibernate seems to scan all classes in the entities package. Is there some way I could use tapestry-hibernate to setup a session for my thread? Regards, Greg