Re: T5 5.0.10: ComponentResources.createActionLink broke after upgrade from 5.0.6 to 5.0.10
Right. The javadoc of createActionLink doesn't tell anything when it should be used. To my opinion, it makes sense to allow it be used in event handler methods. Cheers, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5-5.0.10%3A---ComponentResources.createActionLink-broke-after-upgrade-from-5.0.6-to-5.0.10-tp15562416p15594398.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 5.0.10: ComponentResources.createActionLink broke after upgrade from 5.0.6 to 5.0.10
Sorry, I don't quite get how is that related. In this case, I am not using onActivate and onPassivate at all. I am just trying to get an action link in an event handler method. Cheers, Jeffrey Ai quick guess are you returning any null values in onPassivate ? Davor Hrg -- View this message in context: http://www.nabble.com/T5-5.0.10%3A---ComponentResources.createActionLink-broke-after-upgrade-from-5.0.6-to-5.0.10-tp15562416p15594441.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5 5.0.10: ComponentResources.createActionLink broke after upgrade from 5.0.6 to 5.0.10
Hi All, I am experiencing a error of using ComponentResources.createActionLink after upgrade from 5.0.6 to 5.0.10. The code used to work now broke. The Stack Trace is : == Caused by: java.lang.NullPointerException at org.apache.tapestry.internal.services.LinkFactoryImpl.collectActivationContextForPage(LinkFactoryImpl.java:217) at org.apache.tapestry.internal.services.LinkFactoryImpl.createActionLink(LinkFactoryImpl.java:129) at $LinkFactory_11832fc661e.createActionLink($LinkFactory_11832fc661e.java) at org.apache.tapestry.internal.structure.PageImpl.createActionLink(PageImpl.java:156) at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.createActionLink(InternalComponentResourcesImpl.java:123) at net.memberdirect.mdsb.pages.trial.DemoActionLink.onActionFromLink1(DemoActionLink.java:18) == The code snippet is: === public class DemoActionLink { @Inject private ComponentResources componentResources; @SuppressWarnings(unused) private Object onActionFromLink1() { // Some Business logic // Navigation logic return this.componentResources.createActionLink( Link2, false ); } @SuppressWarnings(unused) private Object onLink2() { // Some Business logic // Navigation logic } } == What I noticed in 5.0.10 source code is that ComponentResources.createActionLink is either called from beginRender or afterRender method only. Does that imply that we cannot use it in event handlers? Cheers, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5-5.0.10%3A---ComponentResources.createActionLink-broke-after-upgrade-from-5.0.6-to-5.0.10-tp15562416p15562416.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A web flow idea on T5
Be careful that the problem might not just be having 2 flows at a time for the same session but also managing interrupted flows. I think allowing one flow interrupted by another will introduce lots of complexity and consume more resources. I don't think our users need it, so I don't want to overkill. If a new flow starts, we will just simply clear the existing flow. I don't know much of T5 internals: is the persistence strategy system so different from T4? I start to use Tapestry since T5, so I don't know the difference. But I guess it's similar. Basically you could choose the session strategy, flash strategy or client strategy. Also fields annotated as ApplicationState are shared by all pages. You could find more information in the T5 guide. Cheers, Jeffrey Ai Martino Piccinato wrote: This is exactly what I'm trying to do for T4, it should be quite inobstrusive so that conversational persistence could be added without much effort and be easily used with your pattern if needed. Be careful that the problem might not just be having 2 flows at a time for the same session but also managing interrupted flows. I don't know much of T5 internals: is the persistence strategy system so different from T4? As far as I can see (am I wrong?) there's nothing in your webflow pattern that couldn't be also done in a T4 application as it does not imply any new feature so I think I could test everything in T4 Martino On Dec 24, 2007 8:25 PM, jeffrey ai [EMAIL PROTECTED] wrote: You are right. So far, I think our system will only support one flow at a time. This will not only make design simpler, but also save some server resource. If a system needs to support multiple flows, it needs a way to identify different flows in one session. Cheers, Jeffrey Ai Martino Piccinato wrote: Hi, I think the only thing missing is a conversational type of persistence. That is that the application state object and persisted link shouldn't be simply session persisted but at least session persisted with some kind of flowkey prefix so to separate different flows. This would imply also some flow/conversation control mechanism (start/restart/reset/getFlowKey) I was planning to do a similar thing for T4. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14490669.html Sent from the Tapestry - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14516419.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A web flow idea on T5
You are right. So far, I think our system will only support one flow at a time. This will not only make design simpler, but also save some server resource. If a system needs to support multiple flows, it needs a way to identify different flows in one session. Cheers, Jeffrey Ai Martino Piccinato wrote: Hi, I think the only thing missing is a conversational type of persistence. That is that the application state object and persisted link shouldn't be simply session persisted but at least session persisted with some kind of flowkey prefix so to separate different flows. This would imply also some flow/conversation control mechanism (start/restart/reset/getFlowKey) I was planning to do a similar thing for T4. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14490669.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A web flow idea on T5
I don't like xml configurations of web flow in Spring too. Also another beauty to make a WEBFLOW a normal T5 page is : multiple WEBFLOWs can be easily composed together to create a new WEBFLOW, just as described in the Composite pattern of GOF. Cheers, Jeffrey Ai Joshua Jackson-3 wrote: I like the idea of web-flow like yours. It's not as complicated as Spring Webflow which involves a helluava xml. I hope tapestry5 would adopt your idea. Cheers. On 12/21/07, jeffrey ai [EMAIL PROTECTED] wrote: Hi All, As you may know or not, T5 doesn't have a web flow framework like the Spring one yet. Howard mentioned he may add it in the next release. However, our project cannot wait for that, therefore I have created a simple one on T5. Here is the general idea, your comments are **GREATLY APPRECIATED**. * A WEBFLOW, which is a normal T5 page, injects and contains PAGEs that will used in this web flow. * A PAGE can be used in multiple web flows. A PAGE doesn't have any knowledge of where to go for next page, previous page or cancel link. All these knowledge are dynamically populated from a WEBFLOW. * A WEBFLOW has some data objects, which are annotated as @ApplicationState. PAGEs can pick up whatever data they are interested, display them or populate them. * A typical request flow is like below: = An action request is post back to a PAGE = A PAGE will do some validation and populate the data = In onSuccess() method in PAGE, it returns the next page link, which is populated by WEBFLOW and pointing to an action in WEBFLOW = A redirection action request is sent to WEBFLOW = Some onPage() method in WEBFLOW is triggered. It could review the data , decide the next page and return it. = A page render request is sent to the next page -- I'm a coder not a drag-n-dropper Blog: http://joshuajava.wordpress.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14459192.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: redirect page in a Dispatcher
Yes, that's the one. You could use it rewrite inbound and outbound URLs. Cheers, Jeffrey Ai Angelo Chen wrote: Hi Jeffrey, do you meant the third party URLRewriter, http://tuckey.org/urlrewrite/ this one? jeffrey ai wrote: Angelo, You could use URLRewriter to do this job for you. For details, pls see my post at the following thread: http://www.nabble.com/url-rewriting-in-Tapestry-5-to12823397.html#a12823397 Cheers, Jeffrey Ai Angelo Chen wrote: Hi, T5's url is nice looking, however I have a need to have something different, example: www.mysite.com/profile/98765 98765 is parameter passed to the page profile, can we change the order somehow: www.mysite.com/98765/profile www.mysite.com/98765/inbox www.mysite.com/98765/sent any hint to do this in T5? thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-redirect-page-in-a-Dispatcher-tp14430596p14459172.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] best practice to cancel edit page
Geoff, I am not quite familiar with CSS. I think ActionLink or PageLink could only be rendered to an Anchor Link. I doubt CSS can change its look like to a button. Cheers, Jeffrey Ai Geoff Callender-2 wrote: Another technique is to use an ActionLink or PageLink for cancel and refresh functions. To make the submit button and ActionLink share the same styling use css. I think Howard recommends this approach. Cheers, Geoff On 21/12/2007, at 4:37 AM, jeffrey ai wrote: Homburg, I noticed the same problem too. If you have a normal cancel button in a T5 form as your save button, a post request will be sent back to the page to go through the validation method and even onSuccess() method. My solution to this problem is to create an ActionLinkButton component. It's almost the same with the ActionLink component, Instead of create a normal link, it creates a button link like below: input type=button value=cancel onclick=parent.location='/xxx/YOURPAGE.cancel' id=cancel/ In your page, you could have an onActionFromCancel() method to do whatever redirection you want. Cheers, Jeffrey Ai Sven Homburg-2 wrote: hi there, who can me explain the best practice to cancel edit page? i have a save- and cancel button (both submit components) surrounded by a form component. if user press the cancel button, the edit form should make nothing than leave the page. without prepare, validation, etc is this possible? -- best regards S.Homburg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14441353.html Sent from the Tapestry - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14459523.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: A web flow idea on T5
Thanks for you comments! in the step 3 if the specific page would to render the next link, what is the purpose of the WEBFLOW? The next link in that page is populated by the WEBFLOW, so it's still the WEBFLOW controlling the navigation. isn't the WEBFLOW'S responsibility to take care of the page navigation?? well i guess the purpose of having such a concept of WEBFLOW is to decouple the Page presentation from the page navigation Exactly! so upon the action, say delete from MyCRUD, MyCRUD::onDelete() was first invoked , then the return value (business specific, could be an Object to be deleted) will be pass to DeleteConfirmationPage, and invoke the @EntryPoint confirmationEntry The point is: in some case, the next page needs to by dynamically decided by the WEBFLOW based on the data user inputed so far. Therefore, the next page might not be DeleteConfirmationPage, but some other page. Spring framework webflow supports this by configuring conditions in XML. But I think using Java is much simpler and testable to developers. Cheers, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14459461.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] best practice to cancel edit page
That's great to know! Thanks for your tips, Geoff. Cheers, Jeffrey Ai Geoff Callender-2 wrote: Hi Jeffrey, What you do is change the submits and the links to look the same, which is not quite the same as the browser-generated button, but on the plus-side they'll look the same in any browser. This approach is used in many commercial sites eg. banking sites. One place that describes button-styling is http://particletree.com/features/rediscovering-the-button-element/ . eg. Here are 3 buttons on a UserEdit page: div class=buttons input type=submit value=Save/ Refresh Cancel /div and here's some css to style them to look the same: .buttons a, .buttons input { margin:0 7px 0 0; background- color:#f5f5f5; border:1px solid #dedede; border-top:1px solid #eee; border-left:1px solid #eee; font-family:Lucida Grande, Tahoma, Arial, Verdana, sans-serif; font-size:100%; line-height:130%; text- decoration:none; font-weight:bold; color:#565656; cursor:pointer; padding:5px 10px 6px 7px; /* Links and submits */ } .buttons input { width:auto; overflow:visible; padding:4px 10px 3px 7px; /* IE6 */ } .buttons input[type] { padding:5px 10px 5px 7px; /* Firefox */ line- height:17px; /* Safari */ } *:first-child+html input[type] { padding:4px 10px 3px 7px; /* IE7 */ } .buttons input img, .buttons a img { margin:0 3px -3px 0 !important; padding:0; border:none; width:16px; height:16px; } A fuller example is in the code of JumpStart. Cheers, Geoff http://files.doublenegative.com.au/jumpstart/ On 22/12/2007, at 4:40 AM, jeffrey ai wrote: Geoff, I am not quite familiar with CSS. I think ActionLink or PageLink could only be rendered to an Anchor Link. I doubt CSS can change its look like to a button. Cheers, Jeffrey Ai Geoff Callender-2 wrote: Another technique is to use an ActionLink or PageLink for cancel and refresh functions. To make the submit button and ActionLink share the same styling use css. I think Howard recommends this approach. Cheers, Geoff On 21/12/2007, at 4:37 AM, jeffrey ai wrote: Homburg, I noticed the same problem too. If you have a normal cancel button in a T5 form as your save button, a post request will be sent back to the page to go through the validation method and even onSuccess() method. My solution to this problem is to create an ActionLinkButton component. It's almost the same with the ActionLink component, Instead of create a normal link, it creates a button link like below: input type=button value=cancel onclick=parent.location='/xxx/YOURPAGE.cancel' id=cancel/ In your page, you could have an onActionFromCancel() method to do whatever redirection you want. Cheers, Jeffrey Ai Sven Homburg-2 wrote: hi there, who can me explain the best practice to cancel edit page? i have a save- and cancel button (both submit components) surrounded by a form component. if user press the cancel button, the edit form should make nothing than leave the page. without prepare, validation, etc is this possible? -- best regards S.Homburg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14441353.html Sent from the Tapestry - User mailing list archive at Nabble.com. - 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] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14459523.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14464072.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] best practice to cancel edit page
Homburg, I noticed the same problem too. If you have a normal cancel button in a T5 form as your save button, a post request will be sent back to the page to go through the validation method and even onSuccess() method. My solution to this problem is to create an ActionLinkButton component. It's almost the same with the ActionLink component, Instead of create a normal link, it creates a button link like below: input type=button value=cancel onclick=parent.location='/xxx/YOURPAGE.cancel' id=cancel/ In your page, you could have an onActionFromCancel() method to do whatever redirection you want. Cheers, Jeffrey Ai Sven Homburg-2 wrote: hi there, who can me explain the best practice to cancel edit page? i have a save- and cancel button (both submit components) surrounded by a form component. if user press the cancel button, the edit form should make nothing than leave the page. without prepare, validation, etc is this possible? -- best regards S.Homburg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-T5--best-practice-to-cancel-edit-page-tp14427892p14441353.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: redirect page in a Dispatcher
Angelo, You could use URLRewriter to do this job for you. For details, pls see my post at the following thread: http://www.nabble.com/url-rewriting-in-Tapestry-5-to12823397.html#a12823397 Cheers, Jeffrey Ai Angelo Chen wrote: Hi, T5's url is nice looking, however I have a need to have something different, example: www.mysite.com/profile/98765 98765 is parameter passed to the page profile, can we change the order somehow: www.mysite.com/98765/profile www.mysite.com/98765/inbox www.mysite.com/98765/sent any hint to do this in T5? thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-redirect-page-in-a-Dispatcher-tp14430596p14441407.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: A web flow idea on T5
Hi All, As you may know or not, T5 doesn't have a web flow framework like the Spring one yet. Howard mentioned he may add it in the next release. However, our project cannot wait for that, therefore I have created a simple one on T5. Here is the general idea, your comments are **GREATLY APPRECIATED**. * A WEBFLOW, which is a normal T5 page, injects and contains PAGEs that will used in this web flow. * A PAGE can be used in multiple web flows. A PAGE doesn't have any knowledge of where to go for next page, previous page or cancel link. All these knowledge are dynamically populated from a WEBFLOW. * A WEBFLOW has some data objects, which are annotated as @ApplicationState. PAGEs can pick up whatever data they are interested, display them or populate them. * A typical request flow is like below: = An action request is post back to a PAGE = A PAGE will do some validation and populate the data = In onSuccess() method in PAGE, it returns the next page link, which is populated by WEBFLOW and pointing to an action in WEBFLOW = A redirection action request is sent to WEBFLOW = Some onPage() method in WEBFLOW is triggered. It could review the data , decide the next page and return it. = A page render request is sent to the next page Here are some code snippets : public class WebFlow { @InjectPage private WebFlowPage1 page1; @InjectPage private WebFlowPage2 page2; @InjectPage private WebFlowPage3 page3; @SuppressWarnings(unused) @ApplicationState private SomeObject data; ... private Object onStartPage() { page1.setNextPage( componentResources.createActionLink( page1, false ) ); page1.setCancelLink( componentResources.createActionLink( cancel, false ) ); return page1; } @SuppressWarnings(unused) private Object onPage1() { page2.setNextPage( componentResources.createActionLink( page2, false ) ); page2.setPreviousPage( componentResources.createActionLink( startPage, false ) ); page2.setCancelLink( componentResources.createActionLink( cancel, false ) ); return this.page2; } @SuppressWarnings(unused) private Object onCancel() { this.clean(); return this; } } public class WebFlowPage1 { @Persist private Link nextPage; @Persist private Link previousPage; @Persist private Link cancelLink; @ApplicationState private SomeObject data; @SuppressWarnings(unused) private Link onSuccess() { return nextPage; } @SuppressWarnings(unused) private Object onActionFromPreviousPage() { ... return previousPage; } @SuppressWarnings(unused) private Object onActionFromCancel() { return cancelLink; } ... } Cheers, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-A-web-flow-idea-on-T5-tp14442158p14442158.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: JumpStart 3.0.0 Preview ready for comments
Hi Geoff, This is my first time to try JumpStart on T5. The installation guide is quite straightforward, I went through all things less than 30 minutes. I like it, especially your t:sourcecodedisplay component:) Looking forward to see the maximum version of Jumpstart on T5, especially for the web flow feature. Cheers, Jeffrey Ai Geoff Callender-2 wrote: Hi all, I've reworked JumpStart to address Tapestry 5, and I need feedback on how to make it as good as it can be... If you don't know JumpStart, its purpose is to get newcomers up-to- speed with Tapestry as fast as possible. It's aim is to dispel the myth of Tapestry's steep learning curve by helping people get productive quickly. The better that JumpStart is, the better I hope it will be for all the Tapestry community. So, I'm looking for heaps of feedback on its strengths, weaknesses, choice of examples, quality of code, correctness, etc., anything that will make it more helpful to more people! To get it, go to http://files.doublenegative.com.au/jumpstart/ , click on Downloads, and look for jumpstart-min-3.0.0.preview.1.zip. Cheers, Geoff Callender http://files.doublenegative.com.au/jumpstart/ You can mail me directly or reply to this thread. Either is fine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-JumpStart-3.0.0-Preview-ready-for-comments-tp14346122p14375824.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] injecting services into Domain Objects
as pointed out by jeffrey i could also pass in the services as needed but i think this approach will bloat the methods of my domain objects. have you used this approach on a big codebase? doesn't it have some negative effects on the expressiveness of the Domain Objects? When some domain logic need to use some service, I think there are 3 ways to get that service : * passed as parameter * injected into domain object * pulled the service out from some registry in a method To my humble opinion, passed as parameter is the most clean way to make domain object reusable. For example, if you have an Order domain object, needs a TaxCaculator service in some method. You could pass either a USATaxCaculator or CanadaTaxCaculator in. The other ways don't provide this flexibility. Only if you are sure that a service will only have one implementation in your system for domain object use, you might choose the 2nd or the 3rd way. In this case, I am favoring the 3rd way. P.S. We have used the combination of 1st and 3rd way in a medium-scale e-commerce software. Cheers, Jeffrey Ai -- View this message in context: http://www.nabble.com/-T5--injecting-services-into-Domain-Objects-tp14250305p14279147.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 : NULL (no data)display for SELECT component ?
There are several examples of how to use Select component in the following link. They may help you to figure out what's wrong with your code. http://lombok.demon.co.uk/tapestry5Demo/ Cheers, Jeffrey Ai Penyihir Kecil-2 wrote: i tried select component but i have difficulty and got stuck on it. i had already read the archive milis, but still have no idea what had happened with mine here's my code i always get null value(no data) to diplay in my select component. when i debug it, getPositionList() in Home.java always return a list of value. but it doesn't work when i try to call the model : return new PositionSelectionModel(getPositionList()); does anyone can help clear me up thnx... * - Home.tml* select t:type=select t:id=position value=position model=positionSelectionModel encoder=valueEncoder/ - *Home.java . *private PositionSelectionModel positionSelectionModel; public PositionSelectionModel getPositionSelectionModel() { setPositionList(getPositionDao().queryForList(, )); return new PositionSelectionModel(getPositionList()); } public ValueEncoderPosition getValueEncoder(){ return new PositionValueEncoder(getPositionList()); } .. -- *PositionSelectionModel .java * public class PositionSelectionModel implements SelectModel { private ListPosition positionList; public PositionSelectionModel(ListPosition positionList){ this.positionList = positionList; } public ListOptionGroupModel getOptionGroups() { return null; } public ListOptionModel getOptions() { ListOptionModel optionModelList = new ArrayListOptionModel(); for(Position position: positionList) { System.out.println(position.getPosition()); optionModelList.add(new OptionModelImpl(position.getPosition(), false, position,new String[0])); } return optionModelList; } public void visit(SelectModelVisitor arg0) { } } -- *PositionValueEncoder.java* public class PositionValueEncoder implements ValueEncoderPosition { private ListPosition positionList; public PositionValueEncoder(List positionList) { this.positionList = positionList; } public String toClient(Position position) { return position.getPosition(); } public Position toValue(String value) { for(Position position : positionList) { if(position.getPosition().equals(value)) { return position; } } return null; } } -- View this message in context: http://www.nabble.com/T5-%3A-NULL-%28no-data%29display-for-SELECT-component---tp14275375p14279159.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Edit page best practice - Mk III
Geoff, I think your code is great for **ONE** edit-page. Our project is looking for a web flow from T5, like the Spring one. Do you have any idea about it? Howard mentioned he may add this feature in the next release. Might be a little late to us, but I am expecting to see it. Cheers, Jeffrey Ai Geoff Callender-2 wrote: Hi, In search of best practice for an edit page, here's my 3rd attempt. It's looking pretty clean-cut to me, but I'm looking for suggestions on how to improve it further. private Long _personId; @Persist(client) // Persistence is needed here because this is a detached Entity Bean. When we call the service to // accept our changes, it will need its id and version fields intact to be able to do optimistic // locking check and a successful merge. client is used so that even if you use the Back button // to get to this page, we will have the right Person object. private Person _person; void onActivate(Long id) throws Exception { _personId = id; } Long onPassivate() { return _person.getId(); } void setupRender() throws Exception { if (!_form.getHasErrors()) { _person = getPersonService().findPerson(_personId); } } void onValidate() throws Exception { if (...a bit of validation logic detects an error...) { _form.recordError(...); } } Object onSuccess() { try { getPersonService().changePerson(_person); _nextPage.onActivate(_personId); return _nextPage; } catch (Exception e) { _form.recordError(ExceptionUtil.getRootCause(e)); return null; } } void cleanupRender() { _form.clearErrors(); } Some notes: 1. Detached object - Person is a detached entity. I am deliberately avoiding refreshing it every time in setupRender() because a) it would overwrite the user's changes, and b) it would defeat optimistic locking: if someone else has changed the object then I DO want getPersonService().changePerson(_person) to reject the transaction when Save is pressed. 2. Thread-safety - I'm using client persistence to avoid the whole thread-safety issue caused by the user opening a new window or tabs in same browser (T5 can't tell them apart so they share the same HttpSession). 3. onPrepareFromForm() - I'm avoiding it because it gets called too often (something to do with rewind?). setupRender() seems better for the job. Any downside t this? 4. cleanupRender() - if/when 5.0.7 uses flash persistence on the form's ValidationTracker then I'll ditch this method. Suggestions please! Thanks, Geoff -- View this message in context: http://www.nabble.com/T5%3A-Edit-page-best-practice---Mk-III-tp14249141p14279495.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] injecting services into Domain Objects
is it possible to use tapestry-ioc to inject services into domain objects? First, I don't think it's good practice to inject services into domain objects. If some operation of domain object really needs to use a service, you could pass a service instance to that specific method instead of injecting it. To my understanding, Tapestry dependency injection is mainly for services. You could inject a dependency as a parameter of the service builder method, or as a parameter of the service implementation's constructor(for autobuilt services), or as a parameter of the module builder's constructor. when using (build-time) AOP i need a reference to the registry, but how do i get it? The default Tapestry application registry is created in TapestryFilter, and I don't see it's published out. You could of course create your own registry using RegistryBuilder and publish it somehow, but I don't think that's a good practice to have a registry in your class and retrieve services from it. Cheers, Jeffrey Ai kristian.marinkovic wrote: hi all, is it possible to use tapestry-ioc to inject services into domain objects? i'm thinking of something like @Configurable in spring. when using (build-time) AOP i need a reference to the registry, but how do i get it? preferably i'd assign the generated proxy to the fields. i'd appreciate any suggestions! g, kris example code: public class Order { @Inject Repository repository; @Inject Notification notification; } -- View this message in context: http://www.nabble.com/-T5--injecting-services-into-Domain-Objects-tp14250305p14258571.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Possible Literal Binding bug
It's hardly to say it's a bug. I guess T5 will assume you meant to use literal binding when you use a value with expansions, like ... ${val1} ... ${val2}. So literal prefix is only necessary for a simple value, like abc. Cheers, Jeffrey Ai Andrew Pietsch wrote: Hi there, I'm new to T5 so the I hope this isn't just a user misunderstanding but I'm having troubles with the prefix literal: Page class: public class MyComponent { @Parameter private String title; } A Template that uses MyComponent as follows: t:myComponent t:title=literal:Page ${pageNo} of ${pageCount} / The resulting output is: literal: Page 1 of 3 If I change the parameter to use literal as the default binding the output correctly omits the literal: prefix. Cheers Andrew -- View this message in context: http://www.nabble.com/T5%3A-Possible-Literal-Binding-bug-tf4947411.html#a14175989 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: outputRaw and bbcode
Sorry, I have no ideas about that. Cheers, Jeffrey Ai Angelo Chen wrote: hi jeffrey, thanks for the response, what I want to do is, the text has some bbcode , I'd like to convert that to html tags, then use outputRaw to display it, any existing components that can do that? jeffrey ai wrote: Maybe I got your question wrong, could you just create a component to escape special chars in your BBCode text. One choice is to use StringEscapeUtils in Jakarta Commons-Lang. Cheers, Jeffrey Ai Angelo Chen wrote: Hi, I'd like to know know if there is a component that can display BBCode text in the correct html format? i tried outputRaw and seems I'm wrong, any ideas? Thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-outputRaw-and-bbcode-tf4935074.html#a14154547 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Tapestry message localization, java.util.Formatter vs. java.text.MessageFormat
One choice is to provide your own message binding by contribute a binding source in your AppModule.java like below. You could use any formatter you want in there. --- public void contributeBindingSource( MappedConfigurationString, BindingFactory configuration ) { configuration.add( mymsg, new MyMessageBindingFactoryImpl() ); } --- Cheers, Jeffrey Ai Doug Hauge wrote: Is there some reason Tapestry chose to use 'java.util.Formatter' style formatting as opposed to 'java.text.MessageFormat' style? The latter seems preferable for localization, primarily because it has the 'choice' format type. We would like to use the 'java.text.MessageFormat' style for our application, and are considering providing our own implementation of the 'MessageFormatter' service, but the question becomes how to use this formatting for only our messages. We have considered decorating the 'ComponentMessagesSource' service, but this would then apply to all component messages, including those for core components, which have some text properties that use 'java.util.Formatter' style formatting. We could override these messages as described in http://wiki.apache.org/tapestry/Tapestry5HowToOverrideTheDefaultErrorMes sageBanner, but that seems a bit brittle. Does anyone else have any need to use 'java.text.MessageFormat' style formatting, or are we the only ones? Do the solutions mentioned above sound reasonable? Thanks, Doug - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-Tapestry-message-localization%2C-java.util.Formatter-vs.-java.text.MessageFormat-tf4287513.html#a14154551 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Nightly docs fixed - and some general notes
It's great to know that you are 100% on T5. Also I would like to put one vote for the web flow feature. I had a demo of T5 last week to other developers in my company. We are all exited about its clean code and extendability. The only feature we need but it's not in T5 is the web flow. Besides that, performance is a minor concern of mine. I did see some code are commented as naive implementation when I went through some source code. Cheers, Jeffrey Ai Howard Lewis Ship wrote: The nightly docs are now fixed. My hatred of Maven is growing quickly. You may not be aware of this, but Jesse fixed the Surefire plugin for Maven almost two years ago and that STILL isn't the default version (i.e., the non-snapshot version). In order to get some new tests working, I had to upgrade to TestNG 5.7, and for that to work, I had to enable Maven plugin snapshots to get the fixed Surefire plugin. That's been breaking other stuff, for example, the surefire-report plugin doesn't seem to be compatible with the fixed surefire plugin. I'm investigating Buildr, which is a Ruby based build system that understands Maven dependencies. It looks very promising. There's something of a Goedel issue in using Java to build Java, so I eagerly embrace using another language (Ruby) to build Java instead. Anyway, I had to strip out the surefire reports (like anyone reads them --- code coverage reports are more useful) in order to fix the build. People have been asking a lot about when T5 will be finished. I'm doing some work on it right now, while I'm on vacation. I have new clients lined up, so I'll be working in T5 as I finish T5. I'm no longer with Feature50, which means that 100% of my time is now devoted to Tapestry. I'm happier than I've been in months ... and there's more and more interesting news coming soon about the future of Tapestry. When will it be finished? There's a four page bug list, plus a lot of Ajax features to go. I'd still like to put in some Spring Web Flow support (but that may wait for a follow-on release), and beef up the Hibernate support. I haven't even looked at performance and optimization yet (pretty hard to tell, considering how fast the framework runs). I wish I could snap my fingers and just declare it done, but to be clear, I want it to be completely useable first ... and I'm trying to get to that stage as fast as possible. -- Howard M. Lewis Ship TWD Consulting, Inc. Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Nightly-docs-fixed---and-some-general-notes-tf4944236.html#a14155121 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: outputRaw and bbcode
Maybe I got your question wrong, could you just create a component to escape special chars in your BBCode text. One choice is to use StringEscapeUtils in Jakarta Commons-Lang. Cheers, Jeffrey Ai Angelo Chen wrote: Hi, I'd like to know know if there is a component that can display BBCode text in the correct html format? i tried outputRaw and seems I'm wrong, any ideas? Thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-outputRaw-and-bbcode-tf4935074.html#a14140274 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Personalizing page and component template
Anybody, any advice? jeffrey ai wrote: Hi Folks, We have a need to provide personalized page for different user groups, so I tweaked some T5 services to make it possible to use personalized template based on a request parameter. I would like put the general idea here in case you guys are interested. Also since I have change some T5 internal services, I am wondering whether I have missed something. Your advice are quite welcome. Basically, I decorated 2 T5 internal services -- ComponentTemplateSource and PagePool. * ComponentTemplateSource is responsible to look up templates, so I have changed it to request-aware and load template based on the user group. * PagePool is responsible to pool pages, so I have changed it to request-aware too and pool pages based on user group. Although I used T5 decorator facility to intercept calls to both services, it's not real decorating behavior as defined in GoF pattern. My decorators will handle all calls, they won't even pass calls to decoratees -- the original services. I am a little concerned whether my tweak would have some side effects. -- Code Snippet of my AppModule.java public ComponentTemplateSource decorateComponentTemplateSource( ClassComponentTemplateSource serviceInterface, Object delegate, String serviceId, Logger logger, TemplateParser parser, PageTemplateLocator locator, RequestGlobals requestGlobals ) { final MyComponentTemplateSourceImpl service = new MyComponentTemplateSourceImpl( parser, locator, requestGlobals ); _updateListenerHub.addUpdateListener( service ); return service; } public PagePool decoratePagePool( ClassPagePool serviceInterface, Object delegate, String serviceId, Logger logger, PageLoader pageLoader, ThreadLocale threadLocale, ComponentClassResolver resolver, RequestGlobals requestGlobals, ThreadString threadString, ComponentMessagesSource componentMessagesSource, ComponentTemplateSource componentTemplateSource ) { final MyPagePoolImpl service = new MyPagePoolImpl( logger, pageLoader, threadLocale, resolver, requestGlobals, threadString ); // This covers invalidations due to changes to classes pageLoader.addInvalidationListener( service ); // This covers invalidation due to changes to message catalogs (properties files) componentMessagesSource.addInvalidationListener( service ); // ... and this covers invalidations due to changes to templates componentTemplateSource.addInvalidationListener( service ); return service; } -- Thanks for any advice. Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-Personalizing-page-and-component-template-tf4925841.html#a14140075 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Personalizing page and component template
Hi Folks, We have a need to provide personalized page for different user groups, so I tweaked some T5 services to make it possible to use personalized template based on a request parameter. I would like put the general idea here in case you guys are interested. Also since I have change some T5 internal services, I am wondering whether I have missed something. Your advice are quite welcome. Basically, I decorated 2 T5 internal services -- ComponentTemplateSource and PagePool. * ComponentTemplateSource is responsible to look up templates, so I have changed it to request-aware and load template based on the user group. * PagePool is responsible to pool pages, so I have changed it to request-aware too and pool pages based on user group. Although I used T5 decorator facility to intercept calls to both services, it's not real decorating behavior as defined in GoF pattern. My decorators will handle all calls, they won't even pass calls to decoratees -- the original services. I am a little concerned whether my tweak would have some side effects. -- Code Snippet of my AppModule.java public ComponentTemplateSource decorateComponentTemplateSource( ClassComponentTemplateSource serviceInterface, Object delegate, String serviceId, Logger logger, TemplateParser parser, PageTemplateLocator locator, RequestGlobals requestGlobals ) { final MyComponentTemplateSourceImpl service = new MyComponentTemplateSourceImpl( parser, locator, requestGlobals ); _updateListenerHub.addUpdateListener( service ); return service; } public PagePool decoratePagePool( ClassPagePool serviceInterface, Object delegate, String serviceId, Logger logger, PageLoader pageLoader, ThreadLocale threadLocale, ComponentClassResolver resolver, RequestGlobals requestGlobals, ThreadString threadString, ComponentMessagesSource componentMessagesSource, ComponentTemplateSource componentTemplateSource ) { final MyPagePoolImpl service = new MyPagePoolImpl( logger, pageLoader, threadLocale, resolver, requestGlobals, threadString ); // This covers invalidations due to changes to classes pageLoader.addInvalidationListener( service ); // This covers invalidation due to changes to message catalogs (properties files) componentMessagesSource.addInvalidationListener( service ); // ... and this covers invalidations due to changes to templates componentTemplateSource.addInvalidationListener( service ); return service; } -- Thanks for any advice. Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-Personalizing-page-and-component-template-tf4925841.html#a14098291 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: radio button
Angelo, You could find an example of radiogroup at the following great site created by SH Man. http://lombok.demon.co.uk/tapestry5Demo/ Cheers, Jeffrey Ai Angelo Chen wrote: Hi, How to use radio/radiogroup? I have following: t:radiogroup value=optn t:id=optn t:radio value=1 / option1 t:radio value=2 / option2 /t:radiogroup my need is, I have a optn property that I like the radiogroup to set based on usr's clicking, any idea? Thanks, A.C. -- View this message in context: http://www.nabble.com/T5%3A-radio-button-tf4895269.html#a14032405 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Is there a way to make a BindingFactory request-aware
That solves the problem, thanks, folks. I put my contribute code in AppModule here for later reference. === public static void contributeBindingSource( MappedConfigurationString, BindingFactory configuration, @InjectService(RequestGlobals) RequestGlobals requestGlobals ) { configuration.add( pmsg, new PersonalizedMessageBindingFactory(requestGlobals) ); } === Cheers, Jeffrey Ai Howard Lewis Ship wrote: Remember that service injection is ONLY through the constructor, whereas component injection is ONLY through private instance variables. On Nov 27, 2007 2:57 PM, Filip S. Adamsen [EMAIL PROTECTED] wrote: Hi Jeffrey, Try injecting org.apache.tapestry.service.Request: http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/Request.html That should do the trick. -Filip jeffrey ai skrev: Thanks, Filip. I tried to inject RequestGlobals, like I did for normal component, but that doesn't work. It's not correctly injected. Filip S. Adamsen-2 wrote: Have you tried injecting the request directly into your BindingFactory? -Filip jeffrey ai skrev: Hi Folks, I think I'm missing something here, but would appreciate a shove in the right direction. I created a new BindingFactory, introduced a new prefix, and successfully contributed it to BindingSource. I am trying to do the following things in my new BindingFactory, = public Binding newBinding( String description, ComponentResources container, ComponentResources component, String expression, Location location ) { final HttpServletRequest request = getRequestFromComponent(component); final String personalizedMessage = getPersonalizedMessage(request.getParameter(personID), expression); return new LiteralBinding( description, personalizedMessage, location ); } = I couldn't find a way to dig the Http request out from the component at this point -- page expansion phase. Thanks for any advice, Jeffrey Ai - 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] -- Howard M. Lewis Ship Partner and Senior Architect at Feature50 Creator Apache Tapestry and Apache HiveMind - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-Is-there-a-way-to-make-a-BindingFactory-request-aware-tf4884618.html#a13996037 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Is there a way to make a BindingFactory request-aware
Hi Folks, I think I'm missing something here, but would appreciate a shove in the right direction. I created a new BindingFactory, introduced a new prefix, and successfully contributed it to BindingSource. I am trying to do the following things in my new BindingFactory, = public Binding newBinding( String description, ComponentResources container, ComponentResources component, String expression, Location location ) { final HttpServletRequest request = getRequestFromComponent(component); final String personalizedMessage = getPersonalizedMessage(request.getParameter(personID), expression); return new LiteralBinding( description, personalizedMessage, location ); } = I couldn't find a way to dig the Http request out from the component at this point -- page expansion phase. Thanks for any advice, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-Is-there-a-way-to-make-a-BindingFactory-request-aware-tf4884618.html#a13980504 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Is there a way to make a BindingFactory request-aware
Thanks, Filip. I tried to inject RequestGlobals, like I did for normal component, but that doesn't work. It's not correctly injected. Filip S. Adamsen-2 wrote: Have you tried injecting the request directly into your BindingFactory? -Filip jeffrey ai skrev: Hi Folks, I think I'm missing something here, but would appreciate a shove in the right direction. I created a new BindingFactory, introduced a new prefix, and successfully contributed it to BindingSource. I am trying to do the following things in my new BindingFactory, = public Binding newBinding( String description, ComponentResources container, ComponentResources component, String expression, Location location ) { final HttpServletRequest request = getRequestFromComponent(component); final String personalizedMessage = getPersonalizedMessage(request.getParameter(personID), expression); return new LiteralBinding( description, personalizedMessage, location ); } = I couldn't find a way to dig the Http request out from the component at this point -- page expansion phase. Thanks for any advice, Jeffrey Ai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-Is-there-a-way-to-make-a-BindingFactory-request-aware-tf4884618.html#a13981933 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Why value of CheckBox get lost at validation result page
Hi Folks, I have a form with some TextField and CheckBox. I add the onValidate() method into the page to do my own page page validation like below: === void onValidate() { if ( ) _tracker.recordError( validation error... ); } === The data in the action request get correctly validated, and the validation error message shows up in the result page. However, all values of CheckBox get lost, at the mean time, all values of TextField are still there. The way I found to get around this problem is make all CheckBox fields Persist(flash). The same problem applies to Select component too. Is this a problem? Why it's happening? Is my walk-around of this problem good? Thanks, Jeffrey Ai -- View this message in context: http://www.nabble.com/T5%3A-Why-value-of-CheckBox-get-lost-at-validation-result-page-tf4876723.html#a13954998 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 - validation of composite components
I havn't tried this, but I think it will work. If your composite component inherits AbstractField, you could override processSubmission() method to do your own validation. Actually, this is how TextField component do the validation. Cheers, Jeffrey Ai Markus Fischer wrote: I have a problem implementing proper validation of composite components. Assume I have a component consisting of two text fields. For validation, I need to consider the contents of both. The way I understand validation, it works thusly: 1. All fields within a form are asked by the form to pull their values out of the incoming request and validate these values (each validating its own value) 2. Form emits a validate() event which is propagate UPWARDS in the component hierarchy. Therefore, my composite component gets notified to pull its values out of the incoming request (which it can't, but its text fields will do), but never sees the validate() event, as it is within the form and thus below it in the component hierarchy. So, in effect, each text field can validate its own value, and anything above the form can validate the component, but the component cannot validate itself. Is that correct? What am I missing? Is there a way to get a validate event trigger in a component once the child components have restored their values and have validated themselves? Thanks, Markus -- View this message in context: http://www.nabble.com/T5---validation-of-composite-components-tf4855742.html#a13900445 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] Cannot persist field exception
I think you are missing t:value in your template. It should be : input t:type=TextField t:id=username t:value=username t:validate=required size=30/ Jeffrey Ai Jean-Philippe Steinmetz-2 wrote: Hi All, I'm getting the following error Error persisting field Users/Create:username: java.lang.NullPointerException In my page class I have... @Persist private String username; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } and in my template I have t:label for=username/: input t:type=TextField t:id=username t:validate=required size=30/ So i'm not sure why i'd be getting this error. Does anyone have ideas? I tried setting some default value to username in the setupRender() function but that doesn't seem to solve the problem. Thanks in advance, Jean-Philippe Steinmetz -- View this message in context: http://www.nabble.com/-T5--Cannot-persist-field-exception-tf4824029.html#a13887482 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to initialize a session variable in a page render request?
No Carlos. Actually, you reminded me. The original message title is without T5. I added it later after reading your message. Thanks, Jeffrey Ai carlos f wrote: carlos f wrote: If you are using tap 4.x . . . Maybe if I looked at the subject of the original message I would have seen the T5 staring at me ;) Carlos -- View this message in context: http://www.nabble.com/T5%3A-How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13860937 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to initialize a session variable in a page render request?
Thanks Lasitha. I did a search later of all guide. It's only mentioned in the page navigation guide. I still think it should be mentioned in the life cycle guide. I think that's the first place for developers to look for that information. Cheers, Jeffrey Ai lasitha wrote: On Nov 20, 2007 4:54 AM, jeffrey ai [EMAIL PROTECTED] wrote: onActivate() solve the problem. I thought this method only get called for an action request, not for a page render request. Apparently, I am wrong. I think it should be documented at the following Page Lifecycle guide. http://tapestry.apache.org/tapestry5/tapestry-core/guide/lifecycle.html Is it not sufficient to have it here?: http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html Perhaps a reference from lifecycle to pageNavigation? Cheers, lasitha. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13861368 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5] tapestry-spring and WebApplicationContext
But my injection of the WebApplicationContext is not in a page but in another class. Is it a problem ? I think it will be a problem. I believe Tapestry will only handle those classes in the package you defined in tapestry.app-package in web.xml. You could try to move it to see how things going. Cheers, Jeffrey Ai Stephane Decleire wrote: Yes, i've set this configuration. But my injection of the WebApplicationContext is not in a page but in another class. Is it a problem ? Stephane Ezra Epstein a écrit : And your web.xml file has: listener listener-classorg.springframework.web.context.ContextLoaderListener/listener-class /listener And if the application context .xml files aren't in the standard place and named the standard way you've also included: context-param param-namecontextConfigLocation/param-name param-value!-- path to your applicationContext.xml --/param-value /context-param ? Steph [EMAIL PROTECTED] wrote: I've tried this but my WebApplicationContext is null ... Stephane SergeEby a �crit : Hi, Just import and inject the WAC in your page: import org.springframework.web.context.WebApplicationContext; class Foo { ... @Inject private WebApplicationContext wac; ... } /Serge cyrille37 wrote: Fidel Chavarria a �crit : Hi I think this willhelp you, http://tapestry.apache.org/tapestry5/tapestry-spring/ Thanks, but if you had read my mail, I should see that I'm talked about this page. In this page in Limitations chapter it is writte that we can't inject Spring session bean but we have to retreive the WebApplicationContext and use it. But I don't know howto retreive this so famous WebApplicationContext when I'm in a tapestry code page or component. cyrille. cyrille37 wrote: Hi, In the T5 tapestry-spring documentation it is writed to don't use other Spring beans than Singleton ones. Inject the WebApplicationContext instead. http://tapestry.apache.org/tapestry5/tapestry-spring/ But howto inject the WebApplicationContext ? thanks cyrille - 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] -- View this message in context: http://www.nabble.com/-T5--tapestry-spring-and-WebApplicationContext-tf3996411.html#a13861313 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to initialize a session variable in a page render request?
Well, in the life cycle guide, it is said it could be used for initializations or caching. Actually, I have confirmed it could do that, but just it doesn't work to retrieve and mutate persistent variables. Cheers, Jeffrey Ai Michael Courcy wrote: I may be wrong as I'm a tapestry newbie, but pageAttached is something related to the compilation and pooling of the page template. Thus it should not deal with session buisness. jeffrey ai a écrit : Hi Folks, I am looking for the best way to initialize a session variable(@Persist) in a page render request once, so I could access it in the next action request. I tried to put the logic into pageAttached method like below: @Persist private xxx myVar; @SuppressWarnings(value = unused) private void pageAttached() { if (myVar == null) initializeVar(); } It doesn't work as I expected. myVar is always null in pageAttached method. It seems the pageAttached method is not supposed to mutate a persistent variable. However, if I put this logic into some other place like below, it works fine. @Persist private xxx myVar; public String getSomeOtherVar() { if (myVar == null) initializeVar(); return someOtherVar; } Although it works, apparently, this is not a good place. Is there a better place to do session variable initialization? I believe it should not be put into constructor too because it will be viewable to other sessions. Thanks, Jeffrey Ai -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13861371 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 persisting select component selection after form submission
Hi Ritesh, I am not quite clear of your problem. When I don't use any render phase or event it persists the value And you say if you use any render phase the value is not persisted. Persists to where? Do you just mean, in the action request, the value is correctly set to a variable in your page? Jeffrey Ai Ritesh.S wrote: Hello everybody, I am newbie to Tapestry. I am using Tapestry 5 for developing an application and I encountered following problem if anyone suggest a solution it will be very helpful for me. :) I have a select component with GenericSelectModel which shows values well on first display. When I select some option from this select component and submit the form I have to persist the selected option, but it does not. : I am fetching values for this model from database on @SetupRender phase (tried onActivate(), pageLoaded() also - same problem occurred). When I don't use any render phase or event it persists the value but when some options are added in database from other page it does not fetch the current saved options in drop down list (since no render phase or event). This the source code I am using - @SetupRender void setValues(){ ListSomeBean bean= new ArrayListSomeBean(); bean.addAll(myDao.getBeanList()); someBeans = new GenericSelectModelSomeList(dev,SomeList.class,name,id,access); } public GenericSelectModelSomeList getSomeModel() { return someBeans; } Does anyone faced this problem and have solution please let me know. Thanks in advance. :) From, Ritesh Sandupatla -- View this message in context: http://www.nabble.com/T5-persisting-select-component-selection-after-form-submission-tf4843731.html#a13861834 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5.0.6: Table with input fields inside a form?
I wouldn't suggest you to use Grid component. The easiest way is to use table directly with some tapestry components. Your template will be like below: == table colgroup ... /colgroup tr class=header ... /tr t:loop source=your_value_list value=your_value t:volatile=true tr td class=required input t:type=checkbox value=your_value.boolean_value/ /td td class=string${your_value.label}/td td class=required input t:type=textfield value=your_value.text_value/ /td /tr /t:loop /table The posted data in your action request will be automatically populated to your_value_list. cheers, Jeffrey Ai CarstenM wrote: Hello, I'd like to create a table with input fields (checkbox, textfield) inside a form. Does someone have an example? Help would be very nice. Need a solution for it to finish first version of my application. (Asked for that in other threads already, but nobody answered.. probably more important things to do.) Thanks a lot Carsten -- View this message in context: http://www.nabble.com/T5.0.6%3A-Table-with-input-fields-inside-a-form--tf4837005.html#a13840415 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to initialize a session variable in a page render request?
Hi Folks, I am looking for the best way to initialize a session variable(@Persist) in a page render request once, so I could access it in the next action request. I tried to put the logic into pageAttached method like below: @Persist private xxx myVar; @SuppressWarnings(value = unused) private void pageAttached() { if (myVar == null) initializeVar(); } It doesn't work as I expected. myVar is always null in pageAttached method. It seems the pageAttached method is not supposed to mutate a persistent variable. However, if I put this logic into some other place like below, it works fine. @Persist private xxx myVar; public String getSomeOtherVar() { if (myVar == null) initializeVar(); return someOtherVar; } Although it works, apparently, this is not a good place. Is there a better place to do session variable initialization? I believe it should not be put into constructor too because it will be viewable to other sessions. Thanks, Jeffrey Ai -- View this message in context: http://www.nabble.com/How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13844361 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to initialize a session variable in a page render request?
Thanks, Josh. onActivate() solve the problem. I thought this method only get called for an action request, not for a page render request. Apparently, I am wrong. I think it should be documented at the following Page Lifecycle guide. http://tapestry.apache.org/tapestry5/tapestry-core/guide/lifecycle.html Cheers, Jeffrey Josh Canfield-2 wrote: I am looking for the best way to initialize a session variable(@Persist) in a page render request once, so I could access it in the next action request. I can't tell you why pageAttached doesn't work (haven't tried it) but you can use onActivate, or if it's for a form onPrepare. Josh On Nov 19, 2007 12:15 PM, jeffrey ai [EMAIL PROTECTED] wrote: Hi Folks, I am looking for the best way to initialize a session variable(@Persist) in a page render request once, so I could access it in the next action request. I tried to put the logic into pageAttached method like below: @Persist private xxx myVar; @SuppressWarnings(value = unused) private void pageAttached() { if (myVar == null) initializeVar(); } It doesn't work as I expected. myVar is always null in pageAttached method. It seems the pageAttached method is not supposed to mutate a persistent variable. However, if I put this logic into some other place like below, it works fine. @Persist private xxx myVar; public String getSomeOtherVar() { if (myVar == null) initializeVar(); return someOtherVar; } Although it works, apparently, this is not a good place. Is there a better place to do session variable initialization? I believe it should not be put into constructor too because it will be viewable to other sessions. Thanks, Jeffrey Ai -- View this message in context: http://www.nabble.com/How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13844361 Sent from the Tapestry - User mailing list archive at Nabble.comhttp://nabble.com/ . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. -- View this message in context: http://www.nabble.com/T5%3A-How-to-initialize-a-session-variable-in-a-page-render-request--tf4839139.html#a13847864 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: grid's column's width
I am looking for the answer of the same question too. The template of the Grid component doesn't embed a colGroup element. - Quated from Grid.tml table class=t-data-grid thead t:id=columns/ tbody tr t:id=rows/ /tbody /table - It seems to me that the only way to add column width is to write your own component. Is there anybody could provide some hints? Jeffrey Ai Angelo Chen wrote: Hi, Is there a way to set the grid's column's width to a fixed size? without that, the grid changes its width from page to page. Thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-grid%27s-column%27s-width-tf4811010.html#a13778439 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: grid's column's width
I do noticed that the Grid component is not defined as final like some other components. I guess we could just inherit it and add a new template to extend its feature. Jeffrey Ai jeffrey ai wrote: I am looking for the answer of the same question too. The template of the Grid component doesn't embed a colGroup element. - Quated from Grid.tml table class=t-data-grid thead t:id=columns/ tbody tr t:id=rows/ /tbody /table - It seems to me that the only way to add column width is to write your own component. Is there anybody could provide some hints? Jeffrey Ai Angelo Chen wrote: Hi, Is there a way to set the grid's column's width to a fixed size? without that, the grid changes its width from page to page. Thanks. A.C. -- View this message in context: http://www.nabble.com/T5%3A-grid%27s-column%27s-width-tf4811010.html#a13778493 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: grid's column's width
That's right. Thanks for you suggestion! Cheers, Jeffrey Ai nirvdrum wrote: Couldn't you just provide your own stylesheet? The header and cell class names are predictable. -- Kevin On 11/15/07 1:26 PM, in article [EMAIL PROTECTED], jeffrey ai [EMAIL PROTECTED] wrote: I do noticed that the Grid component is not defined as final like some other components. I guess we could just inherit it and add a new template to extend its feature. Jeffrey Ai - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5%3A-grid%27s-column%27s-width-tf4811010.html#a13783819 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tapestry 5: running tutoriel
Eli, Your mvn command should run without any manual download or settings. I have seen the similar error message before. My problem is caused by a broken maven plugin in my local repository, which is gotten from our incorrectly-configured repository server. I would suggest you to try the following things: * Remove your $HOME/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin or move it somewhere else * If you have $HOME/.m2/settings.xml setup, move it somewhere else * Try to run the command again. This will make you redownload the plugin from maven central repository, which should work. Good luck! Jeffrey Ai GUERARD Elisabeth wrote: Dear all, I try to run the tutoriel for Tapestry 5 at the following address: http://tapestry.apache.org/tapestry5/tutorial1/first.html I have problem with the first step: create an empty application by using feature of Maven, archetype. It 's the first time, i use Maven, I install it correctly, create an empty folder and run the following command: mvn archetype:create -DarchetypeGroupId=org.apache.tapestry -DarchetypeArtifactId=quickstart -DarchetypeVersion=5.0.5 -DgroupId=org.apache.tapestry -DartifactId=tapestry-tutorial1 -DpackageName=org.apache.tapestry.tutorial I had the following error: [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found By looking at Maven 's website, about archetype, I found configuration of pom.xml and archetype.xml. I need to do the same in this case, isn't it? Thanks in advance for your help. Eli -- Jeffrey Ai Software Developer Analyst MemberDirect® Product Development phone: 604 737 5957 email: [EMAIL PROTECTED] website: www.memberdirect.ca - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: url-rewriting in Tapestry 5
You could use urlrewritefilter to rewrite both inbound and outbound URLs. But for outbound URLs rewriting, urlrewritefilter could only rewrite URLs encoded by HttpServletResponse.encodeURL() method. I believe most URLs generated by Tapestry components(so far only confirmed BeanEditForm) are using this method. Cheers, Jeffrey Ai Britske wrote: Thanks these all seem valid approaches. What i'm looking for is a stretching the possibilities i guess but here it goes anyway: I want a way in which I can plug a 'rewrite strategy'. This means that not only I have to translate urls from 'nice' to 'tapestry5' -internal but also the other way around, so that tapestry-pages reference other pages automatically by their 'nice' -url. I would like to keep the code in 1 place for making this bidirectional-translation. Doing this with mode_rewrite does't give me control in code I think. I wonder if this is possible using some form of rewrite-filter, that is able to translate both ways. any ideas on this? regards, Geert-Jan Robin Helgelin wrote: On 9/21/07, Daniel Leffel [EMAIL PROTECTED] wrote: I went down this path and decided that mod_rewrite is a much cleaner way to achieve something like this. Or maybe an urlfilter bundled with your war, there are a few usable ones. -- regards, Robin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/url-rewriting-in-Tapestry-5-tf4496726.html#a13500030 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]