Re: Re: tapestry-acegi questions
On 11/10/06, James Carman [EMAIL PROTECTED] wrote: You could use a callback somehow to do that, I would think. But, you would probably have to implement the auto-redirect-to-login-page logic yourself, so that you could save the callback into the session or set it on the login page as a property or something. Thanks to James again :), I have a working solution that redirects after successful login. However, on Firefox it works like a charm, but on Safari it doesn't work as it seems it doesn't process cookies or something the same way. Firefox: anon: securedpage - login redirect anon: login successful - securepage redirect loggedin: securepage Safari anon: securedpage - login redirect anon: login successful - securepage redirect still anon: securepage - login redirect loggedin: when landing on login page My authenticationProcessingFilter looks like this. http://pastebin.com/822425 The attemptAuthentication(String, String) is called from my tapestry listener. Maybe I need to flush the http response or something? Or maybe I need to tell tapestry to step processing? -- regards, Robin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: use unique id's generated by tapestry
Not anymore they don't. On 11/9/06, Robert Binna [EMAIL PROTECTED] wrote: Hi. Thanks, but I know about this method getClientId(), but each component looses its client id information after rendering is finished and so the parent component will never know. regards Robert Roberto Ramírez Vique schrieb: Hello, I'm not sure because I've never used it ... but I think tapestry 4.1(I'm using 4.0 because 4.1 is not stable) let you know which is the clientId for a component: http://tapestry.apache.org/tapestry4.1/tapestry-framework/apidocs/org/apache/tapestry/IComponent.html#getClientId() I don't know if this is what you've asked. regards, r. On 11/9/06, Robert Binna [EMAIL PROTECTED] wrote: Hi You are right. There seems to be situation when you get the right id, but I just came across one where this is not the case. After that I take a short look at the tapestry code and I wonder why my sugested solution ever worked. My Question is, can anyone give me a hint how to implement dojo wrapper widgets in a correct way, that depend on other components. Eg.: I just wanted to create a Tooltip component with the dojo tooltip that can be used an any other tapestry component, but therefore I would need to have the client id of the component, I want to show the tooltip for. I think this is realy a demand, because other users I am in contact with, start making hacks around pseudo css classes to get the ids back in return. kind regards, Robert Roberto Ramírez Vique schrieb: I'm using this method (also using tap 4.0.2), but seems to be not working. For me it gets the next supposed id, I mean, if I have a component named legalId the id in the page is legalId but when I executed the method I get : legalId_0 ... probably I make any mistake... thanks, robert On 11/5/06, Karthik N [EMAIL PROTECTED] wrote: yes i did use idPath for the hidden field. but i'm using tapestry 4.0.2 - could that be the reason i'm seeing different results than you are? On 11/5/06, Patrick Moore [EMAIL PROTECTED] wrote: did you assign the hidden field's id using idPath? Also I am using the 4.1.1 SVN build. I am having some success with this method (borrowed from another's email) in finding the unique ids but I haven't throughly tested it yet: public String getUniqueId(AbstractComponent component) { return getRequestCycle().getUniqueId( TapestryUtils.convertTapestryIdToNMToken(component.getIdPath())); } Hopefully there is a better solution soon! -Pat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jesse Kuhnert Tapestry/Dojo/(and a dash of TestNG), team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com
Re: use unique id's generated by tapestry
Tanks a lot. That really helps. regards, Robert Jesse Kuhnert schrieb: Not anymore they don't. On 11/9/06, Robert Binna [EMAIL PROTECTED] wrote: Hi. Thanks, but I know about this method getClientId(), but each component looses its client id information after rendering is finished and so the parent component will never know. regards Robert Roberto Ramírez Vique schrieb: Hello, I'm not sure because I've never used it ... but I think tapestry 4.1(I'm using 4.0 because 4.1 is not stable) let you know which is the clientId for a component: http://tapestry.apache.org/tapestry4.1/tapestry-framework/apidocs/org/apache/tapestry/IComponent.html#getClientId() I don't know if this is what you've asked. regards, r. On 11/9/06, Robert Binna [EMAIL PROTECTED] wrote: Hi You are right. There seems to be situation when you get the right id, but I just came across one where this is not the case. After that I take a short look at the tapestry code and I wonder why my sugested solution ever worked. My Question is, can anyone give me a hint how to implement dojo wrapper widgets in a correct way, that depend on other components. Eg.: I just wanted to create a Tooltip component with the dojo tooltip that can be used an any other tapestry component, but therefore I would need to have the client id of the component, I want to show the tooltip for. I think this is realy a demand, because other users I am in contact with, start making hacks around pseudo css classes to get the ids back in return. kind regards, Robert Roberto Ramírez Vique schrieb: I'm using this method (also using tap 4.0.2), but seems to be not working. For me it gets the next supposed id, I mean, if I have a component named legalId the id in the page is legalId but when I executed the method I get : legalId_0 ... probably I make any mistake... thanks, robert On 11/5/06, Karthik N [EMAIL PROTECTED] wrote: yes i did use idPath for the hidden field. but i'm using tapestry 4.0.2 - could that be the reason i'm seeing different results than you are? On 11/5/06, Patrick Moore [EMAIL PROTECTED] wrote: did you assign the hidden field's id using idPath? Also I am using the 4.1.1 SVN build. I am having some success with this method (borrowed from another's email) in finding the unique ids but I haven't throughly tested it yet: public String getUniqueId(AbstractComponent component) { return getRequestCycle().getUniqueId( TapestryUtils.convertTapestryIdToNMToken(component.getIdPath())); } Hopefully there is a better solution soon! -Pat - 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: Tap 4 Validator questions
Ahh, neat. Glad you figured it out and thanks for posting the code. Dennis Julian Sinai wrote: Dennis, thanks for your reply. Your hint and some experimentation made me realize that the right place to initialize the bean parameters is in the annotation. validators=validators: actually does work: @Bean(initializer = max=2000,message=%my-resource-bundle-error-message-key) public abstract Max getMyMaxValidator(); @Component(type=TextField, bindings = { displayName=message:my-label, value=myfieldval, validators=validators:$myMaxValidator, translator=translator:number}) public abstract IFormComponent getMyField(); Thanks, Julian - Original Message From: Dennis Sinelnikov [EMAIL PROTECTED] To: users@tapestry.apache.org Sent: Friday, November 10, 2006 3:18:32 PM Subject: Re: Tap 4 Validator questions I think your problem is in using validators: prefix in validators=validators: That tells tapestry, that your listing validators. However, $myMaxValidator is actually a bean (your custom validator). Thus, you need to use bean: prefix. validators=bean:.. If you want to use more than 1 validator on 1 component, you could do something along these lines. This is what I did in my .page, should give you an idea on what to do. bean name=required class=org.apache.tapestry.form.validator.Required/ bean name=pattern class=org.apache.tapestry.form.validator.Pattern set name=pattern value=literal:[a-zA-Z]+/ /bean component id=componentX type=TextField ... binding name=validators value={ beans.required, beans.pattern }/ /component The answer to your second question, I'm not 100% sure why it was done. It appears that org.apache.tapestry.valid.* was written pre tapestry 4.0 and org.apache.tapestry.form.validator.* was written by Howard starting tapestry 4.0+. I believe this was done for Hivemind reasons and tighter integration with components (i.e. TextField). These packages use different delegates, and that is why you're running into issues. Perhaps one of the tapestry developers can shed more light on why this was done. hth, Dennis Julian Sinai wrote: Hi I'm a bit confused about validators in Tapestry 4.0.2. The doc says the following ought to work: import org.apache.tapestry.annotations.*; import org.apache.tapestry.form.validator.Max; import org.apache.tapestry.form.validator.Validator; @ComponentClass(allowInformalParameters = false, allowBody = true) public abstract class EditEventForm extends BaseComponent { @Bean(Max.class) public abstract Validator getMyMaxValidator(); public abstract int getMyfieldval(); @Component(type=TextField, bindings = { displayName=message:my-label, value=myfieldval, validators=validators:$myMaxValidator,max=2000[%my-resource-bundle-error-message-key], translator=translator:number}) public abstract IFormComponent getMyField(); ... } The fields display fine and work fine, however, validation doesn't work right because the max value and message don't get filled in. Why? Also, what's the difference between: org.apache.tapestry.valid.*Validator org.apache.tapestry.form.validator.* It seems only org.apache.tapestry.form.validator.* will work. For example, if I try to use IntValidator, I get an exception that it can't be instantiated. Any help is appreciated. Thanks, Julian - 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]
[announce] BeanForm 0.6
Hi all, The latest release of BeanForm, the single-line POJO editor component, is now available for download. Below is a list of changes since the last version. I made a special trip to Spain to get the Spanish translation strings (my wife thought it was a vacation), so I hope someone finds them useful ;-) Special thanks to Grzegorz Mrówka and Andreas Andreou for translations and suggestions! Happy hacking, Daniel Gredler Changes: - When moving values from submitted form to properties, only instantiate null elements of recursive properties when values submitted are not null. - Base input field ids on property names. - Add pseudo properties as a way of mixing custom fields with bean fields. - Make it easier for multi-field binding overrides using OGNL to refer to the current property. - Remove non-threadsafe use of SimpleDateFormat in the Hibernate Validator integration code. - Add support for @Pattern Hibernate Validator annotation. - Use PropertySelection component for enum bean properties. - Add Polish translation. Thanks to Grzegorz Mrówka. - Add Greek translation. Thanks to Andreas Andreou. - Add French translation. - Add Spanish translation. Homepage: http://beanform.sourceforge.net/ Component Reference: http://beanform.sourceforge.net/component-reference.html Change History: http://beanform.sourceforge.net/changes-report.html
Reference non-tapestry files from within tapestry
guys, we have diff depts working on diff files. the other dept has generated a bunch of plain vanilla html content files which i need to incorporate within my tap web app. now i have created a separate folder and have put all files within it. now within my web app, i am trying to incorporate, on a button click, it should open up a window with the files. now i am trying to reference these files but am having no luck. so essentially within my tap html file i have, window.open('c:/apache/tomcat/webapps/a/help/index.html'). but however this is not working. so i guess my question is how can i reference some external files from within tapestry w/o letting tapestry let them render them, just accept them as is. so does anyone know how to do this. pls help. thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reference non-tapestry files from within tapestry
Hi Peter. I usually have css, html and images directories inside context at the same level as WEB-INF. Depending on how your web.xml is set up, Tomcat will then usually serve these files as e.g. http://localhost/tapestryappname/html/index.html That's assuming your Tapestry app is located at: http://localhost/tapestryappname/app You can then put a link in your templates etc with: a href=html/index.html ... /a Cheers, Nick. Peter Dawn wrote: guys, we have diff depts working on diff files. the other dept has generated a bunch of plain vanilla html content files which i need to incorporate within my tap web app. now i have created a separate folder and have put all files within it. now within my web app, i am trying to incorporate, on a button click, it should open up a window with the files. now i am trying to reference these files but am having no luck. so essentially within my tap html file i have, window.open('c:/apache/tomcat/webapps/a/help/index.html'). but however this is not working. so i guess my question is how can i reference some external files from within tapestry w/o letting tapestry let them render them, just accept them as is. so does anyone know how to do this. pls help. thanks. - 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: Reference non-tapestry files from within tapestry
i got it. instead of referencing it from the file system, reference it using the web app. so instead of c:\apache\tomcat\webapp\etc etc go http:\\localhost:8080\webapp\etc etc. thanks again nick. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ForBean issues
Can some tapestry savvy guys look at this and help us out here. Would really appreciate the effort. This is quite a big blocker for me at present. Thanks, Srini. On 11/10/06, Srinivas Yermal [EMAIL PROTECTED] wrote: BTW We currently use version 4.0.2. and run it on tomcat. I would also appreciate if somebody can point me to the rewind document if any. I have heard so many stories about common newbie rewind mistakes but couldnt find what they really are. Thanks again. Srini. On 11/10/06, Srinivas Yermal [EMAIL PROTECTED] wrote: Hi, I am a newbie trying to learn Tapestry. I did try to search through the archives for a solution, but couldnt find anything relavant. It would be great if someone could point me in the right direction. I have a page with a listing of a collection. I am using For component (ForBean) in the form. There are text fields against each item which has a value from the items in the collection. Now one can change the text value and hit the save button at the end of the form. The listener that is associated with the form gets called but I dont have a clue as to how I can obtain the changed values from the collection. I tried with both form listener and submit action listener. I always end up with a null or empty item collection. Some code snippet below - public abstract Collection getItems(); public abstract void setItems(Collection items); ActionListener Method 1: public void saveHistory(IRequestCycle cycle, Object[] list) { LOG.debug(saveHistory(cycle, array) invoked); if (null == list) return; for (Object o : list) { Question mh = (Question)o; LOG.debug(mh.getQuestionText() + + mh.getAnswerText()); } } ActionListener Method 2: public void saveHistory(IRequestCycle cycle) { LOG.debug(saveHistory(cycle, array) invoked); List list = cycle.getListenerParameters(); if (null == list) return; for (Object o : list) { Question mh = (Question)o; LOG.debug(mh.getQuestionText() + + mh.getAnswerText()); } } FormListner Method: public void saveFormHistory(IRequestCycle cycle) { LOG.debug(saveFormHistory(cyle) invoked); CollectionQuestion list = getItems(); if (null == list) return; for (Question mh: list) { LOG.debug(mh.getQuestionText () + + mh.getAnswerText()); } } The HTML file - form jwcid=[EMAIL PROTECTED] listener=listener:saveFormHistory ... tr jwcid=@For source=ognl:items value=ognl:item element=tr tdspan jwcid=@Insert value=ognl:item.question.textQuestion Text/span/td tdinput jwcid=@TextField value=ognl:item.answerText //td /tr ... input class=button type=submit value=Save name=save jwcid=@Submit action=listener:saveHistory parameters=ognl:items/ Please do let me know if something here is not right or if you have any further questions. Looking forward for some advice. Thanks in advance. Regards, Srini. -- http://www.indygosoft.com
Re: Stale Link Issue
Hi David, A Stale Link Exception usually occurs when data changes between the rendering phase and form submission. In other words if any components in the page are modified dynamically for instance you might encounter this when you submit because the rewind has no recollection of those components. (References to the components are stored in a hidden field, so when the page submits these are checked, if there are more or less fields then the stale link exception is thrown). You should take a look at the hints section of the documentation of the For component: http://tapestry.apache.org/tapestry4.1/components/general/for.html Back to your question, it is possible to have multiple textfields, but because you are generating them on the fly the stale link exception occurs... a quick fix could be to set the parameter volitile=true, which prevents the component reference in a hidden field, but you need to be carefull using this because form structure will be different for render and rewind. Lastly, also be aware of the data types you use, if you are binding objects directly to the component then use a converter (IPrimaryKeyConverter http://tapestry.apache.org/tapestry4.1/tapestry-framework/apidocs/org/apache/tapestry/components/IPrimaryKeyConverter.html). good luck, Peter david joffrin wrote: Hi, I have defined something like: tr jwcid=@Foreach source=ognl:accountFieldDefinitionsList value=ognl:accountFieldDefinition index=ognl:index element=tr tr td bgcolor=#EAEAF7 colspan=2img border=0 src=images/spacer.gif width=1 height=3//td td bgcolor=#EAEAF7img border=0 src=images/spacer.gif width=1 height=3//td /tr td bgcolor=#EAEAF7font color=#FF/font /td td bgcolor=#EAEAF7 ba jwcid=@Insert value=ognl:accountFieldDefinition.fieldName/:/b /td td bgcolor=#FF input jwcid=@TextField value=ognl:fieldValue size=20 maxlength=8/ /td /tr trtd bgcolor=#FF colspan=3img border=0 src=images/spacer.gif width=1 height=3//td/tr tr td colspan=2input jwcid=@Submit value=Cancel type=button listener=ognl:listeners.onCancel class=buttons//td td align=rightinput jwcid=@Submit value=Confirm type=button listener=ognl:listeners.onConfirm class=buttons//td /tr I am trying to implement a list of TextField. When I press the Submit button, I have the Stale Link error page coming! Any idea why it is not possible to have multiple TextField in a page? Thanks. DvJ _ Windows Live^(TM) Messenger has arrived. Click here to download it for free! http://imagine-msn.com/messenger/launch80/?locale=en-gb - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Peter Stavrinides Albourne Partners (Cyprus) Ltd Tel: +357 22 750652 If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Please visit http://www.albourne.com/email.html for important additional terms relating to this e-mail.
PageLink with parameters?
Hello, I have a page that I want to call using a PageLink, but I need to pass in a parameter. How can I do that? What I want to do is have a page (lets call it DbTableDataPage) that displays the content of a certain database table. The page will be generic and work for any table in the database, so I need to pass in the table name when I call the page, so that I know which table to read out. What is the easiest way to do this? I know I could probably use DirectLink, but that would require all pages that call my DbTableDataPage to have a listener in order to be able to pass the table name through as a parameter - since pretty much any page in my application would potentially call the DbTableDataPage, I would probably need to add the listener to my BasePage. The reason I do not like that too much is that it seems like every time I had some very basic listener or behaviour like this, I would have to add it to my BasePage, so I am afraid that at the end my BasePage object will be a huge monster with a collection of all kinds of different stuff. What else could I do? Should I create a DbTableDataPageInvoker component and try to separate out the logic like that? Thanks, MARK P.S.: I am using T4.0 - after 1 or 2 months of learning the basics, I took a break from Tapestry for over half a year, so now I am trying to dig out what little knowledge I had gathered earlier this year... By the way - is T4.1 production status yet? I tried to find something regarding its status on the website but could not find any conclusive indication... - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]