taking control of the struts 2 layout in a jsp
Hi, Struts displays the jsp objects the way it likes, for example, aligning buttons on the right even if I put them inside a div align=left/div tag. Is there a way to take control of how the layout is displayed without using the simple theme (that doesn't have a nice UI by the way)? Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Preventing validation when form is first displayed
Hi, I have an action that is validateable and uses the validate method to ensure that an element isn't added to the database if it already exists in there. Unfortunately, the validation occurs as soon as my form is launched. I tried to follow the approach from the helloworld example to not have this happen, but it doesn't work. I would rather avoid using annotations for maintainability reasons. Would someone give me directions to how to stop validation from occurring when the form is launched. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE Preventing validation when form is first displayed
Hi, I had the same problem, and added in my struts.xml : interceptor-ref name=validation param name=excludeMethodsexecute, input,back,cancel,browse, detail, delete, goAdd, goModif, view/param /interceptor-ref interceptor-ref name=workflow param name=excludeMethods execute,input,back,cancel,browse, detail, delete, goAdd, goModif, view/ param /interceptor-ref So add the name of your first method in the excludeMethods, and the validation will not occures. Session A Mwamufiya [EMAIL PROTECTED] 13/08/2007 08:58 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A user@struts.apache.org cc Objet Preventing validation when form is first displayed Hi, I have an action that is validateable and uses the validate method to ensure that an element isn't added to the database if it already exists in there. Unfortunately, the validation occurs as soon as my form is launched. I tried to follow the approach from the helloworld example to not have this happen, but it doesn't work. I would rather avoid using annotations for maintainability reasons. Would someone give me directions to how to stop validation from occurring when the form is launched. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE taking control of the struts 2 layout in a jsp
Hi, Copy the struts.jar templates into your application (at the root, WebContent/templates for exemple), and modify the WebContent/template/simple/*.ftl files at your convenience. Session A Mwamufiya [EMAIL PROTECTED] 13/08/2007 08:57 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A user@struts.apache.org cc Objet taking control of the struts 2 layout in a jsp Hi, Struts displays the jsp objects the way it likes, for example, aligning buttons on the right even if I put them inside a div align=left/div tag. Is there a way to take control of how the layout is displayed without using the simple theme (that doesn't have a nice UI by the way)? Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
switch action - doubt
Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks
RE [S2] autowiring with hand rolled factory
Did you set this in your struts.xml ? constant name=struts.objectFactory value=spring / or constant name=struts.objectFactory value= org.myorg.mySpringContextFactory / For Autowiring, it's enable by default. But you can customise it : http://struts.apache.org/2.0.9/docs/spring-plugin.html The framework enables autowiring by default. (Autowiring means to look for objects defined in Spring with the same name as your object property). To change the wiring mode, modify the spring.autowire property. Wiring Mode struts.objectFactory.spring.autoWire = type The autowire property can be set to several options. name Auto-wire by matching the name of the bean in Spring with the name of the property in your action. This is the default type Auto-wire by looking for a bean registered with Spring of the same type as the property in your action. This requires you to have only one bean of this type registered with Spring auto Spring will attempt to auto-detect the best method for auto-wiring your action constructor Spring will auto-wire the parameters of the bean's constructor By default, the framework will at least try to use Spring to create all its objects. If the object cannot be created by Spring, then the framework will create the object itself. Adam Hardy [EMAIL PROTECTED] 12/08/2007 11:25 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A Struts Users Mailing List user@struts.apache.org cc Objet [S2] autowiring with hand rolled factory I'm sure I saw some references to this in the documentation before but I can't find it again now that I need it. I have my own context factory for Spring which I want to plug into the struts framework, but I can't work out how to set up the autowiring interceptor . It seems I must replace ActionAutoWiringInterceptor and configure it as 'anotherAutowiring' or similar. Would that be correct? While I'm on the subject, I'm not planning on setting up my actions in Spring, so I assume that struts2 will use its own ObjectFactory to do this. What is the reasoning behind the functionality that allows me to set up my actions in Spring? Is it just the rich configuration possibilities that Spring offers which struts wants to harness? Thanks Adam - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Redirect after File Upload
Hi There, I would like to upload some jpegs with struts 2.0.9 and redirect to another site after the Action returns SUCCESS. I tried is like this ( after reading the file upload example from the struts 2 showcases): uploadPictureForm.jsp: s:form action=uploadPicture.action method=POST enctype=multipart/form-data Datei hochladen (1): s:file name=upload accept=image/*/br Datei hochladen (2): s:file name=upload accept=image/*/br Datei hochladen (3): s:file name=upload accept=image/*/br Datei hochladen (4): s:file name=upload accept=image/*/br Datei hochladen (5): s:file name=upload accept=image/*/br s:a theme=ajax targets=center executeScripts=true showLoadingText=trueupload/s:a /s:form actions.xml (package inside struts.xml): action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewPictures.jsp/result /action UploadPictureAction.java: ... private File[] upload; public String upload() throws Exception { if(upload != null) { ... // do something with my files } System.out.println(reached End of Action); return SUCCESS; } ... Works fine except there's no redirect after return SUCCESS (I also tried different combinations in actions.xml like result name=success type=redirect But I get the same result. Successfull upload and no redirect ). It works only with removing the ajax tags inside the upload form. But I need ajax. Does someone of you now, whether that's a struts bug? I've searched about that already with google etc. with no results about that. Thanks for every reply, Jan - 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]
Use of Struts Validation outside struts framework
Hi, I have validation.xml validator-rules.xml many other validation rules files in my existing struts application. I have other desktop application which has same fields like forms in the struts application. I want to make use of above files (validation.xml, validator-rules.xml, other validation files) for validating same fields using Struts Validation framework How can I use these files for validation. Please help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _
Re: RE Preventing validation when form is first displayed
Great, thanks! it worked. Best, Session Hi, I had the same problem, and added in my struts.xml : interceptor-ref name=validation param name=excludeMethodsexecute, input,back,cancel,browse, detail, delete, goAdd, goModif, view/param /interceptor-ref interceptor-ref name=workflow param name=excludeMethods execute,input,back,cancel,browse, detail, delete, goAdd, goModif, view/ param /interceptor-ref So add the name of your first method in the excludeMethods, and the validation will not occures. Session A Mwamufiya [EMAIL PROTECTED] 13/08/2007 08:58 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A user@struts.apache.org cc Objet Preventing validation when form is first displayed Hi, I have an action that is validateable and uses the validate method to ensure that an element isn't added to the database if it already exists in there. Unfortunately, the validation occurs as soon as my form is launched. I tried to follow the approach from the helloworld example to not have this happen, but it doesn't work. I would rather avoid using annotations for maintainability reasons. Would someone give me directions to how to stop validation from occurring when the form is launched. 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: switch action - doubt
SwitchAction does not switch between applications. It switches between Struts modules within one application. What you want to do is include the context root in your paths. There's an attribute for that. I believe it's contextRelative=true Paul On 8/13/07, ANIMESH SAXENA [EMAIL PROTECTED] wrote: Could you please mention which struts version?? On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks -- Animesh Saxena http://inlovewithlinux.blogspot.com
Re: switch action - doubt
Struts Version is : 1.1 One more strange thing that is happening is: If i put the url as : http://localhost:9080/spmod/toModule.do?prefix=page=/forwardToTrainingDB.doand debug, I reach the ActionClass having 'forwardToTrainingDB' as the action mapping, and then I get 404 error. It seems like it is not recognising the Module B's context root. On 8/13/07, ANIMESH SAXENA [EMAIL PROTECTED] wrote: Could you please mention which struts version?? On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks -- Animesh Saxena http://inlovewithlinux.blogspot.com
Re: Use of Struts Validation outside struts framework
You will have to populate an ActionForm object, for the Validator requires that. On 8/13/07, Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I have validation.xml validator-rules.xml many other validation rules files in my existing struts application. I have other desktop application which has same fields like forms in the struts application. I want to make use of above files (validation.xml, validator-rules.xml, other validation files) for validating same fields using Struts Validation framework How can I use these files for validation. Please help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _
Re: Use of Struts Validation outside struts framework
On 8/13/07, Prashant Baviskar [EMAIL PROTECTED] wrote: struts application. I want to make use of above files (validation.xml, validator-rules.xml, other validation files) for validating same fields using Struts Validation framework How can I use these files for validation. hmm, well, Struts validation uses apache commons validation. It shouldn't be a big step to go from the on to the other, but I haven't actually ever looked into it. mvg, Jasper - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: switch action - doubt
The application.xml file of the EAR has two different wars with different context roots specified for them? What else should I update to imply to the server that the context root has changed? I tried by adding a global forward: forward name=test2 contextRelative=true path=/test2/forwardToTrainingDB.do redirect=true/ and put the url as test2. But , when I run the appl, the complete url formed is: http://localhost:9080/test1/test2 whereas I want it to be http://localhost:9080/test2/forwardToTrainingDB.do What should i do? On 8/13/07, Paul Benedict [EMAIL PROTECTED] wrote: SwitchAction does not switch between applications. It switches between Struts modules within one application. What you want to do is include the context root in your paths. There's an attribute for that. I believe it's contextRelative=true Paul On 8/13/07, ANIMESH SAXENA [EMAIL PROTECTED] wrote: Could you please mention which struts version?? On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction / 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks -- Animesh Saxena http://inlovewithlinux.blogspot.com
Re: switch action - doubt
Could you please mention which struts version?? On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks -- Animesh Saxena http://inlovewithlinux.blogspot.com
RE: Use of Struts Validation outside struts framework
Thanks Paulus, I have to populate an ActionForms object first which happens in struts after submitting form. then struts validation does it's work before calling the execute method. I want to do the same explicitely. Can you tell me the class which reads struts-config.xml, in which we add validator plug-in OR The classes from Struts source which helps to perform validation in struts, responsible for reading validation.xml , validator-rules.xml Thanks regards Prashant -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Benedict Sent: Monday, August 13, 2007 1:08 PM To: Struts Users Mailing List Subject: Re: Use of Struts Validation outside struts framework You will have to populate an ActionForm object, for the Validator requires that. On 8/13/07, Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I have validation.xml validator-rules.xml many other validation rules files in my existing struts application. I have other desktop application which has same fields like forms in the struts application. I want to make use of above files (validation.xml, validator-rules.xml, other validation files) for validating same fields using Struts Validation framework How can I use these files for validation. Please help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _
*/* Wildcard in Action
Hi, I've followed the examples in the InfoQ-Book Starting Struts2 regarding CRUD. But there is an issue with the following action: action name=”*/*” method=”{2}” class=”com.infoq.actions.{1}Action” result type=”redirect”/{1}/view.action/result the request on this Action results in an exception: Struts Problem Report Struts has detected an unhandled exception: # *Messages*: There is no Action mapped for namespace /User and action name list. Stacktraces *There is no Action mapped for namespace /User and action name list. - [unknown location]* com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186) I think that the wildcard */* doesn't work. If I replace the / with an _ everything works fine. Is there a way to use the / or should I use the _? yours Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: switch action - doubt
Please anyone reply On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks
How exactly It happens !!!!!!!
Hi, I am new to struts. Can any one explains when we submit the form, How the struts-config.xml is read, How form bean is populated, How validator plug-in is read from deployment descriptor. How validation is performed how execute method gets called. Question indicated with arrow are more important. As I want to explicitly call validator framework of struts (Without using struts framework web/app server). I want to know the classes in struts framework which are responsible for this --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _
RE: switch action - doubt
Are you submitting any request params or simply redirecting it to the new URL?? I hope simple re-directing should work. For that you can specify redirect=true as an attribute in the forward tag. -Original Message- From: Pooja Kaur [mailto:[EMAIL PROTECTED] Sent: Monday, August 13, 2007 2:44 PM To: user@struts.apache.org Subject: Re: switch action - doubt Please anyone reply On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
getting user selection from a s:optiontransferselect object
Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Evaluating a javascript expression in order to set the readonly attribute
Hi, I would like to set a textbox to readonly when a flag is set in my action. I have the following jsp call: s:textfield name=name label=Name readonly=if(%{editingFlag==true}){return 'true'}/ but the textfield is not readonly, and the page source reflects it. BTW, editingFlag is set in the prepare() method of my action. Any idea on how to write the evaluation? Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: switch action - doubt
Thanks all for replying. Here is my actual problem statement: I have one web project named eg. Training and 2nd project named eg. Test. The login to application is through the Test Project. I want a link in the Test project which points to the Training project and this 'Training project should be able to get the user details from the session. What I have done is: I created a WAR file for this new Training project and put this war file in the EAR file of the Test project. In this application.xml file of Test project, now there are 2 wars present with different context roots. I tried using SwitchAction to switch between these war files and have mentioned the problems i am facing. Is there a better and feasible way to implement this scenario. I am running my appl through WSAD. On 8/13/07, Nagraj Rao [EMAIL PROTECTED] wrote: Are you submitting any request params or simply redirecting it to the new URL?? I hope simple re-directing should work. For that you can specify redirect=true as an attribute in the forward tag. Sorry to be replying directly. For some reason my mails are not reaching the struts group. N -Original Message- From: Pooja Kaur [mailto:[EMAIL PROTECTED] Sent: Monday, August 13, 2007 2:44 PM To: user@struts.apache.org Subject: Re: switch action - doubt Please anyone reply On 8/13/07, Pooja Kaur [EMAIL PROTECTED] wrote: Hi, I have 2 war files added to an EAR. Both of them have a different context root. Eg. Module A has test1 as the context root and Module B has test2 I did the following in the struts-config of Module A which is the default module: 1. Added an action action path=/toModule type=org.apache.struts.actions.SwitchAction/ 2. The link to switch the module has the URL eg. toModule.do?prefix=/test2 page=/forwardToTrainingDB.do When I click on the link with the above url , i get 400 (Bad Request) Error message. The mapping for forwardToTrainingDB.do is present in the struts-config xml file of test2 module. Please help me how to resolve this problem. Thanks
How to know if an element of a list belongs to another list using Struts2 tags?
Hi all! I'm iterating over two list, and I need to shown if an element of the second list belongs to the first. Something like that: iterator list1 print list1.actualElement.attributes... iterator list2 if list2.element == list1.actualElement print yes else print no The problem is that I only want to print ONE yes or not not all of them. It exists any tag like s:belongs value=myList element=theElement or something? Or I should create an external variable _belongs and set to true if the element is found (like the standard search procedure we learnt years ago when we were rookies in programming ; ) Thank you in advance, and like always, sorry about my English. -- View this message in context: http://www.nabble.com/How-to-know-if-an-element-of-a-list-belongs-to-another-list-using-Struts2-tags--tf4260538.html#a12124300 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] what is your practice to do Sidebar thing??
May I know what is your practice to do Sidebar thing? here the sidebar means a block lets say on the left side showing login form for guest user and showing user menu for logged in user. s:include ? s:action ? or do it in decorator level (sitemesh) ? thank you very much. Joe -- View this message in context: http://www.nabble.com/-s2--what-is-your-practice-to-do-Sidebar-thing---tf4260692.html#a12124636 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Calling Struts Validation framework explicitly from WebServices
Hi, I have a struts application. I am separating business logic from presentation logic going to expose this business logic as web-service. I want to explicitly call validation framework of struts from web service. Please Help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _
RE Evaluating a javascript expression in order to set the readonly attribute
In your Action, add an String attribute named editingFlag with a getter and a setter. Set the value (true or false) of editingFlag in the method forwarding to your JSP. In the JSP : s:textfield name=name label=Name readonly=${editingFlag)/ Session A Mwamufiya [EMAIL PROTECTED] 13/08/2007 12:46 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A user@struts.apache.org cc Objet Evaluating a javascript expression in order to set the readonly attribute Hi, I would like to set a textbox to readonly when a flag is set in my action. I have the following jsp call: s:textfield name=name label=Name readonly=if(%{editingFlag==true}){return 'true'}/ but the textfield is not readonly, and the page source reflects it. BTW, editingFlag is set in the prepare() method of my action. Any idea on how to write the evaluation? Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] Re: Calling Struts Validation framework explicitly from WebServices
Look at Apache commons-validator... asking the question in many different ways will not generate significantly different answers. http://commons.apache.org/validator/ d. --- Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I have a struts application. I am separating business logic from presentation logic going to expose this business logic as web-service. I want to explicitly call validation framework of struts from web service. Please Help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Evaluating a javascript expression in order to set the readonly attribute
--- Session A Mwamufiya wrote: s:textfield name=name label=Name readonly=if(%{editingFlag==true}){return 'true'}/ but the textfield is not readonly, and the page source reflects it. BTW, editingFlag is set in the prepare() method of my action. Any idea on how to write the evaluation? Try something like: %{editingFlag} d. Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Showcase
Has anyone been able to get the tree select selection to work? http://www.planetstruts.org/struts2-showcase/tags/ui/showDynamicTreeAction.action Selecting a tree node does not invoke the action class wired to the tree. -- Scott [EMAIL PROTECTED]
RE: [OT] Re: Calling Struts Validation framework explicitly from WebServices
Thanks Dave, You are right, However I asked it again to get right answer. Anyways I tried with commons.apache.org I want to use org.apache.struts.validator. want to know the class which explicitly calls other classes responsible for validation after the form is submitted -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Monday, August 13, 2007 5:12 PM To: Struts Users Mailing List Subject: [OT] Re: Calling Struts Validation framework explicitly from WebServices Look at Apache commons-validator... asking the question in many different ways will not generate significantly different answers. http://commons.apache.org/validator/ d. --- Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I have a struts application. I am separating business logic from presentation logic going to expose this business logic as web-service. I want to explicitly call validation framework of struts from web service. Please Help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[S2] 2 Select Boxes, one based on the other
I apologize profusely for what has got to be a FAQ, but I can't find reference to this at all, either Googling or in my message archives. I have the classic problem of 2 select boxes, and the values of the second select will change based upon the choice in the first box. I am using a simple theme at the present time, and have no immediate plans to move to anything AJAX related for this release. I have seen ComboBox and AutoComplete, but these don't seem to come close to what is needed. IS there a Struts 2 based way to do this, or am I back to JavaScript? Thanks for any help, and again, I very much apologize for posting what must be a very basic question. Skip Hollowell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] 2 Select Boxes, one based on the other
Any solution has to be javascript based. The question is wether you want a server side visit or not. And that is dependant on how much data variability there is in your second select list. In our case if there are only a limited number of variations we download them all as part of the initial page and use pure javascript, but if there lots then we employ a simple ajax call. Z. I apologize profusely for what has got to be a FAQ, but I can't find reference to this at all, either Googling or in my message archives. I have the classic problem of 2 select boxes, and the values of the second select will change based upon the choice in the first box. I am using a simple theme at the present time, and have no immediate plans to move to anything AJAX related for this release. I have seen ComboBox and AutoComplete, but these don't seem to come close to what is needed. IS there a Struts 2 based way to do this, or am I back to JavaScript? Thanks for any help, and again, I very much apologize for posting what must be a very basic question. Skip Hollowell - 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 1.2] javax.servlet.jsp.JspException: No getter method for property: error
Hello! I'm getting a currious errormessage, which I'm not understanding with the background written later on: javax.servlet.jsp.JspException: No getter method for property: errorm of bean: camp Background: The bean camp is set while validating, because an error happened. Therefore, the original page is shown again, the errormessage is shown and the bean camp is correctly detected. But the property errorm can't be resolved! jsp: logic:present name=camp bean:logic name=camp property=errorm id=ma.../bean:logic /logic:present ActionErrors validate (ActionMapping mp, HttpServletRequest rq) { ... CheckActiv ca=new CheckActive(); rq.setAttribute(camp,ca); } class CheckActive { ... public ArrayList String getErrorm() { return new ArrayList String(missingpaket.keySet()); } ... } The bean camp is detected in the jsp, but the property errorm (which gives ca.getErrorm()) can't be found. I am helpless ... . What am I doing wrong? Thanks for any hint, kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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: Conditional + visitor validation - for nested objects -- so far..
So far, i've been able to define the actual validation on the domain attribute addressline1, by putting @VisitorFieldValidator on the setters of all objects that contain it (ie application,primaryapp,address) . Now, i need to restrict the validation depending on the method called within the Action - these correspond to different buttons on the same page (ie same Action) ; say if submitOne() is invoked, only addressline1 should be validated ; and for submitTwo() ; addressline2 should be validated. Since the domain object should not be tied to any Action in particular, i also want the flexibility to validate addressline1 when called from another Action, and the error message should be different in this case. dunno if this is asking for too much, or there's something wrong the way i'm thinking abt it! -Joseph On 8/11/07, j alex [EMAIL PROTECTED] wrote: Hi Paul, Let me explain in detail : I have an application that needs to collect info about a primary applicant (applicant1) and one or more co-applicants (coapp1, coapp2 etc.) . So, we could be presenting the same fields from the domain model multiple times in the page - like : Primary App info : s:textfield name=application.primaryApp.address.addressline1../ s:textfield name=application.primaryApp.address.addressline2../ Co=App info : s:textfield name=application.coApp1.address.addressline2../ s:textfield name=application.coApp1.address.addressline2../ and the error message must be specific to the corresponding applicant. Also, the rules could be different for the co-apps than the primary apps. Address is the domain object having fields addressline1, addressline2 etc. and this could be tied to primaryapp or coapp. In the Action class, we have a getApplication and setApplication alone. Also, note that we show both of these in the same page, and the Action is the same. I want to use visitor validation here since the fields are the same and i don't want to repeat them N times, but just define it once in the model. In this case, where would we define the @VisitorFieldValidator and the field-specific validations (@EmailValidator, @StringLengthFieldValidator etc.) Thanks, Joseph On 8/11/07, Paul Benedict [EMAIL PROTECTED] wrote: So your error messages are customized based on user? That doesn't make sense to me. Are you sure? Paul On 8/10/07, j alex [EMAIL PROTECTED] wrote: Hi All, This is somewhat related to Matt's post on conditional validation at http://www.nabble.com/Re:-Conditional-validation-p11990883.html ; i dont have the original email on struts-user (joined the group only last week!) to reply to : I need some help regarding the extent to which we can apply visitor field validation. Say, my domain object (Address - with attributes addrline1, addrline2, ZIP etc.) is buried deep in a hierarchy - ie app.user1.address; and we define only app in the Action. Can we declare a visitor validation on app and define the rules on Address-validation.xml ? . My requirement is that we could use address in different objects ; like app.user1.address ; app.user2.address - and the error message needs to be customized depending on user1, user2 etc . It'll be elegant if the validation rules are defined just once for Address. Right now, the only way i know to achieve is to define ALL fields in the action- validation.xml and hardcode the message for each situation ; which i think is an overkill. Please let me know if you've any suggestions/ideas. Thanks, Joseph
Re: taking control of the struts 2 layout in a jsp
We've had to override and customise customise the xhtml freemarker templates. It's pretty easy and effective. All you do is explode the struts core jar and copy the template files (.ftl extension) you want to change to a template directory in the root of your app. Modify as you need. I know there's a page on the wiki, I just can't see it. Z. Hi, Struts displays the jsp objects the way it likes, for example, aligning buttons on the right even if I put them inside a div align=left/div tag. Is there a way to take control of how the layout is displayed without using the simple theme (that doesn't have a nice UI by the way)? Thanks, Session - 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: [OT] Re: Passing value from Struts tag in JSP to Action class
No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick=form.action='action.do?command=notify' * value*=${list.rowId} instead of HTML input type=image... ? Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it. Dave's suggestions are good too, it just comes down to how you really want this to work. TIA, Oleg. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Oleg Konovalov wrote: No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? You wouldn't get it from SESSION, you'd get it from REQUEST... Unless your intention is to have a session-scoped ActionForm, but then you wouldn't get at the value as you've shown anyway (in fact, even if it's a request-scoped from, that's the wrong way to get the value, since your bypassing Struts to do it). Since you aren't using AJAX, and you want a single form, all you need to do is set things up in a 100% typical Struts fashion... have the HTML form submit to the Action you want it to, and connect an ActionForm, probably request-scoped, to that Action. Make sure your ActionForm includes the properly named getter/setter/field for it. Then, on your HTML form, add a hidden field with the name rowId, and make each button on the form a submit button (you can have more than one), and add an onClick event to it that does this: this.form.rowId.value='${list.rowId}'; That should do it. Then, in your Action you just do: String rowId = form.getRowId(); ...assuming form is the name of the ActionForm parameter. That should be all you need to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick=form.action='action.do?command=notify' * value*=${list.rowId} instead of HTML input type=image... ? Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it. Dave's suggestions are good too, it just comes down to how you really want this to work. TIA, Oleg. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.15/949 - Release Date: 8/12/2007 11:03 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Struts 1.2] javax.servlet.jsp.JspException: No getter method for property: error
Make sure you're not redirecting. You will lose request attributes if you do so. On 8/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello! I'm getting a currious errormessage, which I'm not understanding with the background written later on: javax.servlet.jsp.JspException: No getter method for property: errorm of bean: camp Background: The bean camp is set while validating, because an error happened. Therefore, the original page is shown again, the errormessage is shown and the bean camp is correctly detected. But the property errorm can't be resolved! jsp: logic:present name=camp bean:logic name=camp property=errorm id=ma.../bean:logic /logic:present ActionErrors validate (ActionMapping mp, HttpServletRequest rq) { ... CheckActiv ca=new CheckActive(); rq.setAttribute(camp,ca); } class CheckActive { ... public ArrayList String getErrorm() { return new ArrayList String(missingpaket.keySet()); } ... } The bean camp is detected in the jsp, but the property errorm (which gives ca.getErrorm()) can't be found. I am helpless ... . What am I doing wrong? Thanks for any hint, kind regards, Andreas Hartmann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
global exception handling - struts sometimes ignores my setting in struts-config, what's wrong?
i need to configure struts to display user a errpage.jsp, when runtime exception CustomException occur anywhere in the application. i've added to struts-config: global-exceptions exception key=exception.Exception type=somepackage.CustomException path=/ErrorPage.jsp/ /global-exceptions and to web.xml: error-page error-code500/error-code location/ErrorPage.jsp/location /error-page when i browse page _spikeScriptletThrowingEx.jsp: %@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% html head title/title /head body % throw new Exception(); % /body /html i receive only The website cannot display the page, HTTP 500 why is the ErrorPage.jsp not displayed? -- View this message in context: http://www.nabble.com/global-exception-handling---struts-sometimes-ignores-my-setting-in-struts-config%2C-what%27s-wrong--tf4261735.html#a12127828 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
make each button on the form a submit button I can't do it, because button has to have image, so I use input type=image... Will that work ? Also, are you sure thisthis.form.rowId.value='${list.rowId}'; will work together with myform.action='action.do?command=notify' I think, Javascript will get screwed up - will complain. And I will have to make all inside a scriplet, something like: onClick=% form.rowId.value=*c:out* *value=*'${list.rowId}/; form.action='action.do?command=notify' % Is that better ? On 8/13/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? You wouldn't get it from SESSION, you'd get it from REQUEST... Unless your intention is to have a session-scoped ActionForm, but then you wouldn't get at the value as you've shown anyway (in fact, even if it's a request-scoped from, that's the wrong way to get the value, since your bypassing Struts to do it). Since you aren't using AJAX, and you want a single form, all you need to do is set things up in a 100% typical Struts fashion... have the HTML form submit to the Action you want it to, and connect an ActionForm, probably request-scoped, to that Action. Make sure your ActionForm includes the properly named getter/setter/field for it. Then, on your HTML form, add a hidden field with the name rowId, and make each button on the form a submit button (you can have more than one), and add an onClick event to it that does this: this.form.rowId.value='${list.rowId}'; That should do it. Then, in your Action you just do: String rowId = form.getRowId(); ...assuming form is the name of the ActionForm parameter. That should be all you need to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick= form.action='action.do?command=notify' * value*=${list.rowId} instead of HTML input type=image... ? Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it. Dave's suggestions are good too, it just comes down to how you really want this to work. TIA, Oleg. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it!
JSF Woodstock components in Struts 2
Has anyone tried integrating the woodstock JSF components in Struts 2 ? I tried but not much luck. Thanks, r-a-v-i - Pinpoint customers who are looking for what you sell.
Struts 2 - woodstock JSF components
Hi, Has anyone tried integrating the woodstock JSF components (Sun's RI ) into Struts 2 ? r-a-v-i - Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
Re: Dynamic Tree Example
Do you think leaving known broken code on the Showcase is a good idea realizing developers are flocking to this resource to figure out how to do things? If it is known not to work, maybe it should say this or be removed from the Showcase! On 8/10/07, Musachy Barroso [EMAIL PROTECTED] wrote: Yes the example had several problems on 2.0.x, some of them were fixed, others are still there. musachy On 8/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm studying the dynamic tree example in the showcase, and there are a couple problems. First, when you view sources, the configuration for the dynamicTreeSelectAction is not visible. Also, as I inspect this action, I'm discovering that its dynamicTreeSelect.jsp never displays the node selected! Is this example not finished? -- Scott [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Scott [EMAIL PROTECTED]
Re: Get an error message using html:errors... but not print it?
http://struts.apache.org/1.2.9/userGuide/struts-logic.html#messagesPresent --- [EMAIL PROTECTED] wrote: Hi, I have searched but found nothing about this. How can I fetch an specific error using html:errors property=something without printing it to the page? Or somehow check if it exists? I want this because I want to print the error with some styling in the html. But I don't want that styling code to be in the html if the message doesn't exist, and I don't want any styling code in the resource file. There must be lots of people who have done this before, right? Example: html:password property=password/ struts:if-error-exists property=password div class=error html:errors property=password /div /struts:if-error-exists Regards /Jimi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Get an error message using html:errors... but not print it?
Hi, I have searched but found nothing about this. How can I fetch an specific error using html:errors property=something without printing it to the page? Or somehow check if it exists? I want this because I want to print the error with some styling in the html. But I don't want that styling code to be in the html if the message doesn't exist, and I don't want any styling code in the resource file. There must be lots of people who have done this before, right? Example: html:password property=password/ struts:if-error-exists property=password div class=error html:errors property=password /div /struts:if-error-exists Regards /Jimi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Message resources
Where are the stock validation messages located? Are we still required to be copy them into our application message file? -- Scott [EMAIL PROTECTED]
Re: Redirect after File Upload
Jan, Add IFrameIO to your javascript since fileupload uses iframe io transport instead of XHR. dojo.require(dojo.io.IframeIO); Refer to this article for details. http://ajaxian.com/archives/dojo-uploading-files-and-contents-with-ajax cheers, Umesh Jan Steinke wrote: Hi There, I would like to upload some jpegs with struts 2.0.9 and redirect to another site after the Action returns SUCCESS. I tried is like this ( after reading the file upload example from the struts 2 showcases): uploadPictureForm.jsp: s:form action=uploadPicture.action method=POST enctype=multipart/form-data Datei hochladen (1): s:file name=upload accept=image/*/br Datei hochladen (2): s:file name=upload accept=image/*/br Datei hochladen (3): s:file name=upload accept=image/*/br Datei hochladen (4): s:file name=upload accept=image/*/br Datei hochladen (5): s:file name=upload accept=image/*/br s:a theme=ajax targets=center executeScripts=true showLoadingText=trueupload/s:a /s:form actions.xml (package inside struts.xml): action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewPictures.jsp/result /action UploadPictureAction.java: ... private File[] upload; public String upload() throws Exception { if(upload != null) { ... // do something with my files } System.out.println(reached End of Action); return SUCCESS; } ... Works fine except there's no redirect after return SUCCESS (I also tried different combinations in actions.xml like result name=success type=redirect But I get the same result. Successfull upload and no redirect ). It works only with removing the ajax tags inside the upload form. But I need ajax. Does someone of you now, whether that's a struts bug? I've searched about that already with google etc. with no results about that. Thanks for every reply, Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Redirect-after-File-Upload-tf4259578.html#a12130325 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
Expert struts programmers, please take a look at this thread. I believe it should be a straight forward answer, but I haven't received any replies since I launched the thread. I don't mean to pester you, but I'm really trying to get over this hurdle. Thanks, Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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: global exception handling - struts sometimes ignores my setting in struts-config, what's wrong?
Struts isn't catching this exception because you're throwing it in a JSP page which is being accessed outside the Struts servlet (directly via a URL). Try throwing the exception in a Struts action and see what happens. But even if you do that you'll run into a problem with the current setup. You're asking Struts to intercept an exception called somepackage.CustomException but are throwing java.lang.Exception. So Struts will just ignore it since the thrown exception is not a CustomException. Try throwing CustomException instead of Exception OR change your Struts config to look for java.lang.Exception. Zarar On 8/13/07, Marek Cupak [EMAIL PROTECTED] wrote: i need to configure struts to display user a errpage.jsp, when runtime exception CustomException occur anywhere in the application. i've added to struts-config: global-exceptions exception key=exception.Exception type=somepackage.CustomException path=/ErrorPage.jsp/ /global-exceptions and to web.xml: error-page error-code500/error-code location/ErrorPage.jsp/location /error-page when i browse page _spikeScriptletThrowingEx.jsp: %@ page language=java contentType=text/html; charset=UTF-8 pageEncoding=UTF-8% html head title/title /head body % throw new Exception(); % /body /html i receive only The website cannot display the page, HTTP 500 why is the ErrorPage.jsp not displayed? -- View this message in context: http://www.nabble.com/global-exception-handling---struts-sometimes-ignores-my-setting-in-struts-config%2C-what%27s-wrong--tf4261735.html#a12127828 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
Give it an id (or name? I forget) and supply set/get methods in the action? Isn't it just two select boxes (for all intents and purposes, at least regarding what you're doing)? --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Expert struts programmers, please take a look at this thread. I believe it should be a straight forward answer, but I haven't received any replies since I launched the thread. I don't mean to pester you, but I'm really trying to get over this hurdle. Thanks, Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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] Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Struts 1.2] javax.servlet.jsp.JspException: No getter method for property: error
Hello Paul, but the bean is there - otherwise, the logic:iterate part wouldn't be accessed at all after bean:present. I can't understand this. Besides that, I now solved it this way: I put the needed object to an already existing session object. Addressing this way works fine. BTW: The jsp must be: logic:present name=camp logic:iterate name=camp property=errorm id=ma.../logic:iterate /logic:present But this doesn't matter at all :-) Kind regards, Andreas Hartmann Paul Benedict wrote: Make sure you're not redirecting. You will lose request attributes if you do so. On 8/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello! I'm getting a currious errormessage, which I'm not understanding with the background written later on: javax.servlet.jsp.JspException: No getter method for property: errorm of bean: camp Background: The bean camp is set while validating, because an error happened. Therefore, the original page is shown again, the errormessage is shown and the bean camp is correctly detected. But the property errorm can't be resolved! jsp: logic:present name=camp logic:iterate name=camp property=errorm id=ma.../logic:iterate /logic:present ActionErrors validate (ActionMapping mp, HttpServletRequest rq) { ... CheckActiv ca=new CheckActive(); rq.setAttribute(camp,ca); } class CheckActive { ... public ArrayList String getErrorm() { return new ArrayList String(missingpaket.keySet()); } ... } The bean camp is detected in the jsp, but the property errorm (which gives ca.getErrorm()) can't be found. I am helpless ... . What am I doing wrong? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] ResourceBundle Search Order
On the following page, it describes how you can create hierarchical i18n files and Struts will scan the hierarchy for appropriate messages. http://struts.apache.org/2.x/docs/internationalization.html This works well for Actions, but since most of my messages are in JSPs, I'd prefer to put the *.properties files next to my JSPs and use a similar hierarchy-scanning setup. Is this possible? If so, how would I go about doing it? Is it just a matter of writing a new TextProvider? If so, how do I plug it in and get s:text to read from it? Thanks, Matt -- View this message in context: http://www.nabble.com/-s2--ResourceBundle-Search-Order-tf4262689.html#a12130873 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional validation
Hi Matt, Can you please tell me what's needed to use this validator using annotations alone? . Also, i need a simple conditional validator - ie a field needs to be validated only if a prerequisite condition is satisfied, else the validations on it must be skipped and no error must be added (since this is just a condition check). Example : if appname is to be validated only if appid 100, i will give the inverse expression in ConditionalFieldValidator with shortCircuit true and the subsequent validations below it ; assumption being if the first condition becomes true (i.e prerequisite not satisfied), then dont validate further. The annotation i need would look like : @ConditionalFieldValidator(fieldName = app.appname, expression = app.appid 100, message = , shortCircuit=true) @StringLengthFieldValidator(fieldName = app.appname message = App Name must be gt 5 chars, minLength = 5, maxLength = 12) I don't know how to make Struts 2 see this custom validator. Thanks, Joseph mraible wrote: I figured out how to do this - posting here so others will benefit. 1. Create a new ConditionalVisitorFieldValidator.java: public class ConditionalVisitorFieldValidator extends VisitorFieldValidator { private String expression; public void setExpression(String expression) { this.expression = expression; } public String getExpression() { return expression; } /** * If expression evaluates to true, invoke visitor validation. * @param object the object being validated * @throws ValidationException */ public void validate(Object object) throws ValidationException { if (validateExpression(object)) { super.validate(object); } } /** * Validate the expression contained in the expression paramter. * @param object the object you're validating * @return true if expression evaluates to true (implying a validation failure) * @throws ValidationException if anything goes wrong */ public boolean validateExpression(Object object) throws ValidationException { Boolean answer = Boolean.FALSE; Object obj = null; try { obj = getFieldValue(expression, object); } catch (ValidationException e) { throw e; } catch (Exception e) { // let this pass, but it will be logged right below } if ((obj != null) (obj instanceof Boolean)) { answer = (Boolean) obj; } else { log.warn(Got result of + obj + when trying to get Boolean.); } return answer; } } 2. Add it to your validators.xml: validator name=conditionalvisitor class=com...validation.ConditionalVisitorFieldValidator/ 3. Write your validation rule: field name=colleaguePosition field-validator type=fieldexpression short-circuit=true reason == 'colleague' and colleaguePositionID == '_CHOOSE_' messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator field-validator type=conditionalvisitor reason == 'colleague' and colleaguePositionID == 'OTHER' message/ /field-validator /field Hope this helps, Matt mraible wrote: I need to do something similar - is it possible to have conditional visitor validation in Struts 2? AFAICT, it isn't. Basically, I'd like to have a couple of validation rules for a drop-down. One rule is that the user must select at least one choice when the drop-down has its radio button selected: field-validator type=fieldexpression short-circuit=true reason != 'partner' or (reason == 'partner' and partnerPositionID != '_CHOOSE_') messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator This works. Now I want to require a number of fields if the person selects the Other... option. The validation syntax starts to get complicated at this point. I'd like to do something like: reason != 'partner' or (reason == 'partner' and partnerPositionID != 'OTHER') - kick in visitor validation. I still think the above syntax is confusing (ref http://tinyurl.com/2htw2k), I'd much rather write something like: reason == 'partner' and partnerPositionID == 'OTHER' - show message I'm guessing it's possible to write my own FieldExpressionValidator that inverses the true/false outcome? Why do I need conditional visitor validation? I'm trying to create a component that can be re-used in the backend (model object w/ its own validation rules) and on the front-end (using JSP tag files or the s:component tag). If there's an easier way to do this, please let me know. Of course, I could use JSF/Wicket/Tapestry - and that might be the outcome if this is not possible. Thanks, Matt Sparecreative wrote: Is there a way to setup conditional validation through the validation.xml
Re: Conditional validation
I haven't tried working with Struts 2's annotations for validation yet, so I'm unable to answer this question. In a week, things might be different. ;-) Matt strutstwouser wrote: Hi Matt, Can you please tell me what's needed to use this validator using annotations alone? . Also, i need a simple conditional validator - ie a field needs to be validated only if a prerequisite condition is satisfied, else the validations on it must be skipped and no error must be added (since this is just a condition check). Example : if appname is to be validated only if appid 100, i will give the inverse expression in ConditionalFieldValidator with shortCircuit true and the subsequent validations below it ; assumption being if the first condition becomes true (i.e prerequisite not satisfied), then dont validate further. The annotation i need would look like : @ConditionalFieldValidator(fieldName = app.appname, expression = app.appid 100, message = , shortCircuit=true) @StringLengthFieldValidator(fieldName = app.appname message = App Name must be gt 5 chars, minLength = 5, maxLength = 12) I don't know how to make Struts 2 see this custom validator. Thanks, Joseph mraible wrote: I figured out how to do this - posting here so others will benefit. 1. Create a new ConditionalVisitorFieldValidator.java: public class ConditionalVisitorFieldValidator extends VisitorFieldValidator { private String expression; public void setExpression(String expression) { this.expression = expression; } public String getExpression() { return expression; } /** * If expression evaluates to true, invoke visitor validation. * @param object the object being validated * @throws ValidationException */ public void validate(Object object) throws ValidationException { if (validateExpression(object)) { super.validate(object); } } /** * Validate the expression contained in the expression paramter. * @param object the object you're validating * @return true if expression evaluates to true (implying a validation failure) * @throws ValidationException if anything goes wrong */ public boolean validateExpression(Object object) throws ValidationException { Boolean answer = Boolean.FALSE; Object obj = null; try { obj = getFieldValue(expression, object); } catch (ValidationException e) { throw e; } catch (Exception e) { // let this pass, but it will be logged right below } if ((obj != null) (obj instanceof Boolean)) { answer = (Boolean) obj; } else { log.warn(Got result of + obj + when trying to get Boolean.); } return answer; } } 2. Add it to your validators.xml: validator name=conditionalvisitor class=com...validation.ConditionalVisitorFieldValidator/ 3. Write your validation rule: field name=colleaguePosition field-validator type=fieldexpression short-circuit=true reason == 'colleague' and colleaguePositionID == '_CHOOSE_' messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator field-validator type=conditionalvisitor reason == 'colleague' and colleaguePositionID == 'OTHER' message/ /field-validator /field Hope this helps, Matt mraible wrote: I need to do something similar - is it possible to have conditional visitor validation in Struts 2? AFAICT, it isn't. Basically, I'd like to have a couple of validation rules for a drop-down. One rule is that the user must select at least one choice when the drop-down has its radio button selected: field-validator type=fieldexpression short-circuit=true reason != 'partner' or (reason == 'partner' and partnerPositionID != '_CHOOSE_') messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator This works. Now I want to require a number of fields if the person selects the Other... option. The validation syntax starts to get complicated at this point. I'd like to do something like: reason != 'partner' or (reason == 'partner' and partnerPositionID != 'OTHER') - kick in visitor validation. I still think the above syntax is confusing (ref http://tinyurl.com/2htw2k), I'd much rather write something like: reason == 'partner' and partnerPositionID == 'OTHER' - show message I'm guessing it's possible to write my own FieldExpressionValidator that inverses the true/false outcome? Why do I need conditional visitor validation? I'm trying to create a component that can be re-used in the backend (model object w/ its own validation rules) and on the front-end (using JSP tag files or the s:component tag). If there's an easier way to do this, please let me know. Of course, I
Re: JSF Woodstock components in Struts 2
What are the errors you're getting? Not much luck isn't very descriptive. ;-) Matt Ravi Vedala wrote: Has anyone tried integrating the woodstock JSF components in Struts 2 ? I tried but not much luck. Thanks, r-a-v-i - Pinpoint customers who are looking for what you sell. -- View this message in context: http://www.nabble.com/JSF-Woodstock-components-in-Struts-2-tf4262185.html#a12131805 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] what is your practice to do Sidebar thing??
I've done it in the past using a combination of SiteMesh and s:action. http://raibledesigns.com/rd/entry/dependency_injection_with_sitemesh Matt Joe Lam wrote: May I know what is your practice to do Sidebar thing? here the sidebar means a block lets say on the left side showing login form for guest user and showing user menu for logged in user. s:include ? s:action ? or do it in decorator level (sitemesh) ? thank you very much. Joe -- View this message in context: http://www.nabble.com/-s2--what-is-your-practice-to-do-Sidebar-thing---tf4260692.html#a12131832 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
Actually, giving the lists a name and providing getters and setters just allows us to get the selected element within the respective list. I was able to find a suitable workaround by selecting all the elements in the list on an onclick event, then I can get everything that I want. Thanks, Session Give it an id (or name? I forget) and supply set/get methods in the action? Isn't it just two select boxes (for all intents and purposes, at least regarding what you're doing)? --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Expert struts programmers, please take a look at this thread. I believe it should be a straight forward answer, but I haven't received any replies since I launched the thread. I don't mean to pester you, but I'm really trying to get over this hurdle. Thanks, Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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] _ ___ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ - 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: getting user selection from a s:optiontransferselect object
Oh; I misunderstood what you wanted--sorry. OTOH this is probably an enhancement that people might want (kind of makes sense you'd want to be able to retrieve all the items from the right-hand list); if you're feeling saucy maybe add a feature request JIRA. --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Actually, giving the lists a name and providing getters and setters just allows us to get the selected element within the respective list. I was able to find a suitable workaround by selecting all the elements in the list on an onclick event, then I can get everything that I want. Thanks, Session Give it an id (or name? I forget) and supply set/get methods in the action? Isn't it just two select boxes (for all intents and purposes, at least regarding what you're doing)? --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Expert struts programmers, please take a look at this thread. I believe it should be a straight forward answer, but I haven't received any replies since I launched the thread. I don't mean to pester you, but I'm really trying to get over this hurdle. Thanks, Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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] _ ___ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ - 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] Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and arabic encoding
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ahmed, Ahmed Atif wrote: i'm using the post method but i will try to use GET if this will solve the problem No, POST is much better, since the parameters will always be encoded using the request body's encoding, which at least has an HTTP header (Content-Type) associated with it. The HTTP request URI itself has no good way to communicate character set information. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGwK5t9CaO5/Lv0PARAmD7AJ9EJcurIx0Olf4TI51Pfs8ohR822wCfSsiG 3hG/JkIpTWOUlneUPDMoYkw= =IeRn -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE [S2] autowiring with hand rolled factory
Thanks for the explanation. What would you say the main rationale is then for using Spring as a factory for the actions instead of the struts objectfactory? Regards Adam [EMAIL PROTECTED] on 13/08/07 08:13, wrote: Did you set this in your struts.xml ? constant name=struts.objectFactory value=spring / or constant name=struts.objectFactory value= org.myorg.mySpringContextFactory / For Autowiring, it's enable by default. But you can customise it : http://struts.apache.org/2.0.9/docs/spring-plugin.html The framework enables autowiring by default. (Autowiring means to look for objects defined in Spring with the same name as your object property). To change the wiring mode, modify the spring.autowire property. Wiring Mode struts.objectFactory.spring.autoWire = type The autowire property can be set to several options. name Auto-wire by matching the name of the bean in Spring with the name of the property in your action. This is the default type Auto-wire by looking for a bean registered with Spring of the same type as the property in your action. This requires you to have only one bean of this type registered with Spring auto Spring will attempt to auto-detect the best method for auto-wiring your action constructor Spring will auto-wire the parameters of the bean's constructor By default, the framework will at least try to use Spring to create all its objects. If the object cannot be created by Spring, then the framework will create the object itself. Adam Hardy [EMAIL PROTECTED] 12/08/2007 11:25 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A Struts Users Mailing List user@struts.apache.org cc Objet [S2] autowiring with hand rolled factory I'm sure I saw some references to this in the documentation before but I can't find it again now that I need it. I have my own context factory for Spring which I want to plug into the struts framework, but I can't work out how to set up the autowiring interceptor . It seems I must replace ActionAutoWiringInterceptor and configure it as 'anotherAutowiring' or similar. Would that be correct? While I'm on the subject, I'm not planning on setting up my actions in Spring, so I assume that struts2 will use its own ObjectFactory to do this. What is the reasoning behind the functionality that allows me to set up my actions in Spring? Is it just the rich configuration possibilities that Spring offers which struts wants to harness? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Oleg Konovalov wrote: make each button on the form a submit button I can't do it, because button has to have image, so I use input type=image... Will that work ? I believe so... best way to be sure would be to try it :) ... but I don't see why it wouldn't. Also, are you sure thisthis.form.rowId.value='${list.rowId}'; will work together with myform.action='action.do?command=notify' I think, Javascript will get screwed up - will complain. And I will have to make all inside a scriplet, something like: onClick=% form.rowId.value=*c:out* *value=*'${list.rowId}/; form.action='action.do?command=notify' % Is that better ? No, that would be wrong... go ahead and give it a try, you'll get a compile error on the JSP because the expression isn't valid. You may however be right to a degree... you may need to use c:out in place of ${list.rowId} (I think ${list.rowId} is valid JSP 2.0 EL, but that assumes JSP 2.0)... I think that's a valid JSP expression... again, give it a try, this is a syntactical issue that a minute or two of playing will resolve, it's the conceptual part you need to understand first. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On 8/13/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? You wouldn't get it from SESSION, you'd get it from REQUEST... Unless your intention is to have a session-scoped ActionForm, but then you wouldn't get at the value as you've shown anyway (in fact, even if it's a request-scoped from, that's the wrong way to get the value, since your bypassing Struts to do it). Since you aren't using AJAX, and you want a single form, all you need to do is set things up in a 100% typical Struts fashion... have the HTML form submit to the Action you want it to, and connect an ActionForm, probably request-scoped, to that Action. Make sure your ActionForm includes the properly named getter/setter/field for it. Then, on your HTML form, add a hidden field with the name rowId, and make each button on the form a submit button (you can have more than one), and add an onClick event to it that does this: this.form.rowId.value='${list.rowId}'; That should do it. Then, in your Action you just do: String rowId = form.getRowId(); ...assuming form is the name of the ActionForm parameter. That should be all you need to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick=
override conversion error for nested properties in struts 2
I'm having trouble overriding conversion errors for nested properties in struts 2. I've read the webworks documentation about overriding conversion errors for nested properties and it suggests to add the following to your resource bundle: invalid.fieldvalue.items[*].name=Some type conversion message here After doing this, it's still not working and I continue to get the default message. Am I missing a step? One thing to note is that I'm not using the index value. Instead, I'm using the object's unique id. We're using BlahAction-conversion.properties to bind the values. Perhaps the example only works with indexes? Could someone please tell me what I'm missing? Thanks -PV -- View this message in context: http://www.nabble.com/override-conversion-error-for-nested-properties-in-struts-2-tf4263511.html#a12133471 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
According to the documentation [1], the items in the list should get selected automatically when the form is submitted -- i.e. the desired behaviour / workaround is how the component is meant to work out of the box. So, it sounds like a JIRA issue should be filed, but as a bug report rather than a feature request. L. http://struts.apache.org/2.x/docs/optiontransferselect.html Dave Newton wrote: Oh; I misunderstood what you wanted--sorry. OTOH this is probably an enhancement that people might want (kind of makes sense you'd want to be able to retrieve all the items from the right-hand list); if you're feeling saucy maybe add a feature request JIRA. --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Actually, giving the lists a name and providing getters and setters just allows us to get the selected element within the respective list. I was able to find a suitable workaround by selecting all the elements in the list on an onclick event, then I can get everything that I want. Thanks, Session Give it an id (or name? I forget) and supply set/get methods in the action? Isn't it just two select boxes (for all intents and purposes, at least regarding what you're doing)? --- Session A Mwamufiya [EMAIL PROTECTED] wrote: Expert struts programmers, please take a look at this thread. I believe it should be a straight forward answer, but I haven't received any replies since I launched the thread. I don't mean to pester you, but I'm really trying to get over this hurdle. Thanks, Anyone familiar with the way the s:optiontransferselect tag works? I'm looking to retrieve the content of the entire right-hand list (not just a selected item in it). I would assume that there's a way to do that, but I'm not sure how. Any ideas? Thanks, Hi, I've been stuck trying to capture, in my action, the set of elements placed in one of the lists of an s:optiontransferselect tag. I can refer to the selected element in the list by using the name of the list, but how do I access all of the elements in the list? (they were obtained by shifting items from the other list) Thanks, Session - 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] _ ___ Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool. http://autos.yahoo.com/carfinder/ - 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] Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: getting user selection from a s:optiontransferselect object
Laurie Harper wrote: According to the documentation [1], the items in the list should get selected automatically when the form is submitted -- i.e. the desired behaviour / workaround is how the component is meant to work out of the box. So, it sounds like a JIRA issue should be filed, but as a bug report rather than a feature request. There already is a bug related to this. http://issues.apache.org/struts/browse/WW-1972 I couldn't find it in nabble, but I believe this is a known bug that's fixed in 2.1 In the couple places I have these controls I have this text: There's a bug in Struts2.0.8 that doesn't automatically select everything in the left list before submitting. It'll be fixed in 2.1, but in the meantime, please select everything in this left list before submitting. Which is fine for me, since I'm the only one using this as it's still in development. Not a reasonable solution for something that currently needs to work in production. -Dale - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Calling Struts Validation framework explicitly from WebServices
Prashant Baviskar wrote: Thanks Dave, You are right, However I asked it again to get right answer. Anyways I tried with commons.apache.org I want to use org.apache.struts.validator. You stated previously that you want to implement validation in an application that is not using Struts, so why the insistence on using the Struts validation code, rather than Commons Validator? The Struts code is just a thin wrapper/adapter around Commons Validator. want to know the class which explicitly calls other classes responsible for validation after the form is submitted You seem to have identified the appropriate package to begin exploring: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/ In particular, I would bet that ValidatorPlugIn.java would serve as a good starting point. L. -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Monday, August 13, 2007 5:12 PM To: Struts Users Mailing List Subject: [OT] Re: Calling Struts Validation framework explicitly from WebServices Look at Apache commons-validator... asking the question in many different ways will not generate significantly different answers. http://commons.apache.org/validator/ d. --- Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I have a struts application. I am separating business logic from presentation logic going to expose this business logic as web-service. I want to explicitly call validation framework of struts from web service. Please Help --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ - 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: Struts and arabic encoding
hi, i can't believe that the problem is solved, i tried every thing as you all know but my last hope was to install a fresh windows and believe what after i had installed the application worked fine with the filter class i don't know how. but it is done thanks all of you for helping me that was really important thanks again, regards, Ahmed -- View this message in context: http://www.nabble.com/Struts-and-arabic-encoding-tf4251427.html#a12133955 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ajax File Upload
Hi There, i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and (since my last mail to this list) redirects to a result jsp. But the Browser only shows [object HTMLDocument] inside the targets div instead of the result page. My Code. s:form action=uploadPicture.action method=POST enctype=multipart/form-data File(1): s:file name=upload accept=image/*/br File (2): s:file name=upload accept=image/*/br File (3): s:file name=upload accept=image/*/br s:a theme=ajax targets=aTargetDiv executeScripts=false upload/s:a /s:form s:div id=aTargetDiv /s:div . xml config: action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewUploadResult.jsp/result /action result page: ... html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleView Result/title /head body br upload finished br /body /html Thanks a lot for any help, Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to know if an element of a list belongs to another list using Struts2 tags?
fergunet wrote: Hi all! I'm iterating over two list, and I need to shown if an element of the second list belongs to the first. Something like that: iterator list1 print list1.actualElement.attributes... iterator list2 if list2.element == list1.actualElement print yes else print no The problem is that I only want to print ONE yes or not not all of them. It exists any tag like s:belongs value=myList element=theElement or something? Or I should create an external variable _belongs and set to true if the element is found (like the standard search procedure we learnt years ago when we were rookies in programming ; ) Thank you in advance, and like always, sorry about my English. Perhaps an OGNL expressionn along the lines of %{list2.contains(list1_item)} would do what you want. Something like s:if test=%{list2.contains(list1_item)} yes /s:if s:else no /s:else L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax File Upload
The result is returned to another iframe. You need to do something like this to get it working. http://www.mail-archive.com/user@struts.apache.org/msg60245.html Jan Steinke wrote: Hi There, i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and (since my last mail to this list) redirects to a result jsp. But the Browser only shows [object HTMLDocument] inside the targets div instead of the result page. My Code. s:form action=uploadPicture.action method=POST enctype=multipart/form-data File(1): s:file name=upload accept=image/*/br File (2): s:file name=upload accept=image/*/br File (3): s:file name=upload accept=image/*/br s:a theme=ajax targets=aTargetDiv executeScripts=false upload/s:a /s:form s:div id=aTargetDiv /s:div . xml config: action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewUploadResult.jsp/result /action result page: ... html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleView Result/title /head body br upload finished br /body /html Thanks a lot for any help, Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/ajax-File-Upload-tf4263655.html#a12134235 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RE [S2] autowiring with hand rolled factory
Um, to allow all the capabilities of Spring (dependency injection, AOP or whatever) to be applied to action instances? L. Adam Hardy wrote: Thanks for the explanation. What would you say the main rationale is then for using Spring as a factory for the actions instead of the struts objectfactory? Regards Adam [EMAIL PROTECTED] on 13/08/07 08:13, wrote: Did you set this in your struts.xml ? constant name=struts.objectFactory value=spring / or constant name=struts.objectFactory value= org.myorg.mySpringContextFactory / For Autowiring, it's enable by default. But you can customise it : http://struts.apache.org/2.0.9/docs/spring-plugin.html The framework enables autowiring by default. (Autowiring means to look for objects defined in Spring with the same name as your object property). To change the wiring mode, modify the spring.autowire property. Wiring Mode struts.objectFactory.spring.autoWire = type The autowire property can be set to several options. name Auto-wire by matching the name of the bean in Spring with the name of the property in your action. This is the default type Auto-wire by looking for a bean registered with Spring of the same type as the property in your action. This requires you to have only one bean of this type registered with Spring auto Spring will attempt to auto-detect the best method for auto-wiring your action constructor Spring will auto-wire the parameters of the bean's constructor By default, the framework will at least try to use Spring to create all its objects. If the object cannot be created by Spring, then the framework will create the object itself. Adam Hardy [EMAIL PROTECTED] 12/08/2007 11:25 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A Struts Users Mailing List user@struts.apache.org cc Objet [S2] autowiring with hand rolled factory I'm sure I saw some references to this in the documentation before but I can't find it again now that I need it. I have my own context factory for Spring which I want to plug into the struts framework, but I can't work out how to set up the autowiring interceptor . It seems I must replace ActionAutoWiringInterceptor and configure it as 'anotherAutowiring' or similar. Would that be correct? While I'm on the subject, I'm not planning on setting up my actions in Spring, so I assume that struts2 will use its own ObjectFactory to do this. What is the reasoning behind the functionality that allows me to set up my actions in Spring? Is it just the rich configuration possibilities that Spring offers which struts wants to harness? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax File Upload
That's a little bit strange, does it happen on FF and IE? Does it happen even if you return just an HTML fragment? (instead of the whole page) musachy On 8/13/07, Jan Steinke [EMAIL PROTECTED] wrote: Hi There, i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and (since my last mail to this list) redirects to a result jsp. But the Browser only shows [object HTMLDocument] inside the targets div instead of the result page. My Code. s:form action=uploadPicture.action method=POST enctype=multipart/form-data File(1): s:file name=upload accept=image/*/br File (2): s:file name=upload accept=image/*/br File (3): s:file name=upload accept=image/*/br s:a theme=ajax targets=aTargetDiv executeScripts=false upload/s:a /s:form s:div id=aTargetDiv /s:div . xml config: action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewUploadResult.jsp/result /action result page: ... html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleView Result/title /head body br upload finished br /body /html Thanks a lot for any help, Jan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
displaying items in different colors in a s:select tag
Hi, Is there a way, with the current version of struts 2, to use a conditional statement to color code elements that are displayed in a s:select tag. By this, I mean that if I have items in my list that are 4, then they're red, and if they are = 4, then they are blue. Obviously, this is not the conditional statement that I would want to use, but it gives an idea of what I'm looking for. So for the super creative minds out there, here's a small nutcracker ;). Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax File Upload
FF and IE. Doesn't make a difference using a jsp or a jspf as result. I'm getting still a [object HTMLDocument] in my div. Jan Musachy Barroso schrieb: That's a little bit strange, does it happen on FF and IE? Does it happen even if you return just an HTML fragment? (instead of the whole page) musachy On 8/13/07, Jan Steinke [EMAIL PROTECTED] wrote: Hi There, i've implemented an Ajax FileUpload using struts 2.0.9. Works fine and (since my last mail to this list) redirects to a result jsp. But the Browser only shows [object HTMLDocument] inside the targets div instead of the result page. My Code. s:form action=uploadPicture.action method=POST enctype=multipart/form-data File(1): s:file name=upload accept=image/*/br File (2): s:file name=upload accept=image/*/br File (3): s:file name=upload accept=image/*/br s:a theme=ajax targets=aTargetDiv executeScripts=false upload/s:a /s:form s:div id=aTargetDiv /s:div . xml config: action name=uploadPicture class=actions.UploadPictureAction method=upload result name=inputuploadPictureForm.jsp/result resultviewUploadResult.jsp/result /action result page: ... html head meta http-equiv=Content-Type content=text/html; charset=UTF-8 titleView Result/title /head body br upload finished br /body /html Thanks a lot for any help, Jan - 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: RE [S2] autowiring with hand rolled factory
Um? It's not obvious what the rationale is, I assure you. Of course the Spring object factory is feature rich, but which particular features was it? Or perhaps the lack of obviousness is just an artifact of the way I have learnt the ropes of Struts2. It seems like struts2 says: 1: here's struts.xml where you configure your actions 2: here's an autowiring interceptor and it uses Spring to grab dependencies for your actions 3: by the way, if you want to list all your actions in Spring as well as in struts.xml, it's kind of cool. Of course at point 3 I immediately think, why would I want to do that again? Can't I save myself the effort of doing it twice? I guess I'm expecting an attribute on the action node that would define an object factory reference where the action bean would be found, instead of a class. Laurie Harper on 13/08/07 22:11, wrote: Um, to allow all the capabilities of Spring (dependency injection, AOP or whatever) to be applied to action instances? L. Adam Hardy wrote: Thanks for the explanation. What would you say the main rationale is then for using Spring as a factory for the actions instead of the struts objectfactory? Regards Adam [EMAIL PROTECTED] on 13/08/07 08:13, wrote: Did you set this in your struts.xml ? constant name=struts.objectFactory value=spring / or constant name=struts.objectFactory value= org.myorg.mySpringContextFactory / For Autowiring, it's enable by default. But you can customise it : http://struts.apache.org/2.0.9/docs/spring-plugin.html The framework enables autowiring by default. (Autowiring means to look for objects defined in Spring with the same name as your object property). To change the wiring mode, modify the spring.autowire property. Wiring Mode struts.objectFactory.spring.autoWire = type The autowire property can be set to several options. name Auto-wire by matching the name of the bean in Spring with the name of the property in your action. This is the default type Auto-wire by looking for a bean registered with Spring of the same type as the property in your action. This requires you to have only one bean of this type registered with Spring auto Spring will attempt to auto-detect the best method for auto-wiring your action constructor Spring will auto-wire the parameters of the bean's constructor By default, the framework will at least try to use Spring to create all its objects. If the object cannot be created by Spring, then the framework will create the object itself. Adam Hardy [EMAIL PROTECTED] 12/08/2007 11:25 Veuillez répondre à Struts Users Mailing List user@struts.apache.org A Struts Users Mailing List user@struts.apache.org cc Objet [S2] autowiring with hand rolled factory I'm sure I saw some references to this in the documentation before but I can't find it again now that I need it. I have my own context factory for Spring which I want to plug into the struts framework, but I can't work out how to set up the autowiring interceptor . It seems I must replace ActionAutoWiringInterceptor and configure it as 'anotherAutowiring' or similar. Would that be correct? While I'm on the subject, I'm not planning on setting up my actions in Spring, so I assume that struts2 will use its own ObjectFactory to do this. What is the reasoning behind the functionality that allows me to set up my actions in Spring? Is it just the rich configuration possibilities that Spring offers which struts wants to harness? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How exactly It happens !!!!!!!
Hi Prashant I recomend you to read the starting guide, it comes with the struts bundle and explains everything you've asked, you can read it online here: http://struts.apache.org/1.3.9/userGuide/index.html On 8/13/07, Prashant Baviskar [EMAIL PROTECTED] wrote: Hi, I am new to struts. Can any one explains when we submit the form, How the struts-config.xml is read, How form bean is populated, How validator plug-in is read from deployment descriptor. How validation is performed how execute method gets called. Question indicated with arrow are more important. As I want to explicitly call validator framework of struts (Without using struts framework web/app server). I want to know the classes in struts framework which are responsible for this --Thanks Regards Prashant Baviskar http://www.patni.com World-Wide Partnerships. World-Class Solutions. _ This e-mail message may contain proprietary, confidential or legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify us immediately at [EMAIL PROTECTED] and delete this mail. _ -- Nada fija tan intensamente una cosa a la memoria como el deseo de olvidarla. (Michel de Montaigne) http://yayocaturas.blogspot.com/
Re: Preventing validation when form is first displayed
I use to have a loadAction for each page and the real action to post to... Maybe I didn't catch the problem, do you use that scheme? On 8/13/07, Session A Mwamufiya [EMAIL PROTECTED] wrote: Hi, I have an action that is validateable and uses the validate method to ensure that an element isn't added to the database if it already exists in there. Unfortunately, the validation occurs as soon as my form is launched. I tried to follow the approach from the helloworld example to not have this happen, but it doesn't work. I would rather avoid using annotations for maintainability reasons. Would someone give me directions to how to stop validation from occurring when the form is launched. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nada fija tan intensamente una cosa a la memoria como el deseo de olvidarla. (Michel de Montaigne) http://yayocaturas.blogspot.com/
Re: Preventing validation when form is first displayed
I simply configured my default set of interceptors as follows: interceptor-ref name=validation param name=excludeMethods execute /param /interceptor-ref interceptor-ref name=workflow param name=excludeMethods execute /param /interceptor-ref This makes sure that the validation doesn't occur when the action is initially fired. You can add more methods to the list if you'd like to. Session I use to have a loadAction for each page and the real action to post to... Maybe I didn't catch the problem, do you use that scheme? On 8/13/07, Session A Mwamufiya [EMAIL PROTECTED] wrote: Hi, I have an action that is validateable and uses the validate method to ensure that an element isn't added to the database if it already exists in there. Unfortunately, the validation occurs as soon as my form is launched. I tried to follow the approach from the helloworld example to not have this happen, but it doesn't work. I would rather avoid using annotations for maintainability reasons. Would someone give me directions to how to stop validation from occurring when the form is launched. Thanks, - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Nada fija tan intensamente una cosa a la memoria como el deseo de olvidarla. (Michel de Montaigne) http://yayocaturas.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Doubled requests in TabbedPane
Hi Thanks for your mail. Musachy Barroso schrieb: I logged this ticket: https://issues.apache.org/struts/browse/WW-2106 so we could have a parseContent attribute to control this behavior. This is a good idea in my opinion. Probably you could also include 'extractContent'. :-) regards musachy On 8/12/07, Musachy Barroso [EMAIL PROTECTED] wrote: Although I think this 'remote div' feature is very interesting, I don't think it is usable for real or more complex applications in this state of developing... as a standalone tag or with the tabbedpanel? Hm... I only used it with the tabbedpanel. Cannot say much about the standalone usage. But I don't think it will behave much different there, the performance penalty is just to much for most websites (if you want to display complex content). I do not know much about the inner working of dojo, but I think the answer is somewhere there. Spending about half a minute to update some links (in my case) in a website of less than 20Kbyte size is not very efficient. Maybe I'm wrong and this is the best possible implementation... Anyway, if we could use this 'parseContent' flag it should be better. At least the documentation should have a notice of this. it has experimental tags all over the place. hehe, so there should be 'experimental', 'a little bit experimental', 'more experimental' and 'do not use this feature - experimental' ...just kidding... ;-) (the last one is copyright by Cisco) -- Sebastian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[s2] WARNings from OgnlUtil during normal use of redirect-action result
Hi I believe I'm using the redirect-action result type in the recommended way, but I'm seeing warnings from OgnlUtil in my log4j logs. Is there a way to avoid the warnings, short of adjusting log4j.xml? The stack traces are very deep, so they spam the logs. But I don't really want to exclude all warnings from OgnlUtil from my logs, because I want the application to be as easy to maintain as possible. The current exception is correct: there is no property 'pageName' on 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. I want the 'pageName' parameter passed as a parameter to the next action. The struts documentation at http://struts.apache.org/2.x/docs/redirect-action-result.html suggests that my struts config file is following the correct usage to achieve this effect. Here's a snippet from my struts.xml: action name=savePagePart5 class=com.zzz.actions.SaveApplicationAction result name=success type=redirect-action param name=actionNameviewPage.action/param param name=pageName${page.nextPage}/param /result /action And an excerpt from the resulting stack trace: [2007-08-09 12:41:40,246] WARN [SocketListener0-0] com.opensymphony.xwork2.util.OgnlUtil:369 - Caught OgnlException while setting property 'pageName' on type 'org.apache.struts2.dispatcher.ServletActionRedirectResult'. ognl.NoSuchPropertyException: org.apache.struts2.dispatcher.ServletActionRedirectResult.pageName at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:132) at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(O gnlValueStack.java:68) at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656) at ognl.ASTProperty.setValueBody(ASTProperty.java:101) at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177) at ognl.SimpleNode.setValue(SimpleNode.java:246) at ognl.Ognl.setValue(Ognl.java:476) at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186) at com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java: 360) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76) at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:49) at org.apache.struts2.impl.StrutsObjectFactory.buildResult(StrutsObjectFact ory.java:95) at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActi onInvocation.java:195) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultAct ionInvocation.java:342) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvo cation.java:253) .. at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245 ) at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) Cheers! Dave This e-mail and any attachments to it (the Communication) is, unless otherwise stated, confidential, may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any of its related entities including ANZ National Bank Limited (together ANZ). ANZ does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Conditional validation
I'm still wondering how to do a pure flag check alone using validators - i.ei need to check a guard expression before firing actual validations on the field ; and if the guard expression fails - the validations must simply be skipped (as if the field didn't exist) and move on to next page - without showing any error message. This is somewhat similar to shortcircuiting, but shortcircuit looks for the presence of errors to stop remaining validators - and in the scenario i described , it's not really an error, but a guard condition. -Joseph On 8/13/07, mraible [EMAIL PROTECTED] wrote: I haven't tried working with Struts 2's annotations for validation yet, so I'm unable to answer this question. In a week, things might be different. ;-) Matt strutstwouser wrote: Hi Matt, Can you please tell me what's needed to use this validator using annotations alone? . Also, i need a simple conditional validator - ie a field needs to be validated only if a prerequisite condition is satisfied, else the validations on it must be skipped and no error must be added (since this is just a condition check). Example : if appname is to be validated only if appid 100, i will give the inverse expression in ConditionalFieldValidator with shortCircuit true and the subsequent validations below it ; assumption being if the first condition becomes true (i.e prerequisite not satisfied), then dont validate further. The annotation i need would look like : @ConditionalFieldValidator(fieldName = app.appname, expression = app.appid 100, message = , shortCircuit=true) @StringLengthFieldValidator(fieldName = app.appname message = App Name must be gt 5 chars, minLength = 5, maxLength = 12) I don't know how to make Struts 2 see this custom validator. Thanks, Joseph mraible wrote: I figured out how to do this - posting here so others will benefit. 1. Create a new ConditionalVisitorFieldValidator.java: public class ConditionalVisitorFieldValidator extends VisitorFieldValidator { private String expression; public void setExpression(String expression) { this.expression = expression; } public String getExpression() { return expression; } /** * If expression evaluates to true, invoke visitor validation. * @param object the object being validated * @throws ValidationException */ public void validate(Object object) throws ValidationException { if (validateExpression(object)) { super.validate(object); } } /** * Validate the expression contained in the expression paramter. * @param object the object you're validating * @return true if expression evaluates to true (implying a validation failure) * @throws ValidationException if anything goes wrong */ public boolean validateExpression(Object object) throws ValidationException { Boolean answer = Boolean.FALSE; Object obj = null; try { obj = getFieldValue(expression, object); } catch (ValidationException e) { throw e; } catch (Exception e) { // let this pass, but it will be logged right below } if ((obj != null) (obj instanceof Boolean)) { answer = (Boolean) obj; } else { log.warn(Got result of + obj + when trying to get Boolean.); } return answer; } } 2. Add it to your validators.xml: validator name=conditionalvisitor class=com...validation.ConditionalVisitorFieldValidator/ 3. Write your validation rule: field name=colleaguePosition field-validator type=fieldexpression short-circuit=true reason == 'colleague' and colleaguePositionID == '_CHOOSE_' messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator field-validator type=conditionalvisitor reason == 'colleague' and colleaguePositionID == 'OTHER' message/ /field-validator /field Hope this helps, Matt mraible wrote: I need to do something similar - is it possible to have conditional visitor validation in Struts 2? AFAICT, it isn't. Basically, I'd like to have a couple of validation rules for a drop-down. One rule is that the user must select at least one choice when the drop-down has its radio button selected: field-validator type=fieldexpression short-circuit=true reason != 'partner' or (reason == 'partner' and partnerPositionID != '_CHOOSE_') messageYou must choose a position where you worked with this person, or choose Other.../message /field-validator This works. Now I want to require a number of fields if the person selects the Other... option. The validation syntax starts to get complicated at this point. I'd like to do something like:
Re: Dynamic Tree Example
We do try to tag the examples that are broken, in the hope that someone will someday fix them. I just didn't realize that this one wasn't working the way it should. The Showcase could use a lot of work, especially in terms of explaining exactly what the example should do. If you can fix the example, please submit a patch. Otherwise, feel free to open a JIRA ticket suggesting that the example be tagged as broken for the next release. -Ted. On 8/13/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Do you think leaving known broken code on the Showcase is a good idea realizing developers are flocking to this resource to figure out how to do things? If it is known not to work, maybe it should say this or be removed from the Showcase! On 8/10/07, Musachy Barroso [EMAIL PROTECTED] wrote: Yes the example had several problems on 2.0.x, some of them were fixed, others are still there. musachy On 8/10/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm studying the dynamic tree example in the showcase, and there are a couple problems. First, when you view sources, the configuration for the dynamicTreeSelectAction is not visible. Also, as I inspect this action, I'm discovering that its dynamicTreeSelect.jsp never displays the node selected! Is this example not finished? -- Scott [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Scott [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]