Accessing tapestry request params outwith a page
Hi. I have a utility class that I call from within my application. Is it possible to access the current request and requests parameters from within my utility class so I can access form parameter values that were uploaded in the current request? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
Nice. I was thinking I could only inject a request into a page class. So I can inject the request anywhere in the application? Great. Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291p5718293.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Accessing tapestry request params outwith a page
...just out of interest. Am I correct in thinking that form parameters for a Tapestry form upload are not stored in the usual HttpServletRequest parameters? The reason I ask is that I was originally accessing the HttpServletRequest object, to try and get to the form parameter I was looking for. From memory, I think that my HttpServletRequst only had a parameter called 'f:formdata', rather than each parameter of the form. Does tapestry actually put submitted form fields into a single HttpServletReqeust parameter when a form is submitted? If so, is this why we inject a tapestry Request class to get access to the form parameters, rather than accessing them from the original HttpServletRequest (as they would actually be bundled within one parameter at that stage)? Not sure if I'm way off the mark with my thinking there ^^^ -- View this message in context: http://tapestry.1045711.n5.nabble.com/Accessing-tapestry-request-params-outwith-a-page-tp5718291p5718294.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding a progress listener to UploadedFile
Thanks. I wasn't able to use the following annotation and method... @Contribute(ServiceOverride.class) public static void setupApplicationServiceOverrides(MappedConfigurationClass,Object configuration) { configuration.addInstance(SomeServiceType.class, SomeServiceTypeOverrideImpl.class); } I have a suspicion I am on an earlier version of tapestry 5 (I am still on 5.1.0.5). I have managed to override MultipartDecoderImpl in a very hacky way which has allowed me to set the progress listener. It's an early POC I'm doing so, happy that it works, but will look into upgrading tapestry soon if need be. Thanks for your help. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-progress-listener-to-UploadedFile-tp5718197p5718215.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Adding a progress listener to UploadedFile
Hi there. I would like to add a progress listener to UploadedFile to track progress up the file being uploaded. I know that it's possible to do this with apache commons file upload. Is there an easy way to do it with the T5 UploadedFile class? Cheers, Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-progress-listener-to-UploadedFile-tp5718197.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding a progress listener to UploadedFile
Yes. Is there a way to set the listener from within Tapestry? -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-progress-listener-to-UploadedFile-tp5718197p5718199.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Setting element value from an attribute
Hi. When creating dynamic content in a TML template file I normally do something like this: ${user.email} So when running the template in my tapestry app, I get a header with the logged in user's email address. But, when viewing the template outside of tapestry, as a normal file, obviously I get ${user.email} shown in the header. I really like being able to design my templates outside of the application and I would like to have something like this: testu...@test.com Is there a way of doing something like that so that my template looks okay when viewed outside of the application, and the element is updated appropriately when running inside the app? Many thanks, Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Setting-element-value-from-an-attribute-tp5715597.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Setting element value from an attribute
Could I extend that a little and create a component that does the following? [hidden email] Then tapestry could replace the dispayed value with thee specified 'property'? I wonder if a comonent like that exists, or how I would write one if it doesn't? Thanks... -- View this message in context: http://tapestry.1045711.n5.nabble.com/Setting-element-value-from-an-attribute-tp5715597p5715604.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Setting element value from an attribute
brilliant! it actually works with outputraw, which means i don't have to supply the format... and it's always going to be a string that I set, so should be fine. Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Setting-element-value-from-an-attribute-tp5715597p5715609.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Adding a dynamic sub directory to URL
Hi folks. I am writing a web app to be used by a number of clubs. Each club can register and create a gallery page and a contact page. Both pages will then be public. I each clubs pages to be viewable from the following urls: http://localhost/club_url_friendly_name/gallery http://localhost/club_url_friendly_name/contact When someone browse to either of the urls the app uses the first part of the path (club_url_friendly_name) to set the appropriate club in the session and show the appropriate club page. Basically I want to give the impression that each club has its own sub-dir in the application. Does anyone know if there is a way of achieving this? Many thanks, David. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-dynamic-sub-directory-to-URL-tp5714532.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding a dynamic sub directory to URL
Superbe! It looks like I can just use a URL rewriter filter to rewrite my URLs and pass the club name in as a request param. http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/4.0/index.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-dynamic-sub-directory-to-URL-tp5714532p5714534.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding a dynamic sub directory to URL
Thanks. Will take a look. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-dynamic-sub-directory-to-URL-tp5714532p5714535.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Adding a dynamic sub directory to URL
This looks perfect! Tapestry is outstandingly good. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-dynamic-sub-directory-to-URL-tp5714532p5714537.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Using layouts - partial page templates
Hi there. I'm looking to create a Layout.tml template file to hold the header/footer/navigation elements of my page, and then create the content within separate files such as Index.tml, About.tml Obviously, at the moment, when viewing these files outside of Tapestry, they just show a snippet of html. It is only when running under tapestry that it fills in the surrounding header/body at runtime using the Layout.tml template and replacing the t:body/ element. So far so good. But I would like Index.tml and About.tml to look complete when viewed as plain files (not running under tapestry), to help our designer. Therefore I would like Index.tml and About.tml to have all the complete header/body elements. I tried putting t:remove tags around the html in these files that I want tapestry to ignore at runtime (so it can replace them with the contents of Layout.tml. But this doesnt seem to work. Is there another way to achieve what Im trying to do? Many thanks, David. Is ther -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-layouts-partial-page-templates-tp4806800p4806800.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using layouts - partial page templates
Hi. the trouble is when I try to escape everything around the main content.. eg. if the About.tml looks a bit like this... html head /head body about text /body html I want it to have all the body/head tags in the TML file as above, so it can easily be viewed outiside of tapestry. But, i want tapestry to use Layout.tml to fill in everyting outside of the content, when running live. So i tried doing this approach... t:remove html head /head body /t:remove about text t:remove /body html /t:remove I was hoping that tapestry would remove the surrounding html at runtime, and fill this in using the HTML for my Layout.tml template. But tapestry doesnt like removing the above sections as the elements inside the remove tags dont have matching open close elements. I know this seems like a really long winded way of doing what I want but I cant find anyting simpler. Essentiall i jsut want to have a bunch of TML files that can easily be viewed in a browser (nice for the designer), but then Tapestry strips out the nav bar at the top and the footer etc. and replaces them with ones from Layout.tml. I wanted to do this so I know that all pages have the correct up to date nav bar/footer when running live, but the designer can still design against full html pages? Thanks again, David. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-layouts-partial-page-templates-tp4806800p4806846.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Using layouts - partial page templates
Thank you s much!. That's exactly what I've been looking for. Should have read more closely. Cheers, David. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Using-layouts-partial-page-templates-tp4806800p4806882.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Changing the look of the validation bubbles
Hi guys. Is it possible to access the imaes that are used by validation bubbles? I wanted to make the less round and change the colour. any ideas? Thanks. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Changing-the-look-of-the-validation-bubbles-tp4730327p4730327.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
How do I add a dynamic number of forms to a page?
Hi there. I have a page on which I want to have a number of forms, one for each person. The forms will have forename, surname, etc... the usual fields. However, I wont know how many person forms I want on the page until runtime. At the moment it seems that I need to have a @Component on my page class for each form like this... @Component private Form personForm; And also a property for each form field... @Property @Validate(required) private String surname; If I add two person forms to my page, it looks like I will need to add extra components to my page class code. But this won't work if I want to make the number of forms on the page flexible as it will be hard coded wont it? Is there no way that I can have many forms on the same TML template, with the same name... and which ever one gets submitted, is the one that gets processed by the page class? If I could do this, all I need to do is add a hidded ID field to each form to determine which user to update in the database. But this doesnt seem possible. If I try to add 2 forms with the same t:id values in the TML file, I get this error... Exception assembling embedded component 'personForm' (of type org.apache.tapestry5.corelib.components.Form, within MyPage): Component MyPage already contains a child component with id 'personForm' Here is my page class code... public class MyPage { @Component private Form personForm; @Property @Validate(required) private String forename; @Property @Validate(required) private String surname; @Property private String personId; //Hidden form field to determine which person to update Here is the TML that I am using... form name=personForm id=personForm t:id=personForm p input type=hidden name=personid id=personid t:id=personid t:type=personid t:value=//value set as person id / /p p label for=forename class=labelForename:/label input type=text name=forename id=forename t:id=forename t:type=TextField t:value=forename / /p p label for=surname class=labelSurname:/label input type=text name=surname id=surname t:id=surname t:type=TextField t:value=surname / /p /form Any help or alternative suggestions would be much appreciated. Cheers!!! -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-do-I-add-a-dynamic-number-of-forms-to-a-page-tp4674893p4674893.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Select component... Can i just pass it a list of values?
Hi. Is there any way I can create a select field and get is just to use the options listed in the html? The values I have are never going to change and Im happy with the list in the TML. Eg... I have... form t:id=search_form name=search_form p label for=employeeType class=labelEmployee Type:/label select style=width:178px; t:type=select t:model=??? t:value=employee_type option value=anyAny/option option value=permPermanent/option option value=tempTemp/option /select /p Obviously this complains that I dont have a t:model specified. But I dont want to really have to create a Select Model and Enum in Java to back this, when I really jsut want the values 'perm' and 'temp' already in my template above. Do I really need to create 2 or more Java classes with and an enum just to show this list of options that Ive already defined in the TML? Any help appreciated. Thanks!!! Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Select-component-Can-i-just-pass-it-a-list-of-values-tp4674906p4674906.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: How do I add a dynamic number of forms to a page?
Yesss!. Tapestry seems to take care of it if I just create a loop. So I can loop through each person, create a form for each, and have one Form component with one set of field props in the page class that each generated HTML for can submit too. Brilliant. -- View this message in context: http://tapestry.1045711.n5.nabble.com/How-do-I-add-a-dynamic-number-of-forms-to-a-page-tp4674893p4675090.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Select component... Can i just pass it a list of values?
Brilliant! Thanks -- View this message in context: http://tapestry.1045711.n5.nabble.com/Select-component-Can-i-just-pass-it-a-list-of-values-tp4674906p4675175.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
URL used for localization seems to have locale in path?
Hi there. When using localization to display different template files based on the locale, it seems to ad the locale to the URL. Is that normal behaviour? Eg. I have 2 homepage files... Home_en.tml and Home_fr.tml. If I set the locale to French, and go to the homepage, if goes to URL /fr/Home rather than /Home. The problems is that may page uses relative CSS paths which mean it doesn't display correctly. If I want to share css files between 2 different templates in this case, it gets a little messy. Does it look like Ive done something wrong? Many thanks, Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/URL-used-for-localization-seems-to-have-locale-in-path-tp4513977p4513977.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Can you dynamically select which page template to return?
Not sure if that makes any sense but here goes... For each page in Tapestry, I know that I need to specify a page class, and a corresponding TML templage file for that page. I was wondering if I can have more than one possible TML file for a page... and programatically decide which one to use? Hope makes sense. Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4505668.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Can you dynamically select which page template to return?
Ah. Maybe this is what I need to dynamically use a different template for a page... http://tapestry.apache.org/localization.html -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4505678.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Can you dynamically select which page template to return?
Thanks Lewis. I can see what you mean. It does sound like I'm trying to do something action-oriented/Struts-like. I'm a big fan of the way Tapestry doesn't force you to think in this way and is more intuitive. The reason I ask actually, is more to do with wanting to re-skin pages based on a user. Ie. want the same content (so just need one page class), but Id like to use a different TML file altogether based on the user. This way, I am hoping to work on 2 separate TML files in design mode, and the can be served based on which type of user is logged in. For example... a funky design versus a more mature design based on the age of the user. Sounds weird :-), but just wondering if there's an easy way to select the TML file at run time, that Tapestry uses with a single page class. I think the localization functionality would actually do just the trick if I just assign the funky styled tml file to one (eg. HomePage_fr.tml) and the refined one (HomePage_en.tml). Then I can programatically set the local based on the logged in user. Does that sound like a completely deranged way of going about it? :-) Thanks, Dave. Mon, 6/20/11, Howard Lewis Ship [via Tapestry] ml-node+4507472-1501312819-92...@n5.nabble.com wrote: From: Howard Lewis Ship [via Tapestry] ml-node+4507472-1501312819-92...@n5.nabble.com Subject: Re: Can you dynamically select which page template to return? To: dkeenan david_siedle...@yahoo.co.uk Date: Monday, June 20, 2011, 7:49 PM On Mon, Jun 20, 2011 at 2:26 AM, dkeenan [hidden email] wrote: Not sure if that makes any sense but here goes... For each page in Tapestry, I know that I need to specify a page class, and a corresponding TML templage file for that page. It's easy to make a single page dynamic, or to choose one of a number of different pages to render the response. I feel you may be sticking too much to the action-oriented framework's view of actions views; in Tapestry a page is the combination of an action and a view. This drives a lot of what Tapestry does for you, in terms of convention over configuration, and all the plumbing and request handling that the framework does automatically. It's a good idea to backtrack from I need to select two different output views back towards the actual user requirement or story. For instance, I need to display input validation errors can be a condtional portion of a single page. Many other cases can be handled in terms of having pages with different responsibilities. It's rather hard to provide guidance in a vacuum. I was wondering if I can have more than one possible TML file for a page... and programatically decide which one to use? Hope makes sense. Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4505668.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com - To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] If you reply to this email, your message will be added to the discussion below: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4507472.html To unsubscribe from Can you dynamically select which page template to return?, click here. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4507615.html Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: Can you dynamically select which page template to return?
Thanks Lewis. I can see what you mean. It does sound like I'm trying to do something action-oriented/Struts-like. I'm a big fan of the way Tapestry doesn't force you to think in this way and is more intuitive. The reason I ask actually, is more to do with wanting to re-skin pages based on a user. Ie. want the same content (so just need one page class), but Id like to use a different TML file altogether based on the user. This way, I am hoping to work on 2 separate TML files in design mode, and the can be served based on which type of user is logged in. For example... a funky design versus a more mature design based on the age of the user. Sounds weird :-), but just wondering if there's an easy way to select the TML file at run time, that Tapestry uses with a single page class. I think the localization functionality would actually do just the trick if I just assign the funky styled tml file to one (eg. HomePage_fr.tml) and the refined one (HomePage_en.tml). Then I can programatically set the local based on the logged in user. Does that sound like a completely deranged way of going about it? :-) Thanks, Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4507623.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Can you dynamically select which page template to return?
Thanks Thiago. Yeah I see what you mean also. Ideally the HTML should be the content, and be completely separate from styling (that's CSS's job). This is exactly how it should be done as you say, but I'm also keen to reuse existing HTML templates without having to re-factor too much (some changes would def be needed of course, but I'd rather avoid having do a major re-write of existing designs I have). I'm more looking to resuse my existing designs, but plug them into the same backend page class as they will be using the same data (just doing slightly different things with the data). I do like the idea of using the localisation functionality that Tapesty has. Just feels a little weird as I know that's not it's purpose. Thanks. Dave. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4508071.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Can you dynamically select which page template to return?
Sounds great. I'll take that approach in that case. Thanks for your help. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4508195.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Can you dynamically select which page template to return?
Hi. I just gave that a go, using localization to serve a different TML template. Started by adding following lines to AppModule: public static void contributeApplicationDefaults( MappedConfigurationlt;String, Stringgt; configuration) { configuration.add(tapestry.supported-locales, en,fr); } Then set locale programatically: @Inject private PersistentLocale localeService; . . . localeService.set(new Locale(fr)); (did this in Activate method of a super Page class that all my page classes extend. I have a page called Home.tml (Backed by Home.java which extends Page.java) I renamed Home.tml to Home_fr.tml. When I try to access this page however the broser navigates to /fr/Home. I was thinking that it should just display /Home in the URL as before, but serve the html from the new template file (Home_fr.tml)? Thanks again!! -- View this message in context: http://tapestry.1045711.n5.nabble.com/Can-you-dynamically-select-which-page-template-to-return-tp4505668p4508411.html Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org