Re: T5: Grid component, reorder and empty source
hi, as a novice in regards to Tapestry, I first thought it was a bug, but at last I tried to supply a beanmodel, and everything is fine (obvious to others, I think). I found the tip here: http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html. table t:type=grid pagerPosition=both source=persons model= personModel reorder=firstName / @Inject private BeanModelSource _beanModelSource; @Inject private ComponentResources _resources; @Retain private BeanModel _model; public BeanModel getPersonModell() { return _model; } void pageLoaded() { _model = _beanModelSource.create(Person.class, false, _resources); } Is this the right way to inform the grid component to use the Person.class ? thanks, Arve Klev 2007/11/13, adamh [EMAIL PROTECTED]: I'm seeing the same behaviour, if my source is empty and I use the 'remove' parameter I get the same exception: 'grid: xxx -- no source to determine list type from' Results.tml t:grid t:source=myResults t:row=item t:remove=Id,colour,name t:rowsPerPage=10 width=620px Removing the 'remove' param the page renders with the 'nothing to display' message. -- View this message in context: http://www.nabble.com/T5%3A-Grid-component%2C-reorder-and-empty-source-tf4782045.html#a13732796 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 component, reorder and empty source
yes, it works fine. 2007/11/16, Joshua Jackson [EMAIL PROTECTED]: On 11/16/07, Arve Klev [EMAIL PROTECTED] wrote: hi, as a novice in regards to Tapestry, I first thought it was a bug, but at last I tried to supply a beanmodel, and everything is fine (obvious to others, I think). I found the tip here: http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html . table t:type=grid pagerPosition=both source=persons model= personModel reorder=firstName / @Inject private BeanModelSource _beanModelSource; @Inject private ComponentResources _resources; @Retain private BeanModel _model; public BeanModel getPersonModell() { return _model; } void pageLoaded() { _model = _beanModelSource.create(Person.class, false, _resources); } Is this the right way to inform the grid component to use the Person.class ? Have you tried it yet? -- What you want today, may not exist tommorrow Blog: http://joshuajava.wordpress.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5.0.6 about Tapestry ioc
I'm not sure I understand the constructor parameters. Do you mean they come from some other object (HttpRequest)? If so, why not just take HttpRequest as a constructor argument? If you do that then you can auto bind this service and IoC will know how to create it. If you insist on the parameters currently listed, then you'll need to have a service builder method, and inject HttpRequest as an argument into that method. lyifan wrote: I want to implement a service: public interface Transport { public void send(); } public class HttpTransport implement Transport { private String _address; private int _port; private boolean _ssl; public HttpTransport (String address, int port, boolean ssl) { _address = address; _port = port; _ssl = ssl; } public void send) { // .. } } The parameter of the constructor is from http request. How can I build this service? I know I can use setters, but I just wanna know how to build a service using constructor. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T4.1.3 without ajax
add ajaxDelegate=ognl:null to the Shell component... I believe that it is still possible that Tapestry adds a dojo import script in some cases (related to the @Form component) but you can't get away from this... unless you can go with 4.1.4.-SNAPSHOT that has some improvements on that area On Nov 16, 2007 11:19 AM, 9902468 [EMAIL PROTECTED] wrote: Hi, I've used tapestry with ajax and it works well, but the current project is not using ajax, or anything related to javascript. What is the right way to do this? After disabling ajax etc. from shell, I still see that dojo javascripts are included in the head, AND dojo still registers forms etc, although it is not used. Have I misconfigured something, is this expected behaviour, or is it a bug in Tapestry? This is the shell and body that we're using: div jwcid=@Shell disableCaching=true disableTapestryMeta=true title=test body jwcid=@Body - 99 Ps. Right way to do this is not to use @Shell and @Body, but then the functionality of components are not guaranteed if I understood the docs right? Trial and error then, eh? -- View this message in context: http://www.nabble.com/T4.1.3-without-ajax-tf4820033.html#a13789765 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 Newbie : populate the value of a form in a bean
In my case I think I was running in confusion, the MyObject was already initialized from a previous page and injected in the page that hold the form. Thus initialising it from onPrepareFromForm or setupRender is useless in this particular case. Things are working fine now, I really don't see what was wrong before as I can't see what's better now ... Newbie bad time. Josh send me good vibes ;-) I'm going to produce a little wiki tutorial on Basic Crud this weekend because that really miss me. Thanks for your help and your explainations. Howard Lewis Ship a écrit : Generally, what you want to do is replace setupRender() with onPrepareFromForm(). void onPrepareFromForm() { if (_myObject == null) _myObject = new MyObject(); } Prepare means the prepare event, fired from your Form component. Prepare event is triggered when the form starts to render AND when it starts to process a submission. Instantiating and object is exactly what prepare is intended for. Tapestry will supply an id of form for the t:form component. If you have multiple forms, they may end up being form, form_0, form_1. I tend to give an explicit id. You test page is a little different, in that it displays the contents of the myObject property as well, so your setupRender() should do the job (because the _myObject field is persistent). On Nov 15, 2007 11:39 AM, Josh Canfield [EMAIL PROTECTED] wrote: Hey Michael, I didn't get to it last night, but here you go, a very simple example: ** Start.tml html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head titleForm Test/title /head body MyObject:br/ Name: ${myObject.name}br/ Number: ${myObject.number}br/ t:form t:id=myForm t:errors/ t:label t:for=name/ input t:type=textfield t:id=name t:value= myObject.name/br/ t:label t:for=number/ input t:type=textfield t:id=number t:value=myObject.number/br/ input type=submit/ /t:form /body /html Start.java *package* joshcan.test.myapp.pages; ** *import* joshcan.test.myapp.model.TestObject; *import* org.apache.tapestry.annotations.Persist; /** * Start page of application myapp. */ *public* *class* Start { @Persist // Store this object in the session... * private* TestObject _myObject; * * * public* *void* setupRender() { *if* ( _myObject == *null* ) { // make sure we have an object to work on. _myObject = *new* TestObject(); } } * public* TestObject getMyObject() { *return* _myObject; } * public* *void* setMyObject(TestObject myObject) { _myObject = myObject; } } TestObject.java * package* joshcan.test.myapp.model; *public* *class* TestObject { * private* String name; * private* Long number; * public* String getName() { *return* name; } * public* *void* setName(String name) { *this*.name = name; } * public* Long getNumber() { *return* number; } * public* *void* setNumber(Long number) { *this*.number = number; } } Josh On Nov 15, 2007 1:35 AM, Michael Courcy [EMAIL PROTECTED] wrote: The title property of the video object is updated, I don't have a title property on my page class. I can't compile anything right now, but I'll try to put together a small example tonight, if someone else hasn't posted something by then. Josh Josh It would be really really nice !!! If you do so I would make it a small wiki tutorial Josh Canfield a écrit : Hi Michael, Thanks Josh, but do you have also a title property with getter and setter in your page class ? No, I only have the video getter/setter And if yes (as I guess) whish value is updated when you submit the form : MyPage.title or MyPage.video.title ? The title property of the video object is updated, I don't have a title property on my page class. I can't compile anything right now, but I'll try to put together a small example tonight, if someone else hasn't posted something by then. Josh On Nov 14, 2007 11:01 AM, Michael Courcy [EMAIL PROTECTED] wrote: Thanks Josh, but do you have also a title property with getter and setter in your page class ? And if yes (as I guess) whish value is updated when you submit the form : MyPage.title or MyPage.video.title ? Josh Canfield a écrit : I want to populate from the form directly to the bean. But this require to use either the beanEditForm or a custom component. You can get this to work. I use the textfield component for editing my bean objects. This is from a working emplate: input t:id=*title* t:type=*textfield* t:size=*40* t:value=* video.title* t:validate=*required* type=*text* / My page class has a getVideo method which returns an object that has a getTitle method. Good luck, Josh On Nov 14, 2007 9:05 AM, Michael Courcy [EMAIL PROTECTED] wrote: You're right here it is,
Re: Problem with 5.0.7-SNAPSHOT
I know that's code I've changed recently. The change affected both tapestry-ioc and tapestry-core, please check that you have current and only current versions of both of those. On Nov 16, 2007 7:50 AM, Alexander Lamb [EMAIL PROTECTED] wrote: Hello, It looks like since today (yesterday it was ok and with 5.0.6 it is ok) there is a problem: Caused by: java.lang.NoSuchMethodError: org.apache.tapestry.ioc.util.AbstractMessages.init(Ljava/util/ Locale;)V at org .apache.tapestry.internal.services.MapMessages.init(MapMessages.java: 41) at org .apache .tapestry .internal .services.MessagesSourceImpl.buildMessages(MessagesSourceImpl.java:98) at org .apache .tapestry .internal .services.MessagesSourceImpl.getMessages(MessagesSourceImpl.java:87) at org .apache .tapestry .internal .services .ComponentMessagesSourceImpl .getMessages(ComponentMessagesSourceImpl.java:112) at $ ComponentMessagesSource_1164924eae9 .getMessages($ComponentMessagesSource_1164924eae9.java) at org .apache .tapestry .internal .structure .InternalComponentResourcesImpl .getMessages(InternalComponentResourcesImpl.java:312) at ch.rodano.studies.components.LoginPanel.init(LoginPanel.java) Simply from this: t:Border xmlns:t=http://tapestry.apache.org/schema/ tapestry_5_0_0.xsd div style=margin-left:100px;width:300px; fieldset legendSudies foundation tester/legend t:LoginPanel t:pageNameIfSuccess=nextPageName / /fieldset /div /t:Border [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: java.lang.reflect.InvocationTargetException org.apache.tapestry.ioc.internal.util.TapestryException: java.lang.reflect.InvocationTargetException [at classpath:ch/rodano/ studies/pages/Start.tml, line 6, column 55] On the line of LoginPanel... Any idea if something changed or if I need to change something? -- Alexander Lamb Founding Associate RODANOTECH Sàrl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch -- 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]
Re: T5.0.6 about Tapestry ioc
It's roughly this: @Scope(perthread) public Transport buildHttpTransport(HttpServletRequest request) { return new HttpTransport(request.getAddress(), request.getPort(), request.isSecure()); } Actually, you can't directly inject HttpServletRequest (you can inject Tapestry's Request, and its possible to change things so that HttpServletRequest is injectable; see TapestryModule). The point is ... a service builder method can perform the necessary transformations. And you want this service to be perthread (there's a constant you can use in lieu of the pertread string there). On Nov 16, 2007 3:01 AM, lyifan [EMAIL PROTECTED] wrote: I want to implement a service: public interface Transport { public void send(); } public class HttpTransport implement Transport { private String _address; private int _port; private boolean _ssl; public HttpTransport (String address, int port, boolean ssl) { _address = address; _port = port; _ssl = ssl; } public void send) { // .. } } The parameter of the constructor is from http request. How can I build this service? I know I can use setters, but I just wanna know how to build a service using constructor. -- View this message in context: http://www.nabble.com/T5.0.6-about-Tapestry-ioc-tf4820490.html#a13791068 Sent from the Tapestry - User mailing list archive at Nabble.com. - 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]
Re: T5.0.6 about Tapestry ioc
You can do what you want, and should do whatever seems sensible for your needs. What I'm getting at is that T5 IoC can transparently handle creating services with constructor arguments, if those arguments are of types known to the container. String won't work, and I honestly don't know what would happen if you tried to pass one in, but it won't give you what you need. I think the container's object resolution relies on mapping a type to a single known instance, but I could be way off here. I think what you need is to build your service in a builder and manually pass it arguments. Of course if these object is based on the current request, that's a different story. Be sure to read: http://tapestry.apache.org/tapestry5/tapestry-ioc/module.html Sincerely, chris lyifan wrote: Hi Chris, Do you mean that any constructor parameters can be replaced by an object that provides those parameters? for an instance, if address, port, ssl are saved in a config file, I have to pass a ConfigFile object as the parameter of the HttpTransport constructor. Am I right? thank you Chris Lewis-5 wrote: I'm not sure I understand the constructor parameters. Do you mean they come from some other object (HttpRequest)? If so, why not just take HttpRequest as a constructor argument? If you do that then you can auto bind this service and IoC will know how to create it. If you insist on the parameters currently listed, then you'll need to have a service builder method, and inject HttpRequest as an argument into that method. lyifan wrote: I want to implement a service: public interface Transport { public void send(); } public class HttpTransport implement Transport { private String _address; private int _port; private boolean _ssl; public HttpTransport (String address, int port, boolean ssl) { _address = address; _port = port; _ssl = ssl; } public void send) { // .. } } The parameter of the constructor is from http request. How can I build this service? I know I can use setters, but I just wanna know how to build a service using constructor. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5.0.6 about Tapestry ioc
On Nov 16, 2007 6:36 PM, lyifan [EMAIL PROTECTED] wrote: for an instance, if address, port, ssl are saved in a config file, I have to pass a ConfigFile object as the parameter of the HttpTransport constructor. Are you just looking for a way to configure an HttpTransport instance with prescribed values? If so, ioc Symbols may be what you're looking for: http://tapestry.apache.org/tapestry5/tapestry-ioc/symbols.html On the other hand, you mentioned in your OP that these values come from the HttpRequest, so perhaps you have a different need altogether? What's the lifespan of an HttpTransport instance? Where do the address, port and ssl values come from, and _when_? As Chris mentioned, the TapestryModule makes a per-thread Request available to you, so getting the container to build and inject a per-thread HttpTransport instance would be easy, if thats what you're looking for: add a builder method to your app module that takes in Request, mark it as per-thread with @Scope, have it instantiate and return an HttpTransport instance and have this injected into your page/component. http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry/services/Request.html Don't know if any of that helps - we may need a little more context to understand your question. Cheers, lasitha - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes? [BUG?]
- Original Message - From: César Lesc [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Friday, November 16, 2007 5:57 PM Subject: Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes? You don't have to create a coercion for you custom class, how do you declare the binding in the template?. Just normally : Start.tml : t:imagemessage t:model=imageMessageModel/ And of course, Start.java contains : public ImageMessageModel getImageMessageModel() { return new ImageMessageModel(Type.ERROR, some error); } Can this be a bug due to some classloading issue ? Regards, Vjeran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T4] about cookie and page cycle
Hello, I've found howto set a cookie. I come to you to know more about why setting the cookie in renderPage() works, but not in beginPageRender() ?? Thanks Cyrille = I put my little code here, to archive it in Internet ;-) public abstract class Home extends BasePage { @Override public void renderPage( ResponseBuilder builder, IRequestCycle cycle ) { super.renderPage( builder, cycle ); setCookie(TestCookie, 789); } @InjectObject(infrastructure:cookieSource) public abstract CookieSource getCookieSource(); void setCookie( String name, String value ) { getCookieSource().writeCookieValue(name, value); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: why is a coorcion needed from subclass to abstract superclass?
just curious: why is it needed to make a cooercion from a page subclass to an abstract superclass? Isn't the cast already implictly defined by the 'super-sub relation'? Geert-Jan -- View this message in context: http://www.nabble.com/T5%3A-why-is-a-coorcion-needed-from-subclass-to-abstract-superclass--tf4821359.html#a13793439 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: Customize Grid
Thanks. It worked. :) On 11/16/07, Angelo Chen [EMAIL PROTECTED] wrote: not beanmodel but mode=department then in the code: void pageLoaded() { model = beanModelSource.create(Department.class, false, resources); model.remove(id); // remove ones not visible model.add(myNewField, null).label(New Field); //add ur new column. -- What you want today, may not exist tommorrow Blog: http://joshuajava.wordpress.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T4.1.3 Form submission
So, the java page is public abstract class RegistrationPage extends BasePage implements IExternalPage, PageBeginRenderListener { public abstract IRoomQuote getRoomQuote(); public abstract void setRoomQuote(IRoomQuote roomQuote); ... public void pageBeginRender(PageEvent event) { System.out.println(RegistrationPage); } public void onSelectCountrySubmit(IRequestCycle cycle) { System.out.println(onSelectCountryubmit); RegistrationDetailPage registrationDetailPage = (RegistrationDetailPage) cycle.getPage(RegistrationDetail); registrationDetailPage.setCity(London); registrationDetailPage.setRoomQuote(getRoomQuote()); cycle.activate(registrationDetailPage); } ... } The html page ... form jwcid=[EMAIL PROTECTED] listener=listener:onSelectCountrySubmit delegate=ognl:beans.validationDelegate success=listener:onSelectCountrySubmit updateComponents=selectCountry method=get stateful=false input type=hidden jwcid=@Hidden value=ognl:roomQuote/ ... Please select your country: select jwcid=selectCountry onchange=javascript:this.form.submit(); option value=1Greece/option option value=2USA/option /select and at the .page: page-specification class=com.dilos.web.page.RegistrationPage ... property name=countryModel/ property name=country/ component id=selectCountry type=PropertySelection binding name=model value=countryModel/ binding name=value value=country/ /component ... /page-specification The problem is that the roomQuote object is null when the listener onSelectCountrySubmit is invoked. I see in the console that when I change the value of the drop-down list, the form is submitted (because of the onChange), I see first the RegistrationPage that is in the PageBeginRender and then the listener, but then the getRoomQuote is null. What am I doing wrong? On Nov 16, 2007 3:00 PM, Andreas Andreou [EMAIL PROTECTED] wrote: Well, you must be doing something wrong... is it possible to show some code? On Nov 16, 2007 2:38 PM, nkonstantinou [EMAIL PROTECTED] wrote: Hi all, I'm facing this problem with T4.1.3. I have a page with a Form and I want to submit a value of the roomQuote object to the next page. The problem is that the page is reloading itself when the form is submitted having as a result to lose the object's (roomQuote) value. More specifically, I want to carry this object with me when I submit the form. I use a System.out.println() on the listener that is on the submit button of the form, and my object is null in the listener, so the value is lost BEFORE(?) submitting the Form. What is the best practice? I'm stuck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - 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]
T5: testing T5
I've started working on testing my components using the PageTester, partially based on the site docs and partially on the T5 source. I have a test method as follows, which mirrors how the FormTest in T5 works: @Test public void testEffects() { String appPackage = net.godcode.t5c.integration.pagelevel.rendering; String appName = ; tester = new PageTester(appPackage, appName); Document doc = tester.renderPage(TestSlideShow); } The page template for TestSlideShow uses my component like so: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body div t:type=gc/slideshow interval=3 divslide one/div divsecond one/div divthird one/div /div /body /html I have two issues. First, when run by mvn test, no test gets run. Second, I am able to run it through eclipse using a TestNG run config, but the test fails with an exception: org.apache.tapestry.ioc.internal.util.TapestryException: Unable to resolve 'gc/slideshow' to a component class name. This test is part of the same project, but my fake app for testing (net.godcode.t5c.integration.pagelevel.rendering) doesn't have an app module to add the component lib to its component package list. However, neither does the ones (app2) used by T5! Can anyone point out what I need to do? Thanks tons! Chris - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?
You don't have to create a coercion for you custom class, how do you declare the binding in the template?. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5.0.6 about Tapestry ioc
I want to implement a service: public interface Transport { public void send(); } public class HttpTransport implement Transport { private String _address; private int _port; private boolean _ssl; public HttpTransport (String address, int port, boolean ssl) { _address = address; _port = port; _ssl = ssl; } public void send) { // .. } } The parameter of the constructor is from http request. How can I build this service? I know I can use setters, but I just wanna know how to build a service using constructor. -- View this message in context: http://www.nabble.com/T5.0.6-about-Tapestry-ioc-tf4820490.html#a13791068 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] Is coercion MANDATORY for custom parameter classes? [BUG?]
That's weird, i do the same but in a component template, and have no problems I have a MenuItem that will render for certains users but not for others. then my layout template define the menuItems as follow ... li t:type=MenuItem user=user ... the MenuItem component define the user parameter as @Parameter(required = true) private UserSession user; and the layout component class define the getter as public UserSession getUser() { return userSession; } userSession is a ASO and is instantiate in the log in process but i don't think that matters. Cesar. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Grid component, reorder and empty source
On 11/16/07, Arve Klev [EMAIL PROTECTED] wrote: hi, as a novice in regards to Tapestry, I first thought it was a bug, but at last I tried to supply a beanmodel, and everything is fine (obvious to others, I think). I found the tip here: http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html. table t:type=grid pagerPosition=both source=persons model= personModel reorder=firstName / @Inject private BeanModelSource _beanModelSource; @Inject private ComponentResources _resources; @Retain private BeanModel _model; public BeanModel getPersonModell() { return _model; } void pageLoaded() { _model = _beanModelSource.create(Person.class, false, _resources); } Is this the right way to inform the grid component to use the Person.class ? Have you tried it yet? -- What you want today, may not exist tommorrow Blog: http://joshuajava.wordpress.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T4.1.3 Form submission
Hi all, I'm facing this problem with T4.1.3. I have a page with a Form and I want to submit a value of the roomQuote object to the next page. The problem is that the page is reloading itself when the form is submitted having as a result to lose the object's (roomQuote) value. More specifically, I want to carry this object with me when I submit the form. I use a System.out.println() on the listener that is on the submit button of the form, and my object is null in the listener, so the value is lost BEFORE(?) submitting the Form. What is the best practice? I'm stuck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: how to let subclass decide which component to render
I've got a page-class hierachy which all use component BaseLayout as their layout. This BaseLayout-component contains a component called QuickForm. Each page-class must render a QuickForm-component but the implementation may differ (so there is more than 1 actual QuickForm-component. I started experimenting with the following: BaseLayout - @Component @Parameter(required=true) private QuickForm quickForm; SuperPage --- @Component(parameters = {page=this,quickform=quickform}) private BaseLayout bl; @Component private QuickForm quickForm; So that he actual quickform can be passed as a parameter from (int this case) SuperPage to baselayout. However, then component quickForm in class SuperPage must exist in the template, which can be done by putting it in a block, (But SuperPage is just what its called, an abstract base-class ,which doens't have a termplate, so I must put the block in the templates of all actual implementations of SuperPage, etc. ,etc. ) Excuse the ranting, but I think you get the point. All in all, I don't like this approach at all. Am I missing something here? Thanks in advance, Geert-Jan -- View this message in context: http://www.nabble.com/T5%3A-how-to-let-subclass-decide-which-component-to-render-tf4820991.html#a13792436 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: expression language
There's been a lot of interest in and expanded version of the T5 expression language. I know T4 was equipped with ognl and people seem to have liked that very much. I could very well be off base here, and there may be a good reason for having chosen ognl before - but I'm curious - if what is desired is a full expression language, why not tap into a real scripting language? We could have a binding like 'script:' and provide complete expressions that get passed to an interpreter. This interpreter could even language agnostic (bsf?), as is jdk6's ScriptEngine, and developers could use what they like (rhino, jython, bsh, ...). Perhaps this is a horrible idea, but if so I think it is transitive and the actual bad idea is having an expression language at all. Its certainly true that with such power one has enough rope to hang oneself, at least from the view point of what a 'view' should be able to do. Thoughts? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T4.1.3 without ajax
Hi, I've used tapestry with ajax and it works well, but the current project is not using ajax, or anything related to javascript. What is the right way to do this? After disabling ajax etc. from shell, I still see that dojo javascripts are included in the head, AND dojo still registers forms etc, although it is not used. Have I misconfigured something, is this expected behaviour, or is it a bug in Tapestry? This is the shell and body that we're using: div jwcid=@Shell disableCaching=true disableTapestryMeta=true title=test body jwcid=@Body - 99 Ps. Right way to do this is not to use @Shell and @Body, but then the functionality of components are not guaranteed if I understood the docs right? Trial and error then, eh? -- View this message in context: http://www.nabble.com/T4.1.3-without-ajax-tf4820033.html#a13789765 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 about Tapestry ioc
Hi Chris, Do you mean that any constructor parameters can be replaced by an object that provides those parameters? for an instance, if address, port, ssl are saved in a config file, I have to pass a ConfigFile object as the parameter of the HttpTransport constructor. Am I right? thank you Chris Lewis-5 wrote: I'm not sure I understand the constructor parameters. Do you mean they come from some other object (HttpRequest)? If so, why not just take HttpRequest as a constructor argument? If you do that then you can auto bind this service and IoC will know how to create it. If you insist on the parameters currently listed, then you'll need to have a service builder method, and inject HttpRequest as an argument into that method. lyifan wrote: I want to implement a service: public interface Transport { public void send(); } public class HttpTransport implement Transport { private String _address; private int _port; private boolean _ssl; public HttpTransport (String address, int port, boolean ssl) { _address = address; _port = port; _ssl = ssl; } public void send) { // .. } } The parameter of the constructor is from http request. How can I build this service? I know I can use setters, but I just wanna know how to build a service using constructor. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/T5.0.6-about-Tapestry-ioc-tf4820490.html#a13792550 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] Is coercion MANDATORY for custom parameter classes?
Yes, I kept my parameter class inside same package as component, since it is only sensible place to keep it. It feels a bit stupid to have ImageMessage and ImageMessageModel in separate packages. So, its classloader issue then because of mandatory type of packaging. Hope this will change sometime in a future, because it really disturbs proper packaging. Since I have just criticism in my last mails, I want to say there are bunch of things which are S better then previous versions of Tapestry. -V.jeran - Original Message - From: Davor Hrg [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Friday, November 16, 2007 8:35 PM Subject: Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes? you must move any class that is not page or componenta from base, components, pages packages they get enhanced and those exceptions occur http://wiki.apache.org/tapestry/Tapestry5HowToNotMakeCustomComponent Davor Hrg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: expression language
ognl can be easily added as a binding prefix, however expect some features to not work because tapestry in some occasions needs to know in advance type that the expression will return (and this is statically, when bindings are prepared) I think I saw that ognl has methods that calculate return type for the expression ... read this: http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix I didn't put the ognl example because it seems unwanted in T5 (although byte code optimizer was introduced and it performs very well) here are classes you'll need to get it running /** * */ package test.tapestry.services; import java.util.Map; import ognl.Node; import ognl.Ognl; import ognl.OgnlException; import ognl.TypeConverter; import org.apache.tapestry.ComponentResources; import org.apache.tapestry.internal.bindings.AbstractBinding; import org.apache.tapestry.ioc.Location; import org.apache.tapestry.ioc.internal.util.TapestryException; public class OgnlBinding extends AbstractBinding{ private final Object _root; private final Object _compiledExpression; private final String _expression; private final Location _location; private Map _defaultContext; public OgnlBinding(final ComponentResources resources, final String expression, final Location location, TypeConverter typeConverter) throws OgnlException { _root = resources.getComponent(); _compiledExpression = Ognl.parseExpression(expression); _expression = expression; _location = location; _defaultContext = Ognl.createDefaultContext(_root, null, typeConverter); } public Object get(){ try{ return Ognl.getValue(_compiledExpression, _defaultContext, _root); }catch(Throwable t){ throw new TapestryException(ERROR evaluating expression: +_expression,_location, t); } } @Override public void set(final Object value) { try{ Ognl.setValue(_compiledExpression, _defaultContext, _root, value); }catch(Throwable t){ throw new TapestryException(ERROR evaluating expression: +_expression,_location, t); } } @Override public boolean isInvariant() { return false; } @Override public ClassObject getBindingType() { return Object.class; } } package test.tapestry.services; import ognl.OgnlException; import ognl.TypeConverter; import org.apache.tapestry.Binding; import org.apache.tapestry.ComponentResources; import org.apache.tapestry.ioc.Location; import org.apache.tapestry.ioc.internal.util.TapestryException; import org.apache.tapestry.services.BindingFactory; /** * Implementation of the ognl: binding prefix -- the expression is passed to ognl library, * and the component is set as context for the code */ public class OgnlBindingFactory implements BindingFactory { private final TypeConverter _typeConverter; public OgnlBindingFactory(TypeConverter typeConverter){ _typeConverter = typeConverter; } public Binding newBinding(String description, ComponentResources container, ComponentResources component, String expression, Location location) { try { return new OgnlBinding(container, expression, location, _typeConverter); } catch (OgnlException e) { throw new TapestryException(e.getMessage(),location,e); } } } package test.tapestry.services; import java.lang.reflect.Member; import java.util.Map; import ognl.TypeConverter; import org.apache.tapestry.ioc.services.TypeCoercer; public class OgnlTypeConverter implements TypeConverter{ private final TypeCoercer _coercer; public OgnlTypeConverter(TypeCoercer coercer){ _coercer = coercer; } public Object convertValue(Map context, Object target, Member member, String propertyName, Object value, Class toType) { return _coercer.coerce(value, toType); } } On Nov 16, 2007 3:52 PM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Nov 16, 2007 1:53 PM, Chris Lewis [EMAIL PROTECTED] wrote: Perhaps this is a horrible idea, but if so I think it is transitive and the actual bad idea is having an expression language at all. Its certainly true that with such power one has enough rope to hang oneself, at least from the view point of what a 'view' should be able to do. Thoughts? I've never used the whole power of OGNL during T4 days, always used it as a simple binding language. So by me there's no interest in having OGNL of any other scrpting language inside T5. Just my .02 EURO. -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: testing T5
Ok I retract part of that. I see this output in mvn test now: --- T E S T S --- Running net.godcode.t5c.integration.pagelevel.rendering.pages.TestSlideShow Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.024 sec Running net.godcode.t5c.integration.pagelevel.SlideShowTest Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 sec Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 It seems to run, but still says that 0 tests ran If I run from eclipse I get a different exception: FAILED: testEffects java.lang.NoClassDefFoundError: javax/servlet/ServletContext .. .. I want to get a test suite together, and among other things, test for JS errors (via selenium). If anyone can point out my errors I;d be very grateful. sincerely, chris Chris Lewis wrote: I've started working on testing my components using the PageTester, partially based on the site docs and partially on the T5 source. I have a test method as follows, which mirrors how the FormTest in T5 works: @Test public void testEffects() { String appPackage = net.godcode.t5c.integration.pagelevel.rendering; String appName = ; tester = new PageTester(appPackage, appName); Document doc = tester.renderPage(TestSlideShow); } The page template for TestSlideShow uses my component like so: html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; body div t:type=gc/slideshow interval=3 divslide one/div divsecond one/div divthird one/div /div /body /html I have two issues. First, when run by mvn test, no test gets run. Second, I am able to run it through eclipse using a TestNG run config, but the test fails with an exception: org.apache.tapestry.ioc.internal.util.TapestryException: Unable to resolve 'gc/slideshow' to a component class name. This test is part of the same project, but my fake app for testing (net.godcode.t5c.integration.pagelevel.rendering) doesn't have an app module to add the component lib to its component package list. However, neither does the ones (app2) used by T5! Can anyone point out what I need to do? Thanks tons! Chris - 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: T5: Grid component, reorder and empty source
Hi Arve, We're using an if to display grid only when it has data. Like this: test.java: ... On Nov 16, 2007 2:40 PM, adamh [EMAIL PROTECTED] wrote: Hi Arve, Yep, I got it to work as well - I should have been a bit more persistent with my searching, still its little 'should be simple' things like this that can trip you up if you are new to the T5 way. Its just a question of the docs getting updated, I thought I saw talk of a grid section/tutorial somewhere. Arve Klev wrote: yes, it works fine. 2007/11/16, Joshua Jackson [EMAIL PROTECTED]: On 11/16/07, Arve Klev [EMAIL PROTECTED] wrote: hi, as a novice in regards to Tapestry, I first thought it was a bug, but at last I tried to supply a beanmodel, and everything is fine (obvious to others, I think). I found the tip here: http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html . table t:type=grid pagerPosition=both source=persons model= personModel reorder=firstName / @Inject private BeanModelSource _beanModelSource; @Inject private ComponentResources _resources; @Retain private BeanModel _model; public BeanModel getPersonModell() { return _model; } void pageLoaded() { _model = _beanModelSource.create(Person.class, false, _resources); } Is this the right way to inform the grid component to use the Person.class ? Have you tried it yet? -- What you want today, may not exist tommorrow 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-Grid-component%2C-reorder-and-empty-source-tf4782045.html#a13797863 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]
Re: T4.1.3 Form submission
Hi Nikolaos At first sight it looks like roomQuote is not persisted. Try @Persist public abstract IRoomQuote getRoomQuote(); or property name=roomQuote persist=session/ Alejandro. On Nov 16, 2007 2:11 PM, Nikolaos Konstantinou [EMAIL PROTECTED] wrote: So, the java page is public abstract class RegistrationPage extends BasePage implements IExternalPage, PageBeginRenderListener { public abstract IRoomQuote getRoomQuote(); public abstract void setRoomQuote(IRoomQuote roomQuote); ... public void pageBeginRender(PageEvent event) { System.out.println(RegistrationPage); } public void onSelectCountrySubmit(IRequestCycle cycle) { System.out.println(onSelectCountryubmit); RegistrationDetailPage registrationDetailPage = (RegistrationDetailPage) cycle.getPage(RegistrationDetail); registrationDetailPage.setCity(London); registrationDetailPage.setRoomQuote(getRoomQuote()); cycle.activate(registrationDetailPage); } ... } The html page ... form jwcid=[EMAIL PROTECTED] listener=listener:onSelectCountrySubmit delegate=ognl:beans.validationDelegate success=listener:onSelectCountrySubmit updateComponents=selectCountry method=get stateful=false input type=hidden jwcid=@Hidden value=ognl:roomQuote/ ... Please select your country: select jwcid=selectCountry onchange=javascript:this.form.submit(); option value=1Greece/option option value=2USA/option /select and at the .page: page-specification class=com.dilos.web.page.RegistrationPage ... property name=countryModel/ property name=country/ component id=selectCountry type=PropertySelection binding name=model value=countryModel/ binding name=value value=country/ /component ... /page-specification The problem is that the roomQuote object is null when the listener onSelectCountrySubmit is invoked. I see in the console that when I change the value of the drop-down list, the form is submitted (because of the onChange), I see first the RegistrationPage that is in the PageBeginRender and then the listener, but then the getRoomQuote is null. What am I doing wrong? On Nov 16, 2007 3:00 PM, Andreas Andreou [EMAIL PROTECTED] wrote: Well, you must be doing something wrong... is it possible to show some code? On Nov 16, 2007 2:38 PM, nkonstantinou [EMAIL PROTECTED] wrote: Hi all, I'm facing this problem with T4.1.3. I have a page with a Form and I want to submit a value of the roomQuote object to the next page. The problem is that the page is reloading itself when the form is submitted having as a result to lose the object's (roomQuote) value. More specifically, I want to carry this object with me when I submit the form. I use a System.out.println() on the listener that is on the submit button of the form, and my object is null in the listener, so the value is lost BEFORE(?) submitting the Form. What is the best practice? I'm stuck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - 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: T5: Grid component, reorder and empty source
Hi Arve, Yep, I got it to work as well - I should have been a bit more persistent with my searching, still its little 'should be simple' things like this that can trip you up if you are new to the T5 way. Its just a question of the docs getting updated, I thought I saw talk of a grid section/tutorial somewhere. Arve Klev wrote: yes, it works fine. 2007/11/16, Joshua Jackson [EMAIL PROTECTED]: On 11/16/07, Arve Klev [EMAIL PROTECTED] wrote: hi, as a novice in regards to Tapestry, I first thought it was a bug, but at last I tried to supply a beanmodel, and everything is fine (obvious to others, I think). I found the tip here: http://tapestry.apache.org/tapestry5/tapestry-core/guide/beaneditform.html . table t:type=grid pagerPosition=both source=persons model= personModel reorder=firstName / @Inject private BeanModelSource _beanModelSource; @Inject private ComponentResources _resources; @Retain private BeanModel _model; public BeanModel getPersonModell() { return _model; } void pageLoaded() { _model = _beanModelSource.create(Person.class, false, _resources); } Is this the right way to inform the grid component to use the Person.class ? Have you tried it yet? -- What you want today, may not exist tommorrow 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-Grid-component%2C-reorder-and-empty-source-tf4782045.html#a13797863 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: Problem with 5.0.7-SNAPSHOT
sometimes, after updating from repository, i must remove the target/classes directory manualy from modules before compiling the library sources best regards homburg Softwaretechnik S.Homburg Seevetal / GERMANY Alexander Lamb schrieb: Hello, It looks like since today (yesterday it was ok and with 5.0.6 it is ok) there is a problem: Caused by: java.lang.NoSuchMethodError: org.apache.tapestry.ioc.util.AbstractMessages.init(Ljava/util/Locale;)V at org.apache.tapestry.internal.services.MapMessages.init(MapMessages.java:41) at org.apache.tapestry.internal.services.MessagesSourceImpl.buildMessages(MessagesSourceImpl.java:98) at org.apache.tapestry.internal.services.MessagesSourceImpl.getMessages(MessagesSourceImpl.java:87) at org.apache.tapestry.internal.services.ComponentMessagesSourceImpl.getMessages(ComponentMessagesSourceImpl.java:112) at $ComponentMessagesSource_1164924eae9.getMessages($ComponentMessagesSource_1164924eae9.java) at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.getMessages(InternalComponentResourcesImpl.java:312) at ch.rodano.studies.components.LoginPanel.init(LoginPanel.java) Simply from this: t:Border xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; div style=margin-left:100px;width:300px; fieldset legendSudies foundation tester/legend t:LoginPanel t:pageNameIfSuccess=nextPageName / /fieldset /div /t:Border [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: java.lang.reflect.InvocationTargetException org.apache.tapestry.ioc.internal.util.TapestryException: java.lang.reflect.InvocationTargetException [at classpath:ch/rodano/studies/pages/Start.tml, line 6, column 55] On the line of LoginPanel... Any idea if something changed or if I need to change something? -- Alexander Lamb Founding Associate RODANOTECH Sàrl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[T5.0.6] Is coercion MANDATORY for custom parameter classes?
Hello. Still getting acquainted with T5, and I created my first component called ImageMessage that accepts my custom ImageMessageModel parameter: public class ImageMessage { @Parameter(required = true) private ImageMessageModel model; } And when I bound my ImageMessageModel instance to that component's parameter, I got following exception note: Could not find a coercion from type com.t5test.tapestry.base.ImageMessageModel to type com.t5test.tapestry.base.ImageMessageModel Of course, I don't have coercion type registered for my custom class, but I don't need it because I'm NOT trying to bind different classes, just to pass instance of exactly the required parameter class. I hope the exception above doesn't mean that I have to register new coercion type for each custom class tha tI use as parameter inside my components? I looked at the docs abour parameter binding, and I didn't find that rule either. So I am confused what the above exception means? Regards, Vjeran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T4.1.3 Form submission
Well, it's not persisted, but it's supposed to be passed on through the hidden field But i dont see how roomQuote is initially set... So, it looks like it's always null - and of course remains null BTW, replace onchange=javascript:this.form.submit(); with onchange=tapestry.form.submit(this.form) cause it's long deprecated On Nov 16, 2007 3:31 PM, Alejandro Scandroli [EMAIL PROTECTED] wrote: Hi Nikolaos At first sight it looks like roomQuote is not persisted. Try @Persist public abstract IRoomQuote getRoomQuote(); or property name=roomQuote persist=session/ Alejandro. On Nov 16, 2007 2:11 PM, Nikolaos Konstantinou [EMAIL PROTECTED] wrote: So, the java page is public abstract class RegistrationPage extends BasePage implements IExternalPage, PageBeginRenderListener { public abstract IRoomQuote getRoomQuote(); public abstract void setRoomQuote(IRoomQuote roomQuote); ... public void pageBeginRender(PageEvent event) { System.out.println(RegistrationPage); } public void onSelectCountrySubmit(IRequestCycle cycle) { System.out.println(onSelectCountryubmit); RegistrationDetailPage registrationDetailPage = (RegistrationDetailPage) cycle.getPage(RegistrationDetail); registrationDetailPage.setCity(London); registrationDetailPage.setRoomQuote(getRoomQuote()); cycle.activate(registrationDetailPage); } ... } The html page ... form jwcid=[EMAIL PROTECTED] listener=listener:onSelectCountrySubmit delegate=ognl:beans.validationDelegate success=listener:onSelectCountrySubmit updateComponents=selectCountry method=get stateful=false input type=hidden jwcid=@Hidden value=ognl:roomQuote/ ... Please select your country: select jwcid=selectCountry onchange=javascript:this.form.submit(); option value=1Greece/option option value=2USA/option /select and at the .page: page-specification class=com.dilos.web.page.RegistrationPage ... property name=countryModel/ property name=country/ component id=selectCountry type=PropertySelection binding name=model value=countryModel/ binding name=value value=country/ /component ... /page-specification The problem is that the roomQuote object is null when the listener onSelectCountrySubmit is invoked. I see in the console that when I change the value of the drop-down list, the form is submitted (because of the onChange), I see first the RegistrationPage that is in the PageBeginRender and then the listener, but then the getRoomQuote is null. What am I doing wrong? On Nov 16, 2007 3:00 PM, Andreas Andreou [EMAIL PROTECTED] wrote: Well, you must be doing something wrong... is it possible to show some code? On Nov 16, 2007 2:38 PM, nkonstantinou [EMAIL PROTECTED] wrote: Hi all, I'm facing this problem with T4.1.3. I have a page with a Form and I want to submit a value of the roomQuote object to the next page. The problem is that the page is reloading itself when the form is submitted having as a result to lose the object's (roomQuote) value. More specifically, I want to carry this object with me when I submit the form. I use a System.out.println() on the listener that is on the submit button of the form, and my object is null in the listener, so the value is lost BEFORE(?) submitting the Form. What is the best practice? I'm stuck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - 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] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Grid component, reorder and empty source
Hi Arve, We're using an if, to display grid only when it has data. Like this: Test.java: ... public boolean getHasDataToGrid1() { return (_listGrd1.size() 0); } ... Test.tml ... t:if test=hasDataToGrid1 table t:type=grid ... Marcus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5.0.6] Is coercion MANDATORY for custom parameter classes?
you must move any class that is not page or componenta from base, components, pages packages they get enhanced and those exceptions occur http://wiki.apache.org/tapestry/Tapestry5HowToNotMakeCustomComponent Davor Hrg On Nov 16, 2007 5:57 PM, César Lesc [EMAIL PROTECTED] wrote: You don't have to create a coercion for you custom class, how do you declare the binding in the template?. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: expression language
of course, youll need the dependancy in your pom: dependency groupIdognl/groupId artifactIdognl/artifactId version2.6.9/version /dependency On Nov 16, 2007 8:42 PM, Davor Hrg [EMAIL PROTECTED] wrote: ognl can be easily added as a binding prefix, however expect some features to not work because tapestry in some occasions needs to know in advance type that the expression will return (and this is statically, when bindings are prepared) I think I saw that ognl has methods that calculate return type for the expression ... read this: http://wiki.apache.org/tapestry/Tapestry5HowToAddBindingPrefix I didn't put the ognl example because it seems unwanted in T5 (although byte code optimizer was introduced and it performs very well) here are classes you'll need to get it running /** * */ package test.tapestry.services; import java.util.Map; import ognl.Node; import ognl.Ognl; import ognl.OgnlException; import ognl.TypeConverter; import org.apache.tapestry.ComponentResources ; import org.apache.tapestry.internal.bindings.AbstractBinding; import org.apache.tapestry.ioc.Location; import org.apache.tapestry.ioc.internal.util.TapestryException; public class OgnlBinding extends AbstractBinding{ private final Object _root; private final Object _compiledExpression; private final String _expression; private final Location _location; private Map _defaultContext; public OgnlBinding(final ComponentResources resources, final String expression, final Location location, TypeConverter typeConverter) throws OgnlException { _root = resources.getComponent(); _compiledExpression = Ognl.parseExpression(expression); _expression = expression; _location = location; _defaultContext = Ognl.createDefaultContext (_root, null, typeConverter); } public Object get(){ try{ return Ognl.getValue(_compiledExpression, _defaultContext, _root); }catch(Throwable t){ throw new TapestryException(ERROR evaluating expression: +_expression,_location, t); } } @Override public void set(final Object value) { try{ Ognl.setValue(_compiledExpression, _defaultContext, _root, value); }catch(Throwable t){ throw new TapestryException(ERROR evaluating expression: +_expression,_location, t); } } @Override public boolean isInvariant() { return false; } @Override public ClassObject getBindingType() { return Object.class; } } package test.tapestry.services; import ognl.OgnlException; import ognl.TypeConverter ; import org.apache.tapestry.Binding; import org.apache.tapestry.ComponentResources; import org.apache.tapestry.ioc.Location; import org.apache.tapestry.ioc.internal.util.TapestryException; import org.apache.tapestry.services.BindingFactory ; /** * Implementation of the ognl: binding prefix -- the expression is passed to ognl library, * and the component is set as context for the code */ public class OgnlBindingFactory implements BindingFactory { private final TypeConverter _typeConverter; public OgnlBindingFactory(TypeConverter typeConverter){ _typeConverter = typeConverter; } public Binding newBinding(String description, ComponentResources container, ComponentResources component, String expression, Location location) { try { return new OgnlBinding(container, expression, location, _typeConverter); } catch (OgnlException e) { throw new TapestryException( e.getMessage(),location,e); } } } package test.tapestry.services; import java.lang.reflect.Member; import java.util.Map; import ognl.TypeConverter; import org.apache.tapestry.ioc.services.TypeCoercer ; public class OgnlTypeConverter implements TypeConverter{ private final TypeCoercer _coercer; public OgnlTypeConverter(TypeCoercer coercer){ _coercer = coercer; } public Object convertValue(Map context, Object target, Member member, String propertyName, Object value, Class toType) { return _coercer.coerce(value, toType); } } On Nov 16, 2007 3:52 PM, Massimo Lusetti [EMAIL PROTECTED] wrote: On Nov 16, 2007 1:53 PM, Chris Lewis [EMAIL PROTECTED] wrote: Perhaps this is a horrible idea, but if so I think it is transitive and the actual bad idea is having an expression language at all. Its certainly true that with such power one has enough rope to hang oneself, at least from the view point of what a 'view' should be able to do. Thoughts? I've never used the whole power of OGNL during T4 days, always used it as a simple binding language. So by me there's no interest in having OGNL of any other scrpting language inside T5. Just my .02 EURO. --
Re: T4.1.3 Form submission
Well, you must be doing something wrong... is it possible to show some code? On Nov 16, 2007 2:38 PM, nkonstantinou [EMAIL PROTECTED] wrote: Hi all, I'm facing this problem with T4.1.3. I have a page with a Form and I want to submit a value of the roomQuote object to the next page. The problem is that the page is reloading itself when the form is submitted having as a result to lose the object's (roomQuote) value. More specifically, I want to carry this object with me when I submit the form. I use a System.out.println() on the listener that is on the submit button of the form, and my object is null in the listener, so the value is lost BEFORE(?) submitting the Form. What is the best practice? I'm stuck! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: expression language
thanks, I've played with it only a bit... It was that time that MVEL was said to be much faster than OGNL and very long flame on serverside. I've just wanted try both, and made a small project that adds both binding prefixes.. (I was not testing speeds .. just integration...) after playing with it I was more satisfied with OGNL, and MVEL crashed on some simple examples when byte code optimizer was turned on for it. Davor Hrg On Nov 16, 2007 10:06 PM, Jesse Kuhnert [EMAIL PROTECTED] wrote: You can know the type in advance by calling OgnlContext.getCurrentType() after evaluating an expression (or getPreviousType() / getFirstType() / the type and accessor types are all pushed on to a stack now).. It also supports generics / enums / varargs / etc now.. On Nov 16, 2007 2:42 PM, Davor Hrg [EMAIL PROTECTED] wrote: ognl can be easily added as a binding prefix, however expect some features to not work because tapestry in some occasions needs to know in advance type that the expression will return snipped -- 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]
[T5] Cannot persist field exception
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
Re: T5: expression language
You can know the type in advance by calling OgnlContext.getCurrentType() after evaluating an expression (or getPreviousType() / getFirstType() / the type and accessor types are all pushed on to a stack now).. It also supports generics / enums / varargs / etc now.. On Nov 16, 2007 2:42 PM, Davor Hrg [EMAIL PROTECTED] wrote: ognl can be easily added as a binding prefix, however expect some features to not work because tapestry in some occasions needs to know in advance type that the expression will return snipped -- 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]
OGNL Expression evaluated 4 times on tap 4.1.2 release
Tap 4.1.2 release tapestry-test 5.0.5 selenium 0.8.1 (with Jetty baked into Jar) win xp pro sp/2 java 1.5.0_05 This occurs when i am executing tests as part of my selenium integration tests. I have not looked into how this behaves in a more typical deployment environment. As far as I can tell Jetty is running without the two development options that I know of enabled (disable-caching and enable-reset-service). This has been mentioned on the board before as an issues with the 4.1.2 SNAPSHOT back in May/07 and the 4.1.3 SNAPSHOT in Sept/07. -- http://www.nabble.com/-Tap-4.1.2--Problem-with-repeated-calls-to-an-If-component-tf3772676.html#a10676029 -- http://www.nabble.com/OGNL-Methode-called-several-times-tf4488389.html#a13619568 The response to the Problem-with-repeated-calls-to-an-If-component thread suggests that this will be fixed before the release of 4.1.2. At least one other person has run across this using the 4.1.3 release. -- http://www.nabble.com/-Tap-4.1.2--Problem-with-repeated-calls-to-an-If-component-tf3772676.html#a13551793 Is this a configuration/user error on my side, or is the framework still purposefully evaluating these OGNL expressions 4 times? Carlos -- View this message in context: http://www.nabble.com/OGNL-Expression-evaluated-4-times-on-tap-4.1.2-release-tf4824162.html#a13802424 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: expression language
Oh wellit wouldn't hurt my feelings if anyone used MVEL. I'm only as loyal to the best technology and hope everyone else would be too. On Nov 16, 2007 4:35 PM, Davor Hrg [EMAIL PROTECTED] wrote: thanks, I've played with it only a bit... It was that time that MVEL was said to be much faster than OGNL and very long flame on serverside. I've just wanted try both, and made a small project that adds both binding prefixes.. (I was not testing speeds .. just integration...) after playing with it I was more satisfied with OGNL, and MVEL crashed on some simple examples when byte code optimizer was turned on for it. Davor Hrg On Nov 16, 2007 10:06 PM, Jesse Kuhnert [EMAIL PROTECTED] wrote: You can know the type in advance by calling OgnlContext.getCurrentType() after evaluating an expression (or getPreviousType() / getFirstType() / the type and accessor types are all pushed on to a stack now).. It also supports generics / enums / varargs / etc now.. On Nov 16, 2007 2:42 PM, Davor Hrg [EMAIL PROTECTED] wrote: ognl can be easily added as a binding prefix, however expect some features to not work because tapestry in some occasions needs to know in advance type that the expression will return snipped -- 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] -- 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: Problem with 5.0.7-SNAPSHOT
mvn clean doesn't work for you? Kalle On 11/16/07, Sven Homburg [EMAIL PROTECTED] wrote: sometimes, after updating from repository, i must remove the target/classes directory manualy from modules before compiling the library sources best regards homburg Softwaretechnik S.Homburg Seevetal / GERMANY Alexander Lamb schrieb: Hello, It looks like since today (yesterday it was ok and with 5.0.6 it is ok) there is a problem: Caused by: java.lang.NoSuchMethodError: org.apache.tapestry.ioc.util.AbstractMessages .init(Ljava/util/Locale;)V at org.apache.tapestry.internal.services.MapMessages.init( MapMessages.java:41) at org.apache.tapestry.internal.services.MessagesSourceImpl.buildMessages( MessagesSourceImpl.java:98) at org.apache.tapestry.internal.services.MessagesSourceImpl.getMessages( MessagesSourceImpl.java:87) at org.apache.tapestry.internal.services.ComponentMessagesSourceImpl.getMessages (ComponentMessagesSourceImpl.java:112) at $ComponentMessagesSource_1164924eae9.getMessages($ComponentMessagesSource_1164924eae9.java) at org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.getMessages (InternalComponentResourcesImpl.java:312) at ch.rodano.studies.components.LoginPanel.init(LoginPanel.java) Simply from this: t:Border xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd div style=margin-left:100px;width:300px; fieldset legendSudies foundation tester/legend t:LoginPanel t:pageNameIfSuccess=nextPageName / /fieldset /div /t:Border [ERROR] RequestExceptionHandler Processing of request failed with uncaught exception: java.lang.reflect.InvocationTargetException org.apache.tapestry.ioc.internal.util.TapestryException: java.lang.reflect.InvocationTargetException [at classpath:ch/rodano/studies/pages/Start.tml, line 6, column 55] On the line of LoginPanel... Any idea if something changed or if I need to change something? -- Alexander Lamb Founding Associate RODANOTECH Sàrl 4 ch. de la Tour de Champel 1206 Geneva Switzerland Tel: 022 347 77 37 Fax: 022 347 77 38 http://www.rodanotech.ch - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to make a basic crud : Feedback wanted
http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud -- Michael Courcy http://courcy.blogspot.com
T5: Decorating A Service In a Sub Module
I am working on a sizable application where I am trying to decorate the PageRenderRequestHandler service. I have two modules - a Main Module and a Sub Module. The Sub Module is loaded using the @SubModule annotation on the Main Module. Both modules are trying to decorate the PageRenderRequestHandler The problem is that I am unable to get tapestry to execute the decorating code in the SubModule. The sub module decorator looks like this public PageRenderRequestHandler decoratePageRenderRequestHandler (ClassPageRenderRequestHandler serviceInterace, Object delegateObj { final PageRenderRequestHandler castDelegate = (PageRenderRequestHandler) delegateObj; return new PageRenderRequestHandler() { public ActionResponseGenerator handle(String logicalPageName, String[] context) { // my decorator specific code is removed here ActionResponseGenerator handle = castDelegate.handle(logicalPageName, context); return handle; } }; } Whenever the code is supposed to run - I get the following message showing up in the log... Could not add object with duplicate id 'PageRenderRequestHandler'. The duplicate object has been ignored. The Main Module decorator is functioning correctly. The documentation on decorators mentions the putting @Order annotation on the sub module. However - when I annotate my decorator builder method with @Order(before:*) or @Order(after:*) - I get the same logging message and still the Sub Module decorator is not being executed. Is anyone familiar with how to correctly specify multiple decorators on a single service? Any help would be appreciated. Thanks. David Kendall Software Architect Lithium Technologies - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to make a basic crud : Feedback wanted
Hi. Although your example is very simple in code as such, it suffers from some drawbacks, mainly because you don't have activation context for Save page. 1. Your create and edit actions on Start page use ActionLinks which make 2 HTTP requests (action + render Save page), whereas PageLinks with myBeanId context value would execute just one HTTP request which will just render Save page, and that is all you actually need 2. Its always good practice to pass only necessary activation context values (in this case myBeanId), and let page itself be responsible to reconstructing all that is necessary, meaning, it is not good to instantiate new MyBean or fetch it from database outside of Save page as in your case, but to do it inside it, in onPrepare event method. This way if you have some additions to save page which maybe lead to another page and get back to it, all you need to do when getting back to Save page is to make certain this entity ID is present there, and page will know how to reconstruct itself. 3. If you keep only myBeanId inside Save as Session persistent value, your Session has much less overhead in cluster recplication then when holding whole instances. Though I guess this is just small gain, often dismissable. Of course, all the written above depends on situation and your needs. Regards, Vjeran - Original Message - From: Michael Courcy [EMAIL PROTECTED] To: Tapestry users users@tapestry.apache.org Sent: Saturday, November 17, 2007 12:16 AM Subject: How to make a basic crud : Feedback wanted http://wiki.apache.org/tapestry/Tapestry5How_to_make_a_basic_crud -- Michael Courcy http://courcy.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Feedback wanted on IoC documentation
Hi Howard -- I appreciate the work you are doing on T5 and look forward to moving to it when it is further along. I just want to comment on the only-constructor injection policy that you are promoting. And the fact that the two paragraphs are contradictory. In the first you acknowledge that services may be outside the scope of Tapestry IoC. But in the next you go on to say that To encourage service implementations to properly store service depenencies as final instance variables, such dependencies are passed only into the constructor. which doesn't jive with the place-nice-with-others phrasing in the first paragraph. I disagree with philosophy of forcing people to have the services only injected via constructors because: 1. it results in a monster constructors for some key services. 2. yet another barrier to converting from T4 3. unnecessarily imposing a requirement on the Tapestry developer. 4. meaningless - just because you force a monster constructor doesn't mean the person is going to make it a final member. 5. You are assuming that it is unconceivable for services once wired together to ever want to be rewired - and this is not the case. But at the end of the day - why be dogmatic about this? Or did I misunderstand something? -Pat P.S. the case for rewiring is thus: Originally wiring the service it is wired to a local version of another service. While the server is running, the local service is turned off and replaced with a reference to a remote version of the service. This would happen if the box is experiencing high traffic volumes and rather than handle all the work on the current box, the server starts sending some traffic to an different server. The idea of rigid, statically wired services defeats this flexibility. On Nov 10, 2007 3:22 PM, Howard Lewis Ship [EMAIL PROTECTED] wrote: Services are loaded by the normal class loader without any special trickery. We create classes (proxies and such), but don't modify existing classes for Tapestry IoC. This is necessary to ensure that services code inter-operates properly with all kinds of third party, legacy and other code that is far, far beyond the scope of Tapestry IoC. To encourage service implementations to properly store service depenencies as final instance variables, such dependencies are passed only into the constructor. So for services, injection is assumed, for the constructor parameters (as if an @Inject annotation was present).
Re: T5: Grid component, reorder and empty source
Hi Marcus, Thanks, thats easier. Arve 2007/11/16, Marcus [EMAIL PROTECTED]: Hi Arve, We're using an if, to display grid only when it has data. Like this: Test.java: ... public boolean getHasDataToGrid1() { return (_listGrd1.size() 0); } ... Test.tml ... t:if test=hasDataToGrid1 table t:type=grid ... Marcus - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]