T5 Reference page attributes from a component
In our T4 app we made a lot of use of this type of construct: This particular component is embedded 4 layers deep and was able to reach back all the way to Page class to get values. Is there a similar construct in T5 or am I going to have to pass these values explicitly down the components? Thanks Tony - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
onPrepare(Integer id)
I'm trying to create a simple form that will work for both Add and Edit. I'm trying to use onPrepare to setup the database object and the code works fine for an existing object. When I try to use the form with a new object (id = null) it appears that onPrepare isn't called, so I end up with null pointer exceptions trying to build the form. Here is my simple controller: package com.starpoint.helpdesk.pages.office; import com.starpoint.helpdesk.business.OfficeLogic; import com.starpoint.helpdesk.domain.Office; import com.sun.istack.internal.Nullable; import org.apache.tapestry5.annotations.Log; import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.ioc.annotations.Inject; import org.slf4j.Logger; /** */ public class EditOffice { @Inject private Logger logger; @Inject private OfficeLogic officeLogic; @Persist private Integer officeId; @Property private Office office; public Integer getOfficeId() { return officeId; } @Log public void setOfficeId(@Nullable Integer officeId) { this.officeId = officeId; } @Log void onPrepare(Integer officeId) { if (office == null) { office = officeId == null ? new Office() : officeLogic.getOffice(officeId); } } void onActivate(Integer officeId) { this.officeId = officeId; } Integer onPassivate() { return officeId; } public Object onSuccess() { logger.info("**: " + office.toString()); return this; } } And my form: http://tapestry.apache.org/schema/tapestry_5_1_0.xsd"; xmlns:p="tapestry:parameter"> Office Name Save Office What am I missing? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Tapestry Hibernate Sessions
On Jun 10, 2011, at 11:32 AM, Thiago H. de Paula Figueiredo wrote: > On Fri, 10 Jun 2011 12:12:01 -0300, Tony Nelson wrote: > >> So maybe I should have sent this question to the Spring list? > > If you're not using Tapestry-Hibernate this question went to the wrong list. > :) > Indeed it was a Spring related issue. Doing some more searching I found that Spring requires @Transactional now, and I had only added my data access tier. Creating a quick business tier and marking the interface @Transactional solved the problem. For anyone that may find this in [insert favorite search engine] later: My interface for my business class: package com.starpoint.helpdesk.business; import com.starpoint.helpdesk.domain.Office; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Transactional(readOnly = true) public interface OfficeLogic { List getAllOffices(); } The page was of course updated to call this method instead of the DAO directly. The updated applicationContext.xml is: http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:context="http://www.springframework.org/schema/context"; xmlns:tx="http://www.springframework.org/schema/tx"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"; default-autowire="byName" >
Re: Tapestry Hibernate Sessions
On Jun 10, 2011, at 10:47 AM, Tony Nelson wrote: > Hi all, > > I'm in the process of rebuilding an app that was done in Tap3 (indeed!) in > Tap5. It's a small app, maybe a dozen pages used by my internal staff. This > is in preparation for rebuilding the entire front of a much larger app. But > that's a story for another day. > > Because I want to learn all the new Tap5 goodness, I started with an new > project built w/ the maven archetype. I copied over my DB classes and added > the Spring dependencies I needed, and wrote a test case to make sure I could > read and write from my dev (h2) database. > > Then I created a very small page that displays a few rows from the DB in a > table. The service method is trivial: > >@Log >public List getOffices() { >return officeDao.getAllOffices(); >} > > I fired up Jetty, and opened the page. I really expected to get an exception > saying that I don't have a database session because I purposely did not > include the OpenSessionInView filter that I'm familiar with. In addition I > didn't include the tapestry-hibernate jars because I'm not sure if it's > better to have Tap of Spring handle opening and closing the sessions. > > I was very surprised when the page actually rendered a result from the > database. I'm still not clear where the session is coming from, but that is > actually my problem. I can reload my tiny test page 8 times. On the 9th > time, I see: > > [582385532@qtp-918884489-5] DEBUG com.starpoint.helpdesk.pages.Offices - > [ENTER] getOffices() > > And the browser spins. I can open the H2 DB in the H2 admin console and > issue queries against it, so the H2 instance is fine. > > Obviously I'm either out of sessions or connection pool slots. My goal is to > be able to use the Spring @Transactional annotation because in the larger app > rewrite I have several dozen business layer Spring managed beans that depend > on it. > > I have tried adding Springs OpenSessionInViewFilter, and I've tried adding a > dependency on tapestry-hibernate-core. Neither of these solutions have > helped. > > Can anyone offer any suggestions as to where the session is actually coming > from so that I can try to figure out how to get the session closed or > released? > > I have Spring configured like this: > > > http://www.springframework.org/schema/beans"; > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; > xmlns:context="http://www.springframework.org/schema/context"; > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd > http://www.springframework.org/schema/context > http://www.springframework.org/schema/context/spring-context.xsd"; >default-autowire="byName" > > > > > > > > > > > > class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> > > > > > > > class="org.springframework.orm.hibernate3.HibernateTransactionManager"> > > > > > > > > > > and my web.xml is simply: > > > PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" >"http://java.sun.com/dtd/web-app_2_3.dtd";> > >Starpoint Help Desk Tapestry 5 Application > > > >tapestry.app-package >com.starpoint.helpdesk > > > >contextConfigLocation >classpath:/applicationContext.xml > > > >app > > org.apache.tapestry5.spring.TapestrySpringFilter > > > >app >/* > > > > I turned on debug logging and get this when the request hangs: [1828511825@qtp-68769219-3] DEBUG com.starpoint.helpdesk.pages.Offices - [ENTER] getOffices() [1828511825@qtp-68769219-3] DEBUG org.springframework.orm.hibernate3.SessionFactoryUtils - Opening Hibernate Session [1828511825@qtp-68769219-3] DEBUG org.hibernate.impl.SessionImpl - opened session at timestamp: 13077185704 [1828511825@qtp-68769219-3] DEBUG org.hibernate.jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0) [1828511825@qtp-68769219-3] DEBUG org.hibernate.jdbc.ConnectionManager - opening JDBC connection So maybe I should have sent this question to the Spring list? All the same, does anyone have any insight into what I may have done wrong? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Tapestry Hibernate Sessions
Hi all, I'm in the process of rebuilding an app that was done in Tap3 (indeed!) in Tap5. It's a small app, maybe a dozen pages used by my internal staff. This is in preparation for rebuilding the entire front of a much larger app. But that's a story for another day. Because I want to learn all the new Tap5 goodness, I started with an new project built w/ the maven archetype. I copied over my DB classes and added the Spring dependencies I needed, and wrote a test case to make sure I could read and write from my dev (h2) database. Then I created a very small page that displays a few rows from the DB in a table. The service method is trivial: @Log public List getOffices() { return officeDao.getAllOffices(); } I fired up Jetty, and opened the page. I really expected to get an exception saying that I don't have a database session because I purposely did not include the OpenSessionInView filter that I'm familiar with. In addition I didn't include the tapestry-hibernate jars because I'm not sure if it's better to have Tap of Spring handle opening and closing the sessions. I was very surprised when the page actually rendered a result from the database. I'm still not clear where the session is coming from, but that is actually my problem. I can reload my tiny test page 8 times. On the 9th time, I see: [582385532@qtp-918884489-5] DEBUG com.starpoint.helpdesk.pages.Offices - [ENTER] getOffices() And the browser spins. I can open the H2 DB in the H2 admin console and issue queries against it, so the H2 instance is fine. Obviously I'm either out of sessions or connection pool slots. My goal is to be able to use the Spring @Transactional annotation because in the larger app rewrite I have several dozen business layer Spring managed beans that depend on it. I have tried adding Springs OpenSessionInViewFilter, and I've tried adding a dependency on tapestry-hibernate-core. Neither of these solutions have helped. Can anyone offer any suggestions as to where the session is actually coming from so that I can try to figure out how to get the session closed or released? I have Spring configured like this: http://www.springframework.org/schema/beans"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:context="http://www.springframework.org/schema/context"; xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"; default-autowire="byName" > and my web.xml is simply: http://java.sun.com/dtd/web-app_2_3.dtd";> Starpoint Help Desk Tapestry 5 Application tapestry.app-package com.starpoint.helpdesk contextConfigLocation classpath:/applicationContext.xml app org.apache.tapestry5.spring.TapestrySpringFilter app /* Thanks in advance Tony Nelson Starpoint Solutions - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [Tap 4.1.2] Problem with repeated calls to an If component
I have noticed similar things happening in my code on the 4.1.2 snapshot as well. Trying to debug the issue I'm having w/ DatePicker (different thread) I added a conditional to the page, and used your strategy of counting @If calls just to see what I get. The first time I load the page, on the very first display, my page shows that the conditional was called 4 times. Every time I submit the form, and it redisplays, the conditional is called only one time. I am actually very hopeful that the solution to this problem, will also yield a solution to other problems I am seeing that are very hard to replicate that involve nested components throwing OGNL null pointer exceptions when I know for a fact that the data should exist. For completeness, my template: consoleEnabled="ognl:true"> Test: You picked format="ognl:format.numericDate" /> Current Number: And my controller package com.starpoint.instihire.web.tapestry.page; import org.apache.log4j.Logger; import org.apache.tapestry.annotations.Component; import org.apache.tapestry.annotations.EventListener; import org.apache.tapestry.annotations.Meta; import org.apache.tapestry.annotations.InitialValue; import org.apache.tapestry.event.BrowserEvent; import org.apache.tapestry.event.PageEvent; import org.apache.tapestry.event.PageBeginRenderListener; import org.apache.tapestry.form.TextField; import java.util.Date; @Meta("permissions=ANY") public abstract class Test extends ProtectedPage implements PageBeginRenderListener { public static final Logger logger = Logger.getLogger(Test.class); public abstract Date getTheDate(); public abstract void setTheDate(final Date theDate); @InitialValue("0") public abstract int getNumber(); public abstract void setNumber(int n); public void submit() { } public boolean getShowTheDate() { setNumber(getNumber() + 1); return getTheDate() != null; } } I hope this helpful. As always, thanks again Tony Daniel Jue wrote: Hi, I experienced this problem after upgrading from Tap 4.1 to Tap 4.1.2 Snapshot. The problem is that I have an IF component that is being called 3 times, when it should only be called once. I have extracted the problem into a simpler page for examination: plain.page: http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd";> plain.java: package com.phy6.app; import javax.servlet.ServletContext; import org.apache.tapestry.IComponent; import org.apache.tapestry.annotations.Component; import org.apache.tapestry.annotations.InitialValue; import org.apache.tapestry.annotations.InjectObject; import org.apache.tapestry.annotations.InjectStateFlag; import org.apache.tapestry.html.BasePage; public abstract class plain extends BasePage { /** * @return a boolean indicating if the the user is logged in */ @InjectStateFlag("user") public abstract boolean getUserExists(); @InitialValue("0") public abstract int getNumber(); public abstract void setNumber(int n); /** * @return the servlet context */ @InjectObject("service:tapestry.globals.ServletContext") public abstract ServletContext getServletContext(); @Component(type = "If", id = "ifUserIsLoggedIn", bindings = { "condition=getUserIsLoggedIn()" }) public abstract IComponent getIfUserIsLoggedIn(); /** * @return a boolean indicating whether or not a user is logged in. */ public boolean getUserIsLoggedIn() { setNumber(getNumber() + 1); System.out.println("plain: getUserIsLoggedIn() " + getNumber()); return getUserExists(); } @Component(type="Insert",id="wtfisgoingon",bindings={"value=getNumber()"}) public abstract IComponent getWTFisgoingon(); } plain.html: Hi Output to console: INFO: Server startup in 3966 ms plain: getUserIsLoggedIn() 1 plain: getUserIsLoggedIn() 2 plain: getUserIsLoggedIn() 3 Output to browser: 3 Note that I've stripped the code down. There is no way for the user to exist in this example, I'm simply reloading the page when the server starts. (Tomcat 5.5.23) This code was part of my Home.page, which decides whether or not to display a login component or greet the user. How can I get it to only check the IF component once? (or better yet, why is it called three times?) Daniel - 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]
Re: Hopefully an easy one
No, it will accept user input as: 5/17/07 which gets translated in my queries to 5/17/0007 and causes hibernate to self destruct. If a user enters 5/17/07 I expect an error to be raise, but alas, no. Thanks Tony Andreas Andreou wrote: doesn't translator="translator:date,pattern=MM/dd/" work? On 5/17/07, Tony Nelson <[EMAIL PROTECTED]> wrote: I have a simple DatePicker All that I want to do is verify that the user entered the date as MM/DD/. What is the correct validator to use in this situation? Thanks again Tony Nelson - 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]
Hopefully an easy one
I have a simple DatePicker value="ognl:tradeSearchKeys.receivedTimesheetForWeekEnding" translator="translator:date,pattern=M/d/" validators="validators:required" displayName="As of Date"/> All that I want to do is verify that the user entered the date as MM/DD/. What is the correct validator to use in this situation? Thanks again Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I'm missing something obvious
I'm assuming that any value between 1 and 99 should work. I just tried 1234 and it failed as does every other number I type in. Playing w/ the page at opencomponentry that you linked below, the validators seem to work fine which is why I can't figure out what's up. I really think I must have a typo, a missing comma or something just crazy but I can't find it. Thanks again for all of your efforts Tony Jesse Kuhnert wrote: Hmm doesn't seem to be conjuring up any eurekas for me currently. . I wonder what the difference is between your field and the fields on the Workbench form? http://opencomponentry.com:8080/workbench/Home,$Border.pageLink.sdirect?sp=SFields It has a similar setup but I can't see where the error is happening. What exact value should pass but is failing for you? Just to be sure. On 5/14/07, Tony Nelson <[EMAIL PROTECTED]> wrote: Sorry Jesse, I didn't realize this message didn't have the whole trail. I have a simple input: the tradeId property is nothing more than: public abstract Integer getTradeId(); No matter what value I enter, valid or not, I alway get a dojo popup with 3 errors, the input must be a number, it must be greater than 0 and less than 10. I can get past this issue by disabling client validation, but I really don't want to do that. I believe the dojo warning I'm seeing is from a datePicker that is on the form, but I will have to do some more research. Thanks again for all of your help. Tony Nelson Jesse Kuhnert wrote: > What issue exactly is it that you see? > > If you could provide the exact text that is presented as the reason > for the > error as well as what input you gave it to produce the error I can be > more > helpful. > > On 5/14/07, Tony Nelson <[EMAIL PROTECTED]> wrote: >> >> Grabbing today's latest build, I'm still seeing the same dojo validation >> issue. As a bonus, there is a new debug message: >> >> DEBUG: EXPERIMENTAL: dojo.i18n.number -- Not yet ready for use. APIs >> subject to change without notice. >> >> Happy Monday! >> >> Thanks in advance, >> Tony Nelson >> >> >> > > > - 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]
Re: I'm missing something obvious
Sorry Jesse, I didn't realize this message didn't have the whole trail. I have a simple input: the tradeId property is nothing more than: public abstract Integer getTradeId(); No matter what value I enter, valid or not, I alway get a dojo popup with 3 errors, the input must be a number, it must be greater than 0 and less than 10. I can get past this issue by disabling client validation, but I really don't want to do that. I believe the dojo warning I'm seeing is from a datePicker that is on the form, but I will have to do some more research. Thanks again for all of your help. Tony Nelson Jesse Kuhnert wrote: What issue exactly is it that you see? If you could provide the exact text that is presented as the reason for the error as well as what input you gave it to produce the error I can be more helpful. On 5/14/07, Tony Nelson <[EMAIL PROTECTED]> wrote: Grabbing today's latest build, I'm still seeing the same dojo validation issue. As a bonus, there is a new debug message: DEBUG: EXPERIMENTAL: dojo.i18n.number -- Not yet ready for use. APIs subject to change without notice. Happy Monday! Thanks in advance, Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: I'm missing something obvious
Grabbing today's latest build, I'm still seeing the same dojo validation issue. As a bonus, there is a new debug message: DEBUG: EXPERIMENTAL: dojo.i18n.number -- Not yet ready for use. APIs subject to change without notice. Happy Monday! Thanks in advance, Tony Nelson Tony Nelson wrote: Does that mean there is a fix floating around somewhere? Thanks Tony [EMAIL PROTECTED] wrote: This is a regression, the JIRA issue is https://issues.apache.org/jira/browse/TAPESTRY-1071 -Original Message----- From: Tony Nelson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 10, 2007 6:57 PM To: Tapestry users Subject: I'm missing something obvious I have a simple form that includes this: And no matter what legal numeric value I enter, I always get a validation error. Where is my typo? Because I certainly can't find it. I'm using yesterdays 4.1.2 snapshot. tapestry tapestry-annotations 4.1.2-20070509.030104-65 true tapestry tapestry-contrib 4.1.2-20070509.030104-68 true tapestry tapestry-framework 4.1.2-20070509.030104-76 true Thanks in advance for any help. Tony - 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]
Re: I'm missing something obvious
Does that mean there is a fix floating around somewhere? Thanks Tony [EMAIL PROTECTED] wrote: This is a regression, the JIRA issue is https://issues.apache.org/jira/browse/TAPESTRY-1071 -Original Message- From: Tony Nelson [mailto:[EMAIL PROTECTED] Sent: Thursday, May 10, 2007 6:57 PM To: Tapestry users Subject: I'm missing something obvious I have a simple form that includes this: And no matter what legal numeric value I enter, I always get a validation error. Where is my typo? Because I certainly can't find it. I'm using yesterdays 4.1.2 snapshot. tapestry tapestry-annotations 4.1.2-20070509.030104-65 true tapestry tapestry-contrib 4.1.2-20070509.030104-68 true tapestry tapestry-framework 4.1.2-20070509.030104-76 true Thanks in advance for any help. Tony - 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]
Re: I'm missing something obvious
Client side.. the nifty new dojo popup. If I disable client side validation it works fine, and I will do that for now.. but I'd really rather not. Thanks again Tony Andreas Andreou wrote: well... the code is correct... i even tried it myself! So, what kind of validation error you get? Client side? or server side? What happens if you disable javascript? On 5/11/07, Tony Nelson <[EMAIL PROTECTED]> wrote: Sorry, I should have supplied that in my original e-mail. public abstract Integer getTradeId(); Thanks again Tony Andreas Andreou wrote: > What's the type of tradeId ? > > On 5/10/07, Tony Nelson <[EMAIL PROTECTED]> wrote: >> >> I have a simple form that includes this: >> >> > validators="validators:required,min=0,max=100" >> translator="translator:number,pattern=0" >> displayName="Trade ID" >> /> >> >> >> And no matter what legal numeric value I enter, I always get a >> validation error. >> >> Where is my typo? Because I certainly can't find it. >> >> I'm using yesterdays 4.1.2 snapshot. >> >> >> tapestry >> tapestry-annotations >> 4.1.2-20070509.030104-65 >> >> true >> >> >> >> tapestry >> tapestry-contrib >> 4.1.2-20070509.030104-68 >> >> true >> >> >> >> tapestry >> tapestry-framework >> 4.1.2-20070509.030104-76 >> >> true >> >> >> >> Thanks in advance for any help. >> >> Tony >> >> >> >> - >> 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]
Re: I'm missing something obvious
Sorry, I should have supplied that in my original e-mail. public abstract Integer getTradeId(); Thanks again Tony Andreas Andreou wrote: What's the type of tradeId ? On 5/10/07, Tony Nelson <[EMAIL PROTECTED]> wrote: I have a simple form that includes this: And no matter what legal numeric value I enter, I always get a validation error. Where is my typo? Because I certainly can't find it. I'm using yesterdays 4.1.2 snapshot. tapestry tapestry-annotations 4.1.2-20070509.030104-65 true tapestry tapestry-contrib 4.1.2-20070509.030104-68 true tapestry tapestry-framework 4.1.2-20070509.030104-76 true Thanks in advance for any help. Tony - 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]
I'm missing something obvious
I have a simple form that includes this: And no matter what legal numeric value I enter, I always get a validation error. Where is my typo? Because I certainly can't find it. I'm using yesterdays 4.1.2 snapshot. tapestry tapestry-annotations 4.1.2-20070509.030104-65 true tapestry tapestry-contrib 4.1.2-20070509.030104-68 true tapestry tapestry-framework 4.1.2-20070509.030104-76 true Thanks in advance for any help. Tony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tap 4.1.2 EventListener
I grabbed the latest snapshot and now the callback is getting called for all of my inputs. Thank you very much. I still get NULL as the value, but I think that's my fault. I'm going to have to do some serious thinking about how this page works. For my understanding, when the "onchange" event fires, what data should I expect to be posted back to the server? The entire form? Or just the changed field? Reading all the logging that I have in my page, it appears as though the entire page is being reconstructed (like a rewind?) on the back end. Is that normal? Should I expect that? I'm going to have to add even more logging, but should I expect pageBeginRender() to be called? I would expect not.. but I might be wrong. I can see that Tapestry is definitely evaluating the entire template because of all the logging I get just updating one field in the browser, and I guess that might be necessary, I just need to figure out what the consequences of that will be on my code. Thanks for all your help Tony Jesse Kuhnert wrote: Yes the feeling was correct. The snapshot version should be fixed and deployed already. Sorry for the inconvenience, you caught me in the middle of some larger changes and I guess this use case was a victim. On 5/3/07, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: Hmm...I have a bad feeling this is my fault - obviously it should work fine as-is. I'll take a look... On 5/3/07, Tony Nelson < [EMAIL PROTECTED]> wrote: > > A little additional info.. when I change the value on any of the inputs > beyond the first one, it is causing the form to be submitted, it just > doesn't call my EventListener method. Also, I am using the latest > (today's) Tapestry build. > > Thanks again > Tony > > Tony Nelson wrote: > > Is it possible to use an EventListener in a component that is > > displayed multiple times on a page? > > > > Specifically, I would like a component that has 2 inputs, and when the > > 1st one is updated an onchange event causes the 2nd component to > > update it's value. From my testing, it appears that only the first > > component responds to a change event (meaning causes my java method to > > be called), and when it's called, I don't seem to have access to the > > updated values. > > > > My component in progress looks like: > > > > > > > value="ognl:jobExportValues.externalJobBoard" /> > > size="5" > /> > > > > And I register the EventListener in the component as follows: > > > >@EventListener(events={"onchange"}, targets="jobIdField") > >public void testEvent() > >{ > >logger.debug("LOOKHERE... " + getJobExportValues().getJobId() + > > > " " + getJobExportValues().getId()); > >} > > > > > > When the listener is actually called, I always get NULL for both > > values. And again, the listener only fires for the first component on > > > the page. > > > > Looking at the page source, it appears that dojo code for all of my > > inputs is being generated which I won't include here due to it's > length. > > > > Any help would be greatly appreciated. Am I just missing the whole > > concept on the new dojo stuff? > > > > Tony > > > > > > > > > - > > 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] > -- Jesse Kuhnert Tapestry/Dojo team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tap 4.1.2 EventListener
A little additional info.. when I change the value on any of the inputs beyond the first one, it is causing the form to be submitted, it just doesn't call my EventListener method. Also, I am using the latest (today's) Tapestry build. Thanks again Tony Tony Nelson wrote: Is it possible to use an EventListener in a component that is displayed multiple times on a page? Specifically, I would like a component that has 2 inputs, and when the 1st one is updated an onchange event causes the 2nd component to update it's value. From my testing, it appears that only the first component responds to a change event (meaning causes my java method to be called), and when it's called, I don't seem to have access to the updated values. My component in progress looks like: value="ognl:jobExportValues.externalJobBoard" /> And I register the EventListener in the component as follows: @EventListener(events={"onchange"}, targets="jobIdField") public void testEvent() { logger.debug("LOOKHERE... " + getJobExportValues().getJobId() + " " + getJobExportValues().getId()); } When the listener is actually called, I always get NULL for both values. And again, the listener only fires for the first component on the page. Looking at the page source, it appears that dojo code for all of my inputs is being generated which I won't include here due to it's length. Any help would be greatly appreciated. Am I just missing the whole concept on the new dojo stuff? Tony - 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]
Tap 4.1.2 EventListener
Is it possible to use an EventListener in a component that is displayed multiple times on a page? Specifically, I would like a component that has 2 inputs, and when the 1st one is updated an onchange event causes the 2nd component to update it's value. From my testing, it appears that only the first component responds to a change event (meaning causes my java method to be called), and when it's called, I don't seem to have access to the updated values. My component in progress looks like: value="ognl:jobExportValues.externalJobBoard" /> And I register the EventListener in the component as follows: @EventListener(events={"onchange"}, targets="jobIdField") public void testEvent() { logger.debug("LOOKHERE... " + getJobExportValues().getJobId() + " " + getJobExportValues().getId()); } When the listener is actually called, I always get NULL for both values. And again, the listener only fires for the first component on the page. Looking at the page source, it appears that dojo code for all of my inputs is being generated which I won't include here due to it's length. Any help would be greatly appreciated. Am I just missing the whole concept on the new dojo stuff? Tony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [vote] remove renderTags default of true for @If/@Else? (tapestry 4.1.2 )
I personally don't care which way you default, but I do think that all tags should have the same default. It's much easier to remember to turn it on/off if I don't have to try and remember which tags have which default. I added: to my Tapestry.application and was able to get the behavior I was after. In short, consistency wins in my book every time. Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tap 4.1.2 translators/validators
If a TextField has both a translator and validators defined, is the input passed from the validators the output of the translators? I have been trying to get something like this working in 4.1.2 (todays snapshot) that worked fine in 4.0. My percentTranslator is registering the dojo events necessary to call: translatePercentage:function(value) { dojo.log.warn("enter translatePercentage"); if(!value){return 0;} var result = parseFloat(value.replace(/%/,'')); dojo.log.warn("result=" + result); return result; } which simply strips any '%' signs out of the input value and returns a Float (which is probably unnecessary). When I submit my test form, I do see the log messages in Firebug as expected, and it definitely is returning the value without a % however I get a dojo validation popup that states the value is non-number, and does not meet the min/max criteria. Is there any way to find out what value is being passed to min/max? Thanks in advance for any help. Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
4.1.2 Translator/Validation
It would seem to me that translators would be called before validators, but I'm not sure how that applies with the new dojo validation. Can someone suggest a place to find a sample? I have a requirement for my project that all inputs that are percentages before formatted with a percent sign at the end of the value in the input box which is easily accomplished with a translator. However if I apply a min or max validator, on submit I get errors because the form doesn't seem to call my translator to get the original value. Have I been staring at this too long? Does what I wrote even make sense? Thanks in advance (again) Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tap 4.1.1 TextField Ajax question
I would be very happy to use Tapestry 4.1.2 but I run into a problem every time I try the latest snapshot: java.lang.NoClassDefFoundError: ognl/enhance/ExpressionAccessor I assume this related to the OGNL stability you mention. Is there a newer beta of OGNL I grab from somewhere to get moving along? If so I'll just throw it in my local repository for now. Thanks again Tony Jesse Kuhnert wrote: You want to use targets="" . Elements = "" is strictly for pure html elements and not tapestry components. If you use the 4.1.2-SNAPSHOT version it will also automatically figure out which form your targeted components are attached to and submit that as part of the event so that you can do things like get the current value of the field. 4.1.2 should be released very soon, just holding out for ognl stability. On 4/30/07, Tony Nelson <[EMAIL PROTECTED]> wrote: I am attempting to use @EventListener to submit the value of a TextField onChange. So, I have an input defined: In the page class I have: @Component(bindings = {"validators=validators:required"}) public abstract TextField getMyField(); @EventListener(events={"onchange"}, elements="myField") public void testEvent(IRequestCycle cycle) { logger.debug("LOOKHERE... " + getText()); } But I'll be darned if any of the events are firing. To rule out other problems, I copied the "big brother is watching" sample from: http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html to the same page, and it works just fine.. 30 Apr 2007 11:35:36,658 [http-8080-Processor24] DEBUG com.starpoint.instihire.web.tapestry.page.Test - User clicked on x/y coordinates 159/326 Am I barking up the wrong tree? My final goal is to have a dropdown update it's contents based on the text in the TextField, but until I can dynamically get it's value I'm stuck. Thanks in advance for all the help. Tony Nelson - 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]
Tap 4.1.1 TextField Ajax question
I am attempting to use @EventListener to submit the value of a TextField onChange. So, I have an input defined: In the page class I have: @Component(bindings = {"validators=validators:required"}) public abstract TextField getMyField(); @EventListener(events={"onchange"}, elements="myField") public void testEvent(IRequestCycle cycle) { logger.debug("LOOKHERE... " + getText()); } But I'll be darned if any of the events are firing. To rule out other problems, I copied the "big brother is watching" sample from: http://tapestry.apache.org/tapestry4.1/ajax/eventlistener.html to the same page, and it works just fine.. 30 Apr 2007 11:35:36,658 [http-8080-Processor24] DEBUG com.starpoint.instihire.web.tapestry.page.Test - User clicked on x/y coordinates 159/326 Am I barking up the wrong tree? My final goal is to have a dropdown update it's contents based on the text in the TextField, but until I can dynamically get it's value I'm stuck. Thanks in advance for all the help. Tony Nelson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Suggested version
Over the last year, we have slowly been converting an internal application from a home brewed infrastructure to Tapestry 4.0. Some of the new functionality we need to add would best be handled with Ajax and I so I started looking at the newer versions of Tapestry. I can't seem to figure out which version of Tapestry I should upgrade to. The "official distribution" page lists Tapestry 4.0.2 as the latest stable build. This version doesn't support Ajax to the best of my knowledge. Folks using Maven2 seem to be encouraged to use the 4.1.2-SNAPSHOT. Is it stable enough to be used in a production environment? Is it really a good idea? Is there an "official distribution" of 4.1.0 or 4.1.1 I should consider? Reading the e-mail list, I see a lot of people using Tapestry 5.0.3. Is there enough functionality ready for me to consider it? I assume this will be the longest migration path for us, but since I need to upgrade, if now is the time, so be it. Thank you in advance for any help. Tony Nelson Starpoint Solutions - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]