Dynamic forms
Hi, I want to make fully dynamic forms with Struts. The form fields will be generated out of datasources. Is this possible with Struts and what technics do you recommend ? Thanks for your help Greetings Silvija
Re: StrutsTestCases
hi Ed,ya this is the same problem i m trying to solve. i hav removed that addtional slash before D: but still its not working, also i i forgot to mention in my first mail that i m getting follwing warnings on my consol window: log4j:WARN No appenders could be found for logger ( servletunit.struts.MockStrutsTestCase). log4j:WARN Please initialize the log4j system properly. On 4/27/06, Ed Griebel [EMAIL PROTECTED] wrote: There was a question about this a couple of days ago where web.xml was not being found. Also, it looks like you have a leading slash before the D: in setConfigFile(), that could be the problem. HTH -ed On 4/27/06, Chaitanya Parkhi [EMAIL PROTECTED] wrote: hi friends i m working on Struts Test Cases ,i have written the following code,for testing accurate user login from login page for my application i hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i run the following code i m getting following failures: 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found. 2.junit.framework.AssertionFailedError: No tests found in servletunit.struts.MockStrutsTestCase can anybody plz tell me whats a problem? is ther anything reqd to write in web.xml for StrutstestCases? import servletunit.struts.MockStrutsTestCase; public class TestLoginAction extends MockStrutsTestCase { public void setUp() throws Exception { super.setUp(); } public void tearDown() throws Exception { super.tearDown(); } public TestLoginAction(String testName) { super(testName); } public void testSuccessfulLogin() { setConfigFile(/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- config.xml); setRequestPathInfo(/login); addRequestParameter(username,cdpadmin); addRequestParameter(password,cdp); actionPerform(); String[] actionErrors = {username.required,password.required }; verifyActionErrors(actionErrors); } public void testFailedLogin() { addRequestParameter(username,cdpadmin); addRequestParameter(password,indiana); setRequestPathInfo(/login); actionPerform(); verifyTilesForward(success,success.tiles.def); verifyActionErrors(new String[] {error.password.mismatch, error.username.required,error.password.required}); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
jsp / html in struts by eclipse
hi friends , i m using eclipse for my struts application,i m trying to create a JSP / HTML file in my project , but whenever i select respective option a progress box is coming as it should,but it stucks ther doesnt show any progress atall, to come ot of it i hav 2 close whole project again start eclipse , finally i m nt able to create a jsp html file thro my eclipse , anybody knowas why?
Re: jsp / html in struts by eclipse
Contact Eclipse support center :-D Try reinstalling eclipse... On 4/28/06, Chaitanya Parkhi [EMAIL PROTECTED] wrote: hi friends , i m using eclipse for my struts application,i m trying to create a JSP / HTML file in my project , but whenever i select respective option a progress box is coming as it should,but it stucks ther doesnt show any progress atall, to come ot of it i hav 2 close whole project again start eclipse , finally i m nt able to create a jsp html file thro my eclipse , anybody knowas why? -- Vinit Sharma IBM
RE: validatewhen --- what's wrong?
Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Where dose JSP works in JSF request lifecycle?
So, how do you make sure that the right dynamic data gets loaded so that the page displays the right stuff? That's where Shale comes in handy. If your backing bean implements the ViewController interface, then prerender() will get called just before the JSP page is invoked. This is the perfect place to grab any data you need from your database to display the requested page. You can do this without Shale, but there's somewhat more pain involved. So how would you do it in plain JSF without the ViewController? In the contructor? Bernhard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: *****POSSIBLE SPAM***** Re: html:checkbox entries are not disappering
Hi, this is correct, but how do I know which objects set to null and which not? I have an ArrayList with Objects (Users), one parameter of the user is assigned (of bool). With the list I can assign some of the users and can store this (submit the form). The index of the parameter is counted from 0 ... so, 0, 1, 2, ... so I don´t know from the request-parameters which objects are choosen and which not (the id of the user is huge number). So, how to map the request parameters to my user-objects so that I can set the assigned to false. Thanks in advance HP -Ursprüngliche Nachricht- Von: Rick Reumann [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 21. April 2006 14:42 An: Struts Users Mailing List Betreff: *POSSIBLE SPAM* Re: html:checkbox entries are not disappering Hans-Peter Petek wrote: But, when I deselect a checkbox, press the button (i.e. submit), all the previous checked checkboxes are still checked .. =?!?!? Every checkbox I ever checked once still remains checked ... Can anyone help me ... Common problem. Make sure you are setting all your boolean values represented by the checkboxes to false in your form's reset method. (Your form bean probably has session scope and remember in html only checkboxes that are checked get passed with the request, so behind the scenes your formBean still has some of its properties set to true.) -- Rick http://www.learntechnology.net - 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: StrutsTestCases
hi Chaitanya when i use strutstestcase, i usually specify config file in setUp() as public void setUp() throws Exception { super.setUp(); setConfigFile(/WEB-INF/config/struts-config.xml); } according to javadoc, the path can be either an absolute path like you set or a relative path from WEB-INF. you can try 1. call setConfigFile() in setUp() 2. specify a relative path i hope this will help. regards. ichy 2006/4/28, Chaitanya Parkhi [EMAIL PROTECTED]: hi Ed,ya this is the same problem i m trying to solve. i hav removed that addtional slash before D: but still its not working, also i i forgot to mention in my first mail that i m getting follwing warnings on my consol window: log4j:WARN No appenders could be found for logger ( servletunit.struts.MockStrutsTestCase). log4j:WARN Please initialize the log4j system properly. On 4/27/06, Ed Griebel [EMAIL PROTECTED] wrote: There was a question about this a couple of days ago where web.xml was not being found. Also, it looks like you have a leading slash before the D: in setConfigFile(), that could be the problem. HTH -ed On 4/27/06, Chaitanya Parkhi [EMAIL PROTECTED] wrote: hi friends i m working on Struts Test Cases ,i have written the following code,for testing accurate user login from login page for my application i hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i run the following code i m getting following failures: 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found. 2.junit.framework.AssertionFailedError: No tests found in servletunit.struts.MockStrutsTestCase can anybody plz tell me whats a problem? is ther anything reqd to write in web.xml for StrutstestCases? import servletunit.struts.MockStrutsTestCase; public class TestLoginAction extends MockStrutsTestCase { public void setUp() throws Exception { super.setUp(); } public void tearDown() throws Exception { super.tearDown(); } public TestLoginAction(String testName) { super(testName); } public void testSuccessfulLogin() { setConfigFile(/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- config.xml); setRequestPathInfo(/login); addRequestParameter(username,cdpadmin); addRequestParameter(password,cdp); actionPerform(); String[] actionErrors = {username.required,password.required }; verifyActionErrors(actionErrors); } public void testFailedLogin() { addRequestParameter(username,cdpadmin); addRequestParameter(password,indiana); setRequestPathInfo(/login); actionPerform(); verifyTilesForward(success,success.tiles.def); verifyActionErrors(new String[] {error.password.mismatch, error.username.required,error.password.required}); } } - 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: StrutsTestCases
hi ichy,i tried your suggestion but still prob is still ther. On 4/28/06, ichy [EMAIL PROTECTED] wrote: hi Chaitanya when i use strutstestcase, i usually specify config file in setUp() as public void setUp() throws Exception { super.setUp(); setConfigFile(/WEB-INF/config/struts-config.xml); } according to javadoc, the path can be either an absolute path like you set or a relative path from WEB-INF. you can try 1. call setConfigFile() in setUp() 2. specify a relative path i hope this will help. regards. ichy 2006/4/28, Chaitanya Parkhi [EMAIL PROTECTED]: hi Ed,ya this is the same problem i m trying to solve. i hav removed that addtional slash before D: but still its not working, also i i forgot to mention in my first mail that i m getting follwing warnings on my consol window: log4j:WARN No appenders could be found for logger ( servletunit.struts.MockStrutsTestCase). log4j:WARN Please initialize the log4j system properly. On 4/27/06, Ed Griebel [EMAIL PROTECTED] wrote: There was a question about this a couple of days ago where web.xml was not being found. Also, it looks like you have a leading slash before the D: in setConfigFile(), that could be the problem. HTH -ed On 4/27/06, Chaitanya Parkhi [EMAIL PROTECTED] wrote: hi friends i m working on Struts Test Cases ,i have written the following code,for testing accurate user login from login page for my application i hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i run the following code i m getting following failures: 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found. 2.junit.framework.AssertionFailedError: No tests found in servletunit.struts.MockStrutsTestCase can anybody plz tell me whats a problem? is ther anything reqd to write in web.xml for StrutstestCases? import servletunit.struts.MockStrutsTestCase; public class TestLoginAction extends MockStrutsTestCase { public void setUp() throws Exception { super.setUp(); } public void tearDown() throws Exception { super.tearDown(); } public TestLoginAction(String testName) { super(testName); } public void testSuccessfulLogin() { setConfigFile(/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- config.xml); setRequestPathInfo(/login); addRequestParameter(username,cdpadmin); addRequestParameter(password,cdp); actionPerform(); String[] actionErrors = {username.required, password.required }; verifyActionErrors(actionErrors); } public void testFailedLogin() { addRequestParameter(username,cdpadmin); addRequestParameter(password,indiana); setRequestPathInfo(/login); actionPerform(); verifyTilesForward(success,success.tiles.def); verifyActionErrors(new String[] {error.password.mismatch, error.username.required,error.password.required}); } } - 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]
[shale][clay] defining onClick() etc for components
Hi all, I'm using clay full html and i need to call a javascript function from a component. The component is defined in clay-config as component jsfid=widgetsSelectOne extends=selectOneMenu id=@property allowBody=false attributes set name=value value=[EMAIL PROTECTED]@property} / /attributes element renderId=0 jsfid=selectItems attributes set name=value value=[EMAIL PROTECTED]@choices} / /attributes /element /component component jsfid=alertingSelectOne extends=widgetsSelectOne attributes set name=onSelect value=alert('onSelect fired!')/ set name=onChange value=alert('onChange fired!')/ /attributes /component And my html is coded as ... span jsfid=widgetsGroup property=day choices=days required=true tr td label class=label jsfid=widgetsLabel Days /label /td TD select jsfid=alertingSelectOne option value=1 Day 1 /option option value=2 Day 2 /option /select /TD td span class=required jsfid=widgetsRequiredrequired/span /td td /td /TR /span But unfortunately when it's run through clay the rendered html doesn't contian any onClick or onSelect code. It renders like this... tr td label class=label for=clayView:_id0:_id24:dayDays:/label /td TD select id=clayView:_id0:_id24:day name=clayView:_id0:_id24:day size=1 option value=1Mon/option option value=2Tue/option ... /select /TD td span class=required*/span /td td /td /tr Can anyone see what I'm doing wrong, or suggest how I get my event handlers to render? Cheers, Ian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [shale][clay] defining onClick() etc for components - fixed
Just noticed the case is wrong on the attributes. Wrong: set name=onSelect value=alert('onSelect fired!')/ Right: set name=onselect value=alert('onSelect fired!')/ Now renders as ... select id=clayView:_id0:_id24:day name=clayView:_id0:_id24:day size=1 onselect=alert('onSelect fired!') ... Cheers, Ian -Original Message- From: Ian.Priest [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 15:13 To: Struts Users Mailing List Subject: [shale][clay] defining onClick() etc for components Hi all, I'm using clay full html and i need to call a javascript function from a component. The component is defined in clay-config as component jsfid=widgetsSelectOne extends=selectOneMenu id=@property allowBody=false attributes set name=value value=[EMAIL PROTECTED]@property} / /attributes element renderId=0 jsfid=selectItems attributes set name=value value=[EMAIL PROTECTED]@choices} / /attributes /element /component component jsfid=alertingSelectOne extends=widgetsSelectOne attributes set name=onSelect value=alert('onSelect fired!')/ set name=onChange value=alert('onChange fired!')/ /attributes /component And my html is coded as ... span jsfid=widgetsGroup property=day choices=days required=true tr td label class=label jsfid=widgetsLabel Days /label /td TD select jsfid=alertingSelectOne option value=1 Day 1 /option option value=2 Day 2 /option /select /TD td span class=required jsfid=widgetsRequiredrequired/span /td td /td /TR /span But unfortunately when it's run through clay the rendered html doesn't contian any onClick or onSelect code. It renders like this... tr td label class=label for=clayView:_id0:_id24:dayDays:/label /td TD select id=clayView:_id0:_id24:day name=clayView:_id0:_id24:day size=1 option value=1Mon/option option value=2Tue/option ... /select /TD td span class=required*/span /td td /td /tr Can anyone see what I'm doing wrong, or suggest how I get my event handlers to render? Cheers, Ian - 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: Accessing Validation Errors in an Action
Try this: In your Action class, use this method call: getErrors(javax.servlet.http.HttpServletRequest request) The javadoc for this method is at: http://struts.apache.org/struts-doc-1.2.7/api/org/apache/struts/action/A ction.html Harsh. -Original Message- From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Thursday, April 27, 2006 7:10 PM To: Struts Users Mailing List Subject: Re: Accessing Validation Errors in an Action if the validation is done at the server side (in your actionform), then you can easily get the errors. On 4/28/06, Asad Habib [EMAIL PROTECTED] wrote: How do I access errors that the Validator places in the ActionErrors object instance within a Struts action? I need to do this in my action code so I can throw the appropriate kind of exception. Thanks. - Asad - 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: validatewhen --- what's wrong?
Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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: validatewhen --- what's wrong?
The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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: validatewhen --- what's wrong?
The scenario is validation always passes to success page as long as user fills in two fields, no matter what you are put in. So where could be the issue??? Jason -Original Message- From: Zheng Wen Zhe Sent: 28 April 2006 16:02 To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validatewhen --- what's wrong?
Do you see some stack when validation runs for the password field? Also, do you see this entry in your validator-rules.xml file: validator name=validwhen ? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 10:18 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The scenario is validation always passes to success page as long as user fills in two fields, no matter what you are put in. So where could be the issue??? Jason -Original Message- From: Zheng Wen Zhe Sent: 28 April 2006 16:02 To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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] - 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: validatewhen --- what's wrong?
This is the validwhen entry in validator-rules.xml * validator name=validwhen classname=org.apache.struts.validator.validwhen.ValidWhen method=validateValidWhen methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required/ *** -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 17:09 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Do you see some stack when validation runs for the password field? Also, do you see this entry in your validator-rules.xml file: validator name=validwhen ? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 10:18 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The scenario is validation always passes to success page as long as user fills in two fields, no matter what you are put in. So where could be the issue??? Jason -Original Message- From: Zheng Wen Zhe Sent: 28 April 2006 16:02 To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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] - 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: validatewhen --- what's wrong?
That looks good. Do you see any exception stack related to validation when you submit the form? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 11:07 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? This is the validwhen entry in validator-rules.xml * validator name=validwhen classname=org.apache.struts.validator.validwhen.ValidWhen method=validateValidWhen methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required/ *** -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 17:09 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Do you see some stack when validation runs for the password field? Also, do you see this entry in your validator-rules.xml file: validator name=validwhen ? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 10:18 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The scenario is validation always passes to success page as long as user fills in two fields, no matter what you are put in. So where could be the issue??? Jason -Original Message- From: Zheng Wen Zhe Sent: 28 April 2006 16:02 To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validatewhen --- what's wrong?
I am not sure how to set Apache tomcat server to debug mode. However, there are no exception been thrown out in console during validation execution. Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 17:19 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? That looks good. Do you see any exception stack related to validation when you submit the form? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 11:07 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? This is the validwhen entry in validator-rules.xml * validator name=validwhen classname=org.apache.struts.validator.validwhen.ValidWhen method=validateValidWhen methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest msg=errors.required/ *** -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 17:09 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Do you see some stack when validation runs for the password field? Also, do you see this entry in your validator-rules.xml file: validator name=validwhen ? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 10:18 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The scenario is validation always passes to success page as long as user fills in two fields, no matter what you are put in. So where could be the issue??? Jason -Original Message- From: Zheng Wen Zhe Sent: 28 April 2006 16:02 To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? The validation is definitely called. If I submit the form with login field empty, alert is popping up. So I am sure is somewhere wrong with the validwhen.. But, where?? Jason -Original Message- From: Chaudhary, Harsh [mailto:[EMAIL PROTECTED] Sent: 28 April 2006 16:04 To: Struts Users Mailing List Subject: RE: validatewhen --- what's wrong? Are you sure that validation is being called? For example, what happens when you submit the form with nothin in the login field (which is required)? Harsh. -Original Message- From: Zheng Wen Zhe [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:24 AM To: 'Struts Users Mailing List' Subject: RE: validatewhen --- what's wrong? Well, basically, I wanna the condition to be true only when user gives key word 'password' to the password field. And I tried this var-value(*this* == 'password')/var-value The validwhen still always is true no matter what is given.. -Original Message- From: Jakub Milkiewicz [mailto:[EMAIL PROTECTED] Sent: 27 April 2006 18:34 To: Struts Users Mailing List Subject: Re: validatewhen --- what's wrong? Hi To tell you the truth i do not understand what you wanna do... Anyway your validwhen condition is always true! Note that you are comparing *this* - for property password, with property password. It means something like 1==1. 2006/4/26, Zheng Wen Zhe [EMAIL PROTECTED]: Hey all, I wanna it say yes when a user type 'password' into this password field. But, it doesn't work that way. Validation always passes no matter what the user has given into the password field. Pls, someone tell what wrong with it!!! Validation.xml ?xml version=1.0 encoding=UTF-8? !DOCTYPE form-validation PUBLIC -//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd; form-validation formset form name=loginForm field property=login depends=required arg0 key=prompt.login / /field field property=password depends=required,validwhen arg0 key=prompt.password / var var-nametest/var-name var-value*this* == password/var-value /var /field /form /formset /form-validation - 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]
Struts-Faces Integration Library Problem
Hello Friens, i have compatibility problems with struts-faces and myfaces greater 1.0.9 or sun jsf 1.1_01. The Problem: when i submit a s:form ... to a struts-action then the action-form is not populated with the values from the form. This problem is only when i use myfaces version greater then 1.0.9 or sun jsf 1.1_01 with struts-faces. Whith myfaces 1.0.9 or sun jsf 1.1 it works like a charm. Any hints, or is it bug? Juergen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [shale][clay] defining onClick() etc for components
On 4/28/06, Ian.Priest [EMAIL PROTECTED] wrote: component jsfid=alertingSelectOne extends=widgetsSelectOne attributes set name=onSelect value=alert('onSelect fired!')/ set name=onChange value=alert('onChange fired!')/ /attributes /component Try onchange and onselect instead of onChange and onSelect. I think case matters as dictated by the implementation of UISelectOne.
Re: Where dose JSP works in JSF request lifecycle?
On 4/27/06, 王曾wang_zeng [EMAIL PROTECTED] wrote: Thank you,Craig. What do you mean by setup action? Is that the kind of action which grabs some data, do some encapsilation work, and stuff them into JSP scopes. Yes, that's what I meant. You say we can archive the goal with shale as well as without shale. I remeber that between phases a Phase Event will be fired. When JSF skips directly to the Render Response phase, can I use phase event listener to grab data ? Yes. The way to do this would be to define a phase listener for Render Response phase, and do your data collection in the beforePhase event handler. You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. Is this approach what you think is painful? I don't know if I would call it painful, but it is certainly a lot of complexity to worry about. It is much simpler to have a framework do the hard stuff for you. Indeed, a phase listener is how Shale itself calls the relevant application event calbacks -- but it shares a single listener instance across all requests, and only makes the callback calls on the relevant backing bean -- you don't have to worry about anything except what data do I need to set up for *this* request. -- Wang Zeng Craig
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Bernhard Slominski [EMAIL PROTECTED] wrote: So, how do you make sure that the right dynamic data gets loaded so that the page displays the right stuff? That's where Shale comes in handy. If your backing bean implements the ViewController interface, then prerender() will get called just before the JSP page is invoked. This is the perfect place to grab any data you need from your database to display the requested page. You can do this without Shale, but there's somewhat more pain involved. So how would you do it in plain JSF without the ViewController? In the contructor? The constructor logic is going to get called on a postback as well as when a page is rendered, so you would need to distinguish the two cases. You also would not want to do the data setup if you're actually going to havigate to a different page instead. See my previous answer in this thread about using a phase listener. Bernhard Craig
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Craig McClanahan [EMAIL PROTECTED] wrote: Yes. The way to do this would be to define a phase listener for Render Response phase, and do your data collection in the beforePhase event handler. You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. Craig, What do you mean deregister the listener? Where is the leak from? My understanding was I register the the PhaseListener in faces-config, and the listener is active for the entire life of my application. Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How to use displayTag
Hi, I am looking for Tag implementation for Table which can be configured for external sorting and pagination. Which also support Struts( on sorting or Pagination invokes Struts Action). I have came accross displaytag opensource of sourceforge, but they lack clear documentation. It was also not clear how the StrutsActions will be invoked. Please let me know if any one has used same or similar tag? Regards Makarand - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1cent;/min.
RE: How to use displayTag
I am also looking for a pagination solution. And you are right, the documentation for DisplayTag is not exactly up to the mark. Another thing I found was it has some issues with its design. That is, by default, it gets the entire object returned from a query and populates a list with it. Now, if your list is really big, its a big big performance hit. Fortunately, you can bypass that behaviour and write your own pagination code, which kind of defeats the purpose. Anyways, if I get something to work, will keep posted. Another alternative could be the struts pager taglib. Harsh. -Original Message- From: makarand sonawane [mailto:[EMAIL PROTECTED] Sent: Friday, April 28, 2006 3:13 PM To: user@struts.apache.org Subject: How to use displayTag Hi, I am looking for Tag implementation for Table which can be configured for external sorting and pagination. Which also support Struts( on sorting or Pagination invokes Struts Action). I have came accross displaytag opensource of sourceforge, but they lack clear documentation. It was also not clear how the StrutsActions will be invoked. Please let me know if any one has used same or similar tag? Regards Makarand - Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1cent;/min. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Hubert Rabago [EMAIL PROTECTED] wrote: On 4/28/06, Craig McClanahan [EMAIL PROTECTED] wrote: Yes. The way to do this would be to define a phase listener for Render Response phase, and do your data collection in the beforePhase event handler. You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. Craig, What do you mean deregister the listener? Where is the leak from? My understanding was I register the the PhaseListener in faces-config, and the listener is active for the entire life of my application. Sorry for not being clearer. You can indeed register a listener with a phase-listener declaration -- you get an application wide singleton that has the same lifetime as your application. However, it's also possible to add a phase listener programmatically, by getinng access to the Lifecycle instance (from the LifecycleFactory), and calling addPhaseListener() on it -- the standard JavaBeans event listener registration pattern. You might, for example, want to create a request scope backing bean that registers itself for phase listener events just for the duration of this request (you still have to disambiguate whether the event is for your request or not -- easiest way to do that is to compare the FacesContext instance included in the event to the one that was active when your backing bean was created). If you do this, but don't remember to deregister at the end of the request -- and you need to be robust in case exceptions were thrown -- then the list of phase listeners will get longer and longer. And, because there are live references to them in the Lifecycle instance, they would never be garbage collected either. In the very first version of Creator, we were experimenting with request scoped phase listeners like this, and found it easier to use the single instance approach instead. Shale's design benefits from that experience as well. Hubert Craig
ActionForward and input form
I have an method in a class that extends DispatchAction that throws Exception such as: public ActionForward saveMethod(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { //.. try { myWork = saveMyWork(); //This throws a DateFieldException } catch(DateFieldException e) { ActionMessages errors = new ActionMessages(); ActionMessage error = new ActionMessage( errors.detail,e.getMessage() ); errors.add( ActionMessages.GLOBAL_MESSAGE,error ); saveErrors( request,errors ); //return new ActionForward( mapping.getInput() ); return mapping.findForward( failureDate ); } // } This method is invoked on a form post of a html-form (input form). Here everything is working as expected except that when the exception is thrown it takes me back to the original input form, but the input values are not populated in the html-form anymore. All the text fields are blank... Is this something that has to do something with returning ActionForward I obviously want those html-form fields to stay populated on the event of the exception, so that the user does not have to reenter all the fields except the field with the problem. Any help is highly appreciated. - Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
Re: complex validation problem.
Jakub Milkiewicz wrote: Hi I have a problem with conditional validation. Currently i am working with struts 1.1 - because of its WSAD support but i am thinking of migrating to the newest one. My problem is that on my jsp page i have 2 radio buttons: html:radio name=viewBean property=documentIdentity value=dowod/ html:radio name=viewBean property=documentIdentity value=paszport/ I am using struts validator and in my validation.xml i want to have passportNumber property validated IF AND ONLY IF documentIdentity equals paszport. More, i want to have it validated with other validators too. I need something like: field property=passportNumber depends=requiredif,mask page=1 var var-namefield[0]/var-name var-valuedocumentIdentity/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-valuepaszport/var-value /var var var-namemask/var-name var-value${passportNumberMask}/var-value /var /field So if documentIdentity.equals paszport, passportNumber is required and needs to be validated against mask validator. If doucmentIdentity eqauls dowod, i do not wanna to validate passportNumber at all. Can struts validator satisfy my requirements? Can struts 1.1 validator satisfy it?? I have spent a lot of time on struts mailing list trying to find an answer for my problem but i haven't found anything special. Maybe solution presented in http://marc.theaimsgroup.com/?l=struts-userm=113029818225923w=2 is suggested in Struts. Can anyone help me. Unfortunately the validation framework doesn't support this requirement directly; when you say depends=requiredif,mask, this is taken to mean 'the field is valid if it passed the requiredif test AND it passes the mask test'. There's no way to have a requiredif/validwhen rule control whether another rule is applied. The message you referenced in the archives looks like a good starting point to achieve what you want. Essentially, you will need to write your own validation rule. That message looks like it details a reasonably flexible basis for doing so. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, Craig McClanahan [EMAIL PROTECTED] wrote: Sorry for not being clearer. You can indeed register a listener with a phase-listener declaration -- you get an application wide singleton that has the same lifetime as your application. However, it's also possible to add a phase listener programmatically, by getinng access to the Lifecycle instance (from the LifecycleFactory), and calling addPhaseListener() on it -- the standard JavaBeans event listener registration pattern. You might, for example, want to create a request scope backing bean that registers itself for phase listener events just for the duration of this request (you still have to disambiguate whether the event is for your request or not -- easiest way to do that is to compare the FacesContext instance included in the event to the one that was active when your backing bean was created). If you do this, but don't remember to deregister at the end of the request -- and you need to be robust in case exceptions were thrown -- then the list of phase listeners will get longer and longer. And, because there are live references to them in the Lifecycle instance, they would never be garbage collected either. In the very first version of Creator, we were experimenting with request scoped phase listeners like this, and found it easier to use the single instance approach instead. Shale's design benefits from that experience as well. Craig Ok, thanks for the clarification! Hubert - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with message and Expired session
Juergen Kopper wrote: Hi, Angel Navarro schrieb: Hi, when I say 'the system expired session' is that the user are a lot of time without navigate and explorer expired session, dou you understand me? Yes I understand it and I think this makes the same as the invalidate(), this means it unbinds all Objects of a Session also the Locale-Object. - http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/javax/servlet/http/HttpSession.html An approach for (Struts 1.1) to handle Session problems is: -use the saveToken() in a login action -all other actions need to use the isTokenValid() to check if the session is not expired Thanks Hope this can help you . Juergen That's not going to help in this case, since if the session is done you have no way to check the token anyway. What's needed is a way to determine the correct locale (language/country) after the session containing that information has gone away / expired. The cleanest way to do so is probably to save a cookie with the locale information. You can then use this cookie to restore the locale information after the session has expired. Make sure the cookie has a long enough expiry time (make it a permanent cookie or tie it to the browser session, perhaps). HTH, L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Re: complex validation problem.
You could write a custom validator which would read the value of the documentIdentity. Then, If documentIdentity != pazport, return true else -- Run your mask validation for passport number -- To do the mask validation, from your class, consult this: http://struts.apache.org/struts-action/struts-core/apidocs/index.html Look for a method: validateMask() Harsh. -Original Message- From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper Sent: Friday, April 28, 2006 4:37 PM To: user@struts.apache.org Subject: Re: complex validation problem. Jakub Milkiewicz wrote: Hi I have a problem with conditional validation. Currently i am working with struts 1.1 - because of its WSAD support but i am thinking of migrating to the newest one. My problem is that on my jsp page i have 2 radio buttons: html:radio name=viewBean property=documentIdentity value=dowod/ html:radio name=viewBean property=documentIdentity value=paszport/ I am using struts validator and in my validation.xml i want to have passportNumber property validated IF AND ONLY IF documentIdentity equals paszport. More, i want to have it validated with other validators too. I need something like: field property=passportNumber depends=requiredif,mask page=1 var var-namefield[0]/var-name var-valuedocumentIdentity/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-valuepaszport/var-value /var var var-namemask/var-name var-value${passportNumberMask}/var-value /var /field So if documentIdentity.equals paszport, passportNumber is required and needs to be validated against mask validator. If doucmentIdentity eqauls dowod, i do not wanna to validate passportNumber at all. Can struts validator satisfy my requirements? Can struts 1.1 validator satisfy it?? I have spent a lot of time on struts mailing list trying to find an answer for my problem but i haven't found anything special. Maybe solution presented in http://marc.theaimsgroup.com/?l=struts-userm=113029818225923w=2 is suggested in Struts. Can anyone help me. Unfortunately the validation framework doesn't support this requirement directly; when you say depends=requiredif,mask, this is taken to mean 'the field is valid if it passed the requiredif test AND it passes the mask test'. There's no way to have a requiredif/validwhen rule control whether another rule is applied. The message you referenced in the archives looks like a good starting point to achieve what you want. Essentially, you will need to write your own validation rule. That message looks like it details a reasonably flexible basis for doing so. L. - 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: validWhen condition parsing problem.
Jakub Milkiewicz wrote: Hi I am using struts 1.2.8 and i have a problem with test condition with validwhen validator. Eveything works fine except when i try to compare sth with a string containing values not from iso8859-1 charset .i.e field property=statementType depends=validwhen page=3 msg name=validWhen key=need.to. resource=false/ var var-nametest/var-name var-value( *this* == eWyciąg )/var-value /var /field On my console i see : ValidWhen Error for field ' statementType' - line 1:19: expecting '', found 'ą' Any help, pls. Looks like a character encoding problem. What charset did you save your validation.xml file with, and what encoding declaration did you specify in the XML preamble? By default, XML is parsed as UTF-8 if you don't specify a different encoding. Make sure that you have correctly specified the encoding and/or that you have saved the file with the correct encoding. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where dose JSP works in JSF request lifecycle?
2006/4/29, Craig McClanahan [EMAIL PROTECTED]: You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. The Faces servlet acts like the Action servlet, and every request goes to it to go through the 6-phase lifecycle before they are forwarded to the JSP. Is that the reason why my listener receives beforePhase() calls for *all* simultaneously active requests? -- Wang Zeng
Re: Where dose JSP works in JSF request lifecycle?
On 4/28/06, 王曾wang_zeng [EMAIL PROTECTED] wrote: 2006/4/29, Craig McClanahan [EMAIL PROTECTED]: You also have to remember that your listener is going to receive beforePhase() calls for *all* simultaneously active requests, not just the one page you might be interested in. And, don't forget to deregister yourself as a listener when the request completes, so you don't create a memory leak. The Faces servlet acts like the Action servlet, and every request goes to it to go through the 6-phase lifecycle before they are forwarded to the JSP. Is that the reason why my listener receives beforePhase() calls for *all* simultaneously active requests? Nor really. The actual reason is that the object you are adding your listener to (the Lifecycle implementation for this webapp) is an application-wide singleton. It's execute() and render() methods are the ones that actually trigger the events, and they are called for all requests. I should also note that JSF 1.2 adds a significant simplification for phase listeners ... you can attach per-view listeners by registering them with the UIViewRoot at the base of the component tree for this particular view, and a lot of the complexity described above gets reduced. Craig
Re: Where dose JSP works in JSF request lifecycle?
Thank you Craig for making it clear. -- Wang Zeng