[ANN] Java Web Parts Beta 5
After a few months off, the Java Web Parts (JWP) team is proud to announce the release of beta 5! The most notable change is that the taglib formerly known as AjaxTags is now known as the AjaxParts Taglib, or APT for short. Not only is the name different, but the taglib has been essentially rewritten and is now easier and yet more powerful than ever... If a declarative approach to AJAX that doesn't require you to know a bit of Javascript (unless you want to get into it) sounds good to you, now is a great time to check out what APT has to offer! There are other additions as well, and as always, JWP provides a number of useful parts, such as servlets, filters, taglibs, utility classes, and so forth. Things like getting the size of a session object, a powerful CoR implementation, filters to limit concurrent sessions, guard against XSS exploits and disallow app access during defined time windows, a class to make application configuration simple, a servlet to dynamically render a text of string as an image, a taglib that renders very handy Javascript functions, some GUI widgets... all of this can be found in JWP, and plenty more! If this sounds interesting to you, have a look: http://javawebparts.sourceforge.net And for you Maven folks, JWP can now be found in the iBiblio repo! (beta4 at this point only though) Thanks, and have a great day! Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] 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: Quick question about the Resources.properties files.
Using html:submit still gives me the same result :( Den 6/30/2006, skrev Emmanouil Batsis [EMAIL PROTECTED]: Fredrik Andersson wrote: ohh ok, didn't think of that. however, when I tried it the text fell out of the button (it says Submit Query) and sits besides it. I did this, smc:submit bean:message key='admin.ny.abort' / /smc:submit smc:submit is an extension of the strutstag library. What happens if you use an html:submit instead? That would show whether it is a problem in the smc:submit tag. Manos - 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]
Anti-piracy software
Hi All, I would like to know if any anti-piracy tools available opensource that can prevent illigal use of web related software like a struts application. regards, Nagesh The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com
EJB 3.0 out-of-the-container support with struts or shale
the ejb 3.0 specifivation is done standard! does anyone get successful support for an struts or shale project using ejb 3.0. glassfish reference implementation works only with vm argument -javaagent - but is this maybe possible to combine with webframeworks ala struts or shale. important is that it is out of the container - only using ejb3.0 implementation libaries and it is possibly from controller side using ejb 3.0 for persistence. is this impossible? it shouldn't, but no solution found, yet. stephan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts and Hibernate
Hello, I'm working on struts and hibernate. J'ai une tache qui est affectée à un utilisateur. I have a Actionform named Task. Private Integer code ; Private String codeus ; // Login of user Private String libelle; I have also a POJO Task. Private Integer code; Private User user; // Many-to-one relation with user Class. Private String libelle; And I have a action class which gets back my user's list to show it in a combobox in my jsp when i create a task. Code : html:select property=codeus html:options property=codeus collection=lesUtilisateurs labelProperty=nom /html:select The code above allows me to show a comobox with the names of my users. The parameter sent to get back the user is codeus. Up to there, it works. After recording in my database, my problem is to show the user allocated to the task in modify.jsp. If i do Code : html:select property=codeus name=tache html:options property=codeus collection=lesUtilisateurs labelProperty=nom /html:select my user recording in database is not selected by default. If I do html:select property=utilisateur.codeus name=tache html:options property=codeus collection=lesUtilisateurs labelProperty=nom /html:select My user is selected, but the actionform doesn't recognize my attribute utilisateur.codeus because it wants codeus Does it mean that my actionform must have utilisateur.codeus as attribute ? Thanks for your help. David Douillard Mairie de Niort Direction des Systèmes d'Informations et de télécommunications Tél : 05.49.78.74.47 Fax : 05.49.78.73.73 http://www.vivre-a-niort.com http://www.vivre-a-niort.com/
Re: Anti-piracy software
if you are developing a commercial struts application, than best prevention would be not to publish your source code. leon On 7/3/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi All, I would like to know if any anti-piracy tools available opensource that can prevent illigal use of web related software like a struts application. regards, Nagesh The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Strtus and Portlets
Hi all, I am about to develop a new struts app that will be ported afterwards to be used in a portlet and I plan to use the struts bridge support. I want to try and ensure that I don't break the bridge with my normal conceptual design before I start building anything. The pattern I use is to break up processing of the request from the display of the next page and to handle a form that has multiple submit buttons that need to perform different actions (yes that good old problem) I usually implement this pattern in struts-config to separate out concerns: 1) Page always calls a redirect action that takes the submitaction attribute in the form and finds the forward using the submitaction as the key. 2) The process action then processes the request and on success calls a display action to render the next page 3) The display action finally calls a go action that is the simple redirect to the JSP action path=/logon_redirect name=logonForm type=org.xxx.RelayAction scope=request validate=false forward name=logon path=/process_logon.ask/ forward name=cancel path=/go_welcome.ask/ /action action path=/process_logon name=logonForm type=org.xxx.LogonAction scope=request input=/go_logon.ask validate=true forward name=success path=/display_briefcase.ask/ /action action path=/display_briefcase name=briefcaseForm type=org.xxx.GetBriefcaseAction scope=request validate=false forward name=success path=/go_briefcase.ask/ /action action path=/ go_briefcase.ask forward=/jsp/briefcase.jsp /action This is obviously action chaining and I'm aware that this can cause issues in portlets and the bridge due to the separation of ActionRequests and ActionResponse interfaces. I have read the website and if I'm reading correctly the bridge would separate ActionRequests from ActionResponse processing on the first action forward, in this case on my redirect meaning the process would be part of the render which is not what I want. Am I correct or will the above work OK? What changes may I have to make to ensure I integrate with the bridge seamlessly? Regards Andy Foster - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing Role Access to Actions on the Fly
I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing Role Access to Actions on the Fly
I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph [EMAIL PROTECTED] wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Want to be your own boss? Learn how on Yahoo! Small Business.
Re: Struts and AJAX
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Can I use struts with AJAX. Does struts has classes and tags for AJAX or do I have write my own code. i have used: * http://dojotoolkit.org/ with struts recently. I like this very much although this does not consist of taglibs but of pure javascript. Cheers -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEqOHrkv8rKBUE/T4RAgzXAJ0chM3rJm2+8twqk6gO+yYpLFsHRwCeNvxQ ZGRlnn/LUQvluRLV4JVT/Tk= =dTJF -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Changing Role Access to Actions on the Fly
Hi, Some time ago I was looking for an answer on the same question :) Here is how I solved this issue. 1) All request goes though SecurityFilter (www.sf.net) 2) Wrapped original request with this one public class SecurityRequestWrapper extends org.securityfilter.filter.SecurityRequestWrapper { public static final char SESSION_ROLE_KEY='@'; public static final String USER_INFO=userInfo; public SecurityRequestWrapper(HttpServletRequest arg0, SavedRequest arg1, SecurityRealmInterface arg2, String arg3) { super(arg0, arg1, arg2, arg3); } public boolean isUserInRole(String roleName) { if(roleName.charAt(0)==SESSION_ROLE_KEY){ SecurityFilterPrincipal principal=(SecurityFilterPrincipal)getUserPrincipal(); String roleKey=(String)getSession().getAttribute(String.valueOf(SESSION_ROLE_KE Y)); if(principal!=null roleKey!=null){ Map roleMap=principal.getRoleMap(); List roles=(List)roleMap.get(roleKey); if(roles!=null){ StringTokenizer tokenizer=new StringTokenizer(roleName.substring(1),,); while(tokenizer.hasMoreTokens()){ if(roles.contains(tokenizer.nextToken())) return true; } } } return false; } return super.isUserInRole(roleName); } } and modified doFilter method to use my Request Object ... doFilter(...){ HttpServletRequest hReq = (HttpServletRequest) request; HttpServletResponse hRes = (HttpServletResponse) response; SecurityRequestWrapper wrappedRequest; ... (the rest is coppied from SecurityFilter sources) } 3) Created Principal interface implementation in SecurityFilterPrincipal object with map property holding all userRoles public class SecurityFilterPrincipal implements Principal,Serializable { private String name=null; private HashMap roleMap=null; //roleMap[key]=ArrayList(roles) .. (just create getter and setters for properties) } 4) Implemented SecurityRealmInterface interface public class JDBCSecurityFilterRealm implements SecurityRealmInterface { .. (find the source of this class in SecurityFilter) .. change the login function to reflect your situation (here I load all user roles but into my Principal's roleMap property) } 5) The most important in all of this is implementation of isUserInRole function (SecurityRequestWrapper object). The way you check your roles there are up to you. In my case I put into the session some indicator telling me which key in the rolesMap is the active one. In this way although I'm not dynamically removing roles I switch them accordingly to the situation. Hope it's what you want. -Original Message- From: Paul Benedict [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 11:18 AM To: Struts Users Mailing List Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph [EMAIL PROTECTED] wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User
[OT ]Frame collapse--please helppp
Hi all, I know this is not the list for this question. However, there are so many knowledgeable people out there in this list. I hope to get some help. I have the following frameset in my application. I need to collapse expand my frame named as menu on click of a button. I have tried it with this script: function hideframe() { if (document.hideshow.view.value == '') { alert('In the if part'); window.top.frames['thirdframeset'].document.body.cols=0,*; alert('In the frames'); document.hideshow.view.value = ''; } else { alert('In the else part'); window.top.frames['thirdframeset'].document.body.cols=300,*; document.hideshow.view.value = ''; } } however, it hides the frame but the wrong one then does not unhide the right frame. html head /head frameset rows=28,* border=0 id=firstframeset frameborder=0 frame name=header scrolling=no src=Header.htm frameset cols=300,* id=secondframeset frameset rows=49,* border=0 id=thirdframeset frame name=sidetab scrolling=yes src=SideTab.htm frame name=menu scrolling=yes src=Menu.htm /frameset frameset rows=24,25,94,*,327 border=0 id=fourthframeset frameborder=0 frame name=top01 scrolling=yes src=Top.htm frame name=message scrolling=yes src=AdminLabel.htm frame name=top02 scrolling=yes src=new_page_1.htm frame name=workarea scrolling=yes src=new_page_2.htm frame name=footer scrolling=yes src=Footer.htm /frameset /frameset /frameset /html Please help, Regards, MS. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing Role Access to Actions on the Fly
Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph [EMAIL PROTECTED] wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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: Changing Role Access to Actions on the Fly
Thanks Grzegorz, That looks great!!!. Well, I will have to look into that. Thanks again Thomas Joseph From: Stasica, Grzegorz [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, July 03, 2006 3:14 PM Subject: RE: Changing Role Access to Actions on the Fly Hi, Some time ago I was looking for an answer on the same question :) Here is how I solved this issue. 1) All request goes though SecurityFilter (www.sf.net) 2) Wrapped original request with this one public class SecurityRequestWrapper extends org.securityfilter.filter.SecurityRequestWrapper { public static final char SESSION_ROLE_KEY='@'; public static final String USER_INFO=userInfo; public SecurityRequestWrapper(HttpServletRequest arg0, SavedRequest arg1, SecurityRealmInterface arg2, String arg3) { super(arg0, arg1, arg2, arg3); } public boolean isUserInRole(String roleName) { if(roleName.charAt(0)==SESSION_ROLE_KEY){ SecurityFilterPrincipal principal=(SecurityFilterPrincipal)getUserPrincipal(); String roleKey=(String)getSession().getAttribute(String.valueOf(SESSION_ROLE_KE Y)); if(principal!=null roleKey!=null){ Map roleMap=principal.getRoleMap(); List roles=(List)roleMap.get(roleKey); if(roles!=null){ StringTokenizer tokenizer=new StringTokenizer(roleName.substring(1),,); while(tokenizer.hasMoreTokens()){ if(roles.contains(tokenizer.nextToken())) return true; } } } return false; } return super.isUserInRole(roleName); } } and modified doFilter method to use my Request Object ... doFilter(...){ HttpServletRequest hReq = (HttpServletRequest) request; HttpServletResponse hRes = (HttpServletResponse) response; SecurityRequestWrapper wrappedRequest; ... (the rest is coppied from SecurityFilter sources) } 3) Created Principal interface implementation in SecurityFilterPrincipal object with map property holding all userRoles public class SecurityFilterPrincipal implements Principal,Serializable { private String name=null; private HashMap roleMap=null; //roleMap[key]=ArrayList(roles) .. (just create getter and setters for properties) } 4) Implemented SecurityRealmInterface interface public class JDBCSecurityFilterRealm implements SecurityRealmInterface { .. (find the source of this class in SecurityFilter) .. change the login function to reflect your situation (here I load all user roles but into my Principal's roleMap property) } 5) The most important in all of this is implementation of isUserInRole function (SecurityRequestWrapper object). The way you check your roles there are up to you. In my case I put into the session some indicator telling me which key in the rolesMap is the active one. In this way although I'm not dynamically removing roles I switch them accordingly to the situation. Hope it's what you want. -Original Message- From: Paul Benedict [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 11:18 AM To: Struts Users Mailing List Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph [EMAIL PROTECTED] wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph
[OT][ANN] JavaONE 2006 Highlights
Hi All Here is the most recent video I uploaded to Google Video. Java ONE 2006 Highlights Days 1 http://video.google.com/videoplay?docid=4414337915180627229 If you have never been to JavaONE it will give you a rough feel of this event. Featuring: Kenneth Russell, Romain Guy (Java 2D / JOGL / Mustang SE / Flickr - Google Maps Mash-Up ) A full demonstration of the famous AERITH application (This is probably more useful for Vik Cekvenich and his RiA ideas. But if you are considering WebWork and XWork as the back-end to drive your forthcoming rich internet application with Swing as the front-end then the you might look at this, ok) Gavin King SEAM Click and Hack-it Bros (Neil Gafter and Joshua Bloch, the Java Puzzlers ) Patrick Lightbody, Jason Careirra, and Don Brown (I think this was Day 2 footage that got merged up with the Day 1 tape) Anyway this was a short section of the TS 3682 talks with the Struts Action Framework demonstration. Essentially I captured the demonstration of the WebWork Freemarker syntax theming of the WebWork tags. etc Enjoy -- Peter Pilgrim ( Windows XP / Thunderbird 1.5 ) _ ___ + Expert Java __ /_ ___ ___ ____ /__ / + Enterprise ___ _ /_ __ `/_ | / / __ `/__ __/ __ __/ + Design / /_/ / / /_/ /__ |/ // /_/ / _ /___ _ /___ + Architecture \/ \__,_/ _/ \__,_/ /_/ /_/ + Web New Age On Line Resume || \\=== `` http://www.xenonsoft.demon.co.uk/no-it-striker.html '' - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
java.lang.IllegalArgumentException: can't parse argument number
Hi all I get this message when tomcat is trying to parse my bean:message key=a.key / struts tag. In my resource file I have a key called a.key={common.a} and this seems to break. Anyone that knows why this occures and what I can do to fix it? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing Role Access to Actions on the Fly
Joseph, modifying the user's permissions (not the struts action mapping), is definitely the way to go. Your app should be able to run with any framework, and so go with the advice I gave. Also check out http://acegisecurity.org/ Paul Thomas Joseph [EMAIL PROTECTED] wrote: Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict To: Struts Users Mailing List Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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] - How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
Re: Changing Role Access to Actions on the Fly
Thanks Paul, That was a great input to my research. Now I don't have to re-invent the wheel it seems. Thanks a Bunch! Thomas Joseph - Original Message - From: Paul Benedict [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, July 03, 2006 6:23 PM Subject: Re: Changing Role Access to Actions on the Fly Joseph, modifying the user's permissions (not the struts action mapping), is definitely the way to go. Your app should be able to run with any framework, and so go with the advice I gave. Also check out http://acegisecurity.org/ Paul Thomas Joseph [EMAIL PROTECTED] wrote: Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict To: Struts Users Mailing List Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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] - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Changing Role Access to Actions on the Fly
Hi Please mind that http://acegisecurity.org/ works on Spring not Struts. There is possibility to use Struts in Spring but I don't suppose the opposite is possible :-( -Original Message- From: Paul Benedict [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 2:54 PM To: Struts Users Mailing List Subject: Re: Changing Role Access to Actions on the Fly Joseph, modifying the user's permissions (not the struts action mapping), is definitely the way to go. Your app should be able to run with any framework, and so go with the advice I gave. Also check out http://acegisecurity.org/ Paul Thomas Joseph [EMAIL PROTECTED] wrote: Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict To: Struts Users Mailing List Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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] - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Changing Role Access to Actions on the Fly
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Please mind that http://acegisecurity.org/ works on Spring not Struts. There is possibility to use Struts in Spring but I don't suppose the opposite is possible :-( I heard that JGuard could also be helpful: http://sourceforge.net/projects/jguard/ Christian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEqRpXkv8rKBUE/T4RAiO3AJ906bNiI6tO6caX6FGnzMfOENwblgCfb7Zm gog0hnEBJ3fBBWg2LGd12e0= =gSb1 -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[STRUTS] Resource bundle and form validation
I use several resource bundle for my application. The particularity is the resource bundle is depending of the user?group. Here, an extract from the struts config file : message-resources parameter=com.convergence.ressources.ressources null=false / message-resources key=angers parameter=com.convergence.ressources.angers.ressources null=false / message-resources key=angersErreurs parameter=com.convergence.ressources.angers.erreurs null=false / message-resources key=nantes parameter=com.convergence.ressources.nantes.ressources null=false / message-resources key=nantesErreurs parameter=com.convergence.ressources.nantes.erreurs null=false / plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml / /plug-in When I submit a form to be validated There is no problem to post the right message from the right resource bundle, whether the validation is on the client side (with javascript)or on the server side. But these messages to be posted contain some arguments (the names of the invalidate form fields). That?s the problem. The validation on the customer side returns arguments from the right resource bundle (the same which contains the messages to expose) due to the following tag in the JSP: html:javascript formName=frmSelection bundle=angersErreurs / The validation ont the server side returns arguments from the application resource bundle (the default resource bundle as declared at the struts config file : message-resources parameter=com.convergence.ressources.ressources null=false / However the JSP declaration is : html:errors bundle=angersErreurs/ Because of the dynamic call of the resource bundle(in the jsp examples, i hide the dynamic bundle call for more readability ), it isn't possible to specify the resource bundle on the validation.xml file as field arg0 attribute from the field field. Extract of the file validation.xml : formset form name=frmSelection field property=contexte depends=required arg0 key=frmSelection.contexte / /field field property=selection depends=required arg0 key=frmSelection.selection / /field /form Does exists a solution at this problem of behavior between server and client or is it a bug from struts? Regards Olivier Godineau -- View this message in context: http://www.nabble.com/-STRUTS--Resource-bundle-and-form-validation-tf1884718.html#a5152197 Sent from the Struts - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Form validation not happening
Hello there! I'm trying to use form validation (It was working, but somehow, I messed something and it quit working). Here are my files: struts-config.xml form-beans form-bean name=userForm type=com.acme.UserForm/form-bean /form-beans action path=/register scope=request validate=true type=com.acme.RegisterAction name=userForm input=/registerScreen.do plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in form name=userForm field property=name depends=required msg name=required key=error.nameRequired/ /field field property=email depends=required msg name=required key=error.emailRequired/ /field /form My UserForm extends ValidatorActionForm! When the user submits, instead of returning to the input page and display the errors he's redirect to the action that deals with the register. Any ideas? Best regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Anti-piracy software
Hi, you can use proguard to obfuscate your jar files. http://proguard.sourceforge.net/ El lun, 03 de 07 de 2006 a las 08:17, [EMAIL PROTECTED] escribió: Hi All, I would like to know if any anti-piracy tools available opensource that can prevent illigal use of web related software like a struts application. regards, Nagesh The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com -- ;-) Jorge Martin Cuervo Analista Programador Outsourcing Emarketplace deFacto Powered by Standards email [EMAIL PROTECTED] voz +34 985 129 820 voz +34 660 026 384
Re: Struts and AJAX
I use struts + DWR to develope ajax applications. http://getahead.ltd.uk/dwr/ El lun, 03 de 07 de 2006 a las 05:57, chamal desilva escribió: Hi, Can I use struts with AJAX. Does struts has classes and tags for AJAX or do I have write my own code. Thanking You, Chamal. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ;-) Jorge Martin Cuervo Analista Programador Outsourcing Emarketplace deFacto Powered by Standards email [EMAIL PROTECTED] voz +34 985 129 820 voz +34 660 026 384
Re: Changing Role Access to Actions on the Fly
Sure!. But the site itself mentions some workaround. Morover, thanks for all your inputs,..these can definitely provide good idea to develop the application. This bieng a new application that I am developing, Dont mind playing with all of them ;-) Thanks a lot for all your inputs. But never stop. I can appreciate more inputs. Thomas - Original Message - From: Stasica, Grzegorz [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Monday, July 03, 2006 6:46 PM Subject: RE: Changing Role Access to Actions on the Fly Hi Please mind that http://acegisecurity.org/ works on Spring not Struts. There is possibility to use Struts in Spring but I don't suppose the opposite is possible :-( -Original Message- From: Paul Benedict [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 2:54 PM To: Struts Users Mailing List Subject: Re: Changing Role Access to Actions on the Fly Joseph, modifying the user's permissions (not the struts action mapping), is definitely the way to go. Your app should be able to run with any framework, and so go with the advice I gave. Also check out http://acegisecurity.org/ Paul Thomas Joseph [EMAIL PROTECTED] wrote: Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict To: Struts Users Mailing List Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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] - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.
AW: Object field validation
Hallo all, I posted yasterday the below message. I changed my formset to: form name=TASKMANAGERform field property=taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form and now I am getting this error message: 16:55:35,332 ERROR [ValidatorAction] Unhandled exception thrown during validation: Null property value for 'taskDefinition' java.lang.IllegalArgumentException: Null property value for 'taskDefinition' I think the validator is not able to recognize taskDefinition as a property of type TaskDefinition and then get the field domian of this type. Is there any way to do such a validation? I appreciate your help :-) thanks a lot, Halgurt -Ursprüngliche Nachricht- Von: Halgurt Mustafa Ali Gesendet: Freitag, 30. Juni 2006 13:04 An: Struts Users Mailing List Betreff: AW: Object field validation Hi, Sorry, I tried that also, but it seems not to work, I am not sure if it is possible to validate fields von objects, do you mean it works? Regards, Halgurt -Ursprüngliche Nachricht- Von: Truong Xuan Tinh [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 13:05 An: Struts Users Mailing List Betreff: Re: Object field validation Try form name=TASKMANAGERform field property=taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form Hope this may help. Halgurt Mustafa Ali wrote: Hi all, I have a form called TASKMANAGERform and in this form I have a field called taskDefinition of type TaskDefinition. TaskDefinition has a field domain of type Integer. Is it possible to validate this field? I meen to validate taskDefinition.domain? If aes, in which way? I have tried this: form name=TASKMANAGERform field property=TASKMANAGERform.taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form but it doesn`t work.. Many Thanks, Halgurt -Ursprüngliche Nachricht- Von: Jorge Martín Cuervo [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 10:33 An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: AW: xhtml-mobile with Struts? thank. It looks good pretty! El vie, 30 de 06 de 2006 a las 10:14, Martin Kindler escribió: Sorry for that! I sent the wrong URL (normally a Typo3/PHP-page is in front of the main Struts-app, so to force XHTML MP I have to skip the T3 part). The correct one is: http://www.cityexperience.net/cxpCat/Welcome.do?ua=MOBILE Martin -Ursprüngliche Nachricht- Von: Jorge Martín Cuervo [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 09:33 An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: AW: xhtml-mobile with Struts? El vie, 30 de 06 de 2006 a las 09:12, Martin Kindler escribió: I do not know, if there is a tool for XHTML MP, but we have done our mobile site with ordinary Struts and a set of XHTML MP JSPs. Very easy. If you want to look: http://www.cityexperience.net/ http://www.cityexperience.net/. If you do use a normal browser and would like to see the mobile version, start at http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE. this link doesn't work: HTTP Status 404 - /pages//catalog.jsp (Sorry, only German at this moment). Martin -Ursprüngliche Nachricht- Von: Jose Benjamin Perez Soto [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 08:16 An: user@struts.apache.org Betreff: xhtml-mobile with Struts? Hello! Good, my question is, if there is some tool to work with xhtml-mobile with the Struts, like the one of wml, but I need is something for xhtml-mobile. cheers, Ben - 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: java.lang.IllegalArgumentException: can't parse argument numb er
Fredrik, The property value of {common.a} is causing the problem b/c the java.text.MessageFormat class is used to to parameter replacements in the message. Are you trying to use the literal string '{common.a}' as the value of the key? If so, you need to escape the '{' and '}' characters. -Richard -Original Message- From: Fredrik Andersson [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 4:40 AM To: Struts Users Mailing List Subject: java.lang.IllegalArgumentException: can't parse argument number Hi all I get this message when tomcat is trying to parse my bean:message key=a.key / struts tag. In my resource file I have a key called a.key={common.a} and this seems to break. Anyone that knows why this occures and what I can do to fix it? - 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 AJAX
Hey, I use DWR + dojo to use AJAX with struts: http://getahead.ltd.uk/dwr/ http://dojotoolkit.com/ Although dojo has some flashy widgets and stuff, its power is the dojo.io.bind() function: http://dojotoolkit.org/docs/intro_to_dojo_io.html Here is an example of using Struts Actions with bind(): html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=# onclick=submitNewMail();SUBMIT/a /html:form NOTE: form has been given a 'styleId' and using logic:messagesPresent to display errors in form function submitNewMail(){ //validateNewMail(form); var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data, evt){ alert(An error occurred submitting new mail: + data); }, load: function(type, data, evt){ DWRUtil.setValue(social_mail_right_con, data);/* setValue doesn't execute javascript! */ document.getElementById('social_popup_layer_container').innerHTML=document.getElementById('ajax_hidden_helper').innerHTML; popup('social_popup_layer_container',true); }, mimetype: text/html, formNode: document.getElementById(compose_mail_form) }; dojo.io.bind(bindArgs); } NOTE: 1) the use of html:rewrite / for the 'url' 2) formNode is the 'styleId' of your html:form / 3) the stuff you see in the load function is application specific. It is how I display html:errors / and html:messages / in a backwards-compatible manner for AJAX. I basically force the reloading of a JSP (tile) that has the code: html:errors / and relevant logic. Ok, now for the good stuff: 1) Yes, your ActionForm will work as usual. If it is invalid, errors are displayed. If it validates, it goes on to the Action. 2) The action MUST RETURN NULL, otherwise the page will reload to your forward 3) You write your output to the response object in your action. Remember when it was just servlets? public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { //Make ActionMessages for business logic errors... ActionMessages messages = new ActionMessages(); HttpSession session = request.getSession(); MyForm f = (MyForm)form; response.setContentType(text/html); PrintWriter out = response.getWriter(); out.print(ACTION_SUCCESS:Message Sent!); out.close(); //return(mapping.findForward(success)); NOT AJAX WAY! return(null); } There are many ways to handle the repsonse stuff with AJAX + STRUTS. Use your imagination. In this instance I just have a javascript function parse the output. You could return HTML and use innerHTML(). You could parse a string like: FORWARD:my_action_name. You could have: JAVASCRIPT-FUNCTION:handleSuccess(). I often use dojo.io.bind() in conjunction with DWR.setValue(): http://getahead.ltd.uk/dwr/browser/util/setvalue or using DWR to forward to a JSP: http://getahead.ltd.uk/dwr/examples/text Bottom line is that javascript will handle the forwarding instead of you struts config. If some has a way to do it with the config, I'd love to hear from you. BTW - I took the time to write this because after all the reading and searching I did, I still didn't have a clue how to use all this stuff together. I hope this helps everyone. -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: chamal desilva [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: user@struts.apache.org Subject: Struts and AJAX Date: Sun, 2 Jul 2006 20:57:52 -0700 (PDT) Hi, Can I use struts with AJAX. Does struts has classes and tags for AJAX or do I have write my own code. Thanking You, Chamal. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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: Struts and AJAX
I'm a big fan of DWR as well, it's a very worthy alternative. But, I don't mind a little self-promotion, so... how does this strike you? ... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton requestHandler type=std:QueryString target=/process_new_mail.do parameterto=to/parameter responseHandler type=std:Alerter parameter / /element /group /ajaxConfig Then, in your JSP: html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=#SUBMIT/aajax:event ajaxRef=MyForm/SubmitButton / /html:form ajax:enable / This would result in some Action, mapped to process_new_mail.do being executed, and you would get a single parameter submitted, to, using the value of the form field to. The response from the server, whatever it is, would be displayed via alert(). This is what AjaxParts Taglib (APT) offers... you define an event in a config file, some user-initiated (usually) event that fires an AJAX request. For each event, you define a request handler, which forms the request to the server... there are a number of standard handlers, for instance, if you want to construct XML from your form, that's standard. You also define one (or more) response handlers, which is something that happens when the response comes back. Again, there are a number of standard handlers, like Alerter... there is also things like InnerHTML (populate a page element by updating innerHTML), stdXSLT (transform XML response via XSLT on client), and much more. Note that you didn't have to right ANY Javascript whatsoever! And the changes to your JSP amounts to adding an ajax:event tag to any element that will fire an AJAX event, and the ajax:enable tag at the end (plus the taglib declaration of course). Changing the AJAX functionality is as easy as modifying the config file, you wouldn't need to touch your JSP again! And, should you need to do more advanced things that the standard handlers don't cover (they should do the job probably 80% of the time or better though), there is a pretty simple mechanism for writing your own custom handlers, which you can then use just like the standard handlers. If the no coding approach sounds good, check it out further: http://javawebparts.sourceforge.net/ I suggest clicking the Javadocs link and going to the first package listed, javawebparts.ajaxparts.taglib... all the details can be found there... then, download JWP and check out the sample app for all sorts of examples of APT usage. Shill time over :) Frank draegoon Z wrote: Hey, I use DWR + dojo to use AJAX with struts: http://getahead.ltd.uk/dwr/ http://dojotoolkit.com/ Although dojo has some flashy widgets and stuff, its power is the dojo.io.bind() function: http://dojotoolkit.org/docs/intro_to_dojo_io.html Here is an example of using Struts Actions with bind(): html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=# onclick=submitNewMail();SUBMIT/a /html:form NOTE: form has been given a 'styleId' and using logic:messagesPresent to display errors in form function submitNewMail(){ //validateNewMail(form); var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data, evt){ alert(An error occurred submitting new mail: + data); }, load: function(type, data, evt){ DWRUtil.setValue(social_mail_right_con, data);/* setValue doesn't execute javascript! */ document.getElementById('social_popup_layer_container').innerHTML=document.getElementById('ajax_hidden_helper').innerHTML; popup('social_popup_layer_container',true); }, mimetype: text/html, formNode: document.getElementById(compose_mail_form) }; dojo.io.bind(bindArgs); } NOTE: 1) the use of html:rewrite / for the 'url' 2) formNode is the 'styleId' of your html:form / 3) the stuff you see in the load function is application specific. It is how I display html:errors / and html:messages / in a backwards-compatible manner for AJAX. I basically force the reloading of a JSP (tile) that has the code: html:errors / and relevant logic. Ok, now for the good stuff: 1) Yes, your ActionForm will work as usual. If it is invalid, errors are displayed. If it validates, it goes on to the Action. 2) The action MUST RETURN NULL, otherwise the page will reload to your forward 3) You write
Re: Struts and AJAX
Oops, messed up my own config file! Should be... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton event type=onclick target=/process_new_mail.do requestHandler type=std:QueryString parameterto=to/parameter /requestHandler responseHandler type=std:Alerter parameter / /responseHandler /event /element /group /ajaxConfig Frank W. Zammetti wrote: I'm a big fan of DWR as well, it's a very worthy alternative. But, I don't mind a little self-promotion, so... how does this strike you? ... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton requestHandler type=std:QueryString target=/process_new_mail.do parameterto=to/parameter responseHandler type=std:Alerter parameter / /element /group /ajaxConfig Then, in your JSP: html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=#SUBMIT/aajax:event ajaxRef=MyForm/SubmitButton / /html:form ajax:enable / This would result in some Action, mapped to process_new_mail.do being executed, and you would get a single parameter submitted, to, using the value of the form field to. The response from the server, whatever it is, would be displayed via alert(). This is what AjaxParts Taglib (APT) offers... you define an event in a config file, some user-initiated (usually) event that fires an AJAX request. For each event, you define a request handler, which forms the request to the server... there are a number of standard handlers, for instance, if you want to construct XML from your form, that's standard. You also define one (or more) response handlers, which is something that happens when the response comes back. Again, there are a number of standard handlers, like Alerter... there is also things like InnerHTML (populate a page element by updating innerHTML), stdXSLT (transform XML response via XSLT on client), and much more. Note that you didn't have to right ANY Javascript whatsoever! And the changes to your JSP amounts to adding an ajax:event tag to any element that will fire an AJAX event, and the ajax:enable tag at the end (plus the taglib declaration of course). Changing the AJAX functionality is as easy as modifying the config file, you wouldn't need to touch your JSP again! And, should you need to do more advanced things that the standard handlers don't cover (they should do the job probably 80% of the time or better though), there is a pretty simple mechanism for writing your own custom handlers, which you can then use just like the standard handlers. If the no coding approach sounds good, check it out further: http://javawebparts.sourceforge.net/ I suggest clicking the Javadocs link and going to the first package listed, javawebparts.ajaxparts.taglib... all the details can be found there... then, download JWP and check out the sample app for all sorts of examples of APT usage. Shill time over :) Frank draegoon Z wrote: Hey, I use DWR + dojo to use AJAX with struts: http://getahead.ltd.uk/dwr/ http://dojotoolkit.com/ Although dojo has some flashy widgets and stuff, its power is the dojo.io.bind() function: http://dojotoolkit.org/docs/intro_to_dojo_io.html Here is an example of using Struts Actions with bind(): html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=# onclick=submitNewMail();SUBMIT/a /html:form NOTE: form has been given a 'styleId' and using logic:messagesPresent to display errors in form function submitNewMail(){ //validateNewMail(form); var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data, evt){ alert(An error occurred submitting new mail: + data); }, load: function(type, data, evt){ DWRUtil.setValue(social_mail_right_con, data);/* setValue doesn't execute javascript! */ document.getElementById('social_popup_layer_container').innerHTML=document.getElementById('ajax_hidden_helper').innerHTML; popup('social_popup_layer_container',true); }, mimetype: text/html, formNode: document.getElementById(compose_mail_form) }; dojo.io.bind(bindArgs); } NOTE: 1) the use of html:rewrite / for the 'url' 2) formNode is the 'styleId' of your html:form / 3) the stuff you see in the load function is application specific. It is
Re: [STRUTS] Resource bundle and form validation
Support for different resource bundles in the Commons Validator DTD was added in Struts 1.2.7 and Commons Validator 1.1.4 (although I would recommend Struts 1.2.9 if you're upgrading and Validator 1.3.0). So in you validation.xml you can specify a bundle attribute on either the msg or arg element: field property=contexte depends=required msg name=required key=custom.required bundle=angersErreurs/ arg position=1 key=frmSelection.contexte bundle=angers / /field There is a bundles example page (in the validator section) in the struts-examples.war webapp which is shipped with the binary distribution. You will need to switch from using the arg0 - arg3 elements to the new arg element to take advantage of this. For example arg position=0/ is the same as arg0 and if you don't specify the position attribute then it will guess a (hopefully) sensible value. Niall On 7/3/06, Olivier Godineau [EMAIL PROTECTED] wrote: I use several resource bundle for my application. The particularity is the resource bundle is depending of the user?group. Here, an extract from the struts config file : message-resources parameter=com.convergence.ressources.ressources null=false / message-resources key=angers parameter=com.convergence.ressources.angers.ressources null=false / message-resources key=angersErreurs parameter=com.convergence.ressources.angers.erreurs null=false / message-resources key=nantes parameter=com.convergence.ressources.nantes.ressources null=false / message-resources key=nantesErreurs parameter=com.convergence.ressources.nantes.erreurs null=false / plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml, /WEB-INF/validation.xml / /plug-in When I submit a form to be validated There is no problem to post the right message from the right resource bundle, whether the validation is on the client side (with javascript)or on the server side. But these messages to be posted contain some arguments (the names of the invalidate form fields). That?s the problem. The validation on the customer side returns arguments from the right resource bundle (the same which contains the messages to expose) due to the following tag in the JSP: html:javascript formName=frmSelection bundle=angersErreurs / The validation ont the server side returns arguments from the application resource bundle (the default resource bundle as declared at the struts config file : message-resources parameter=com.convergence.ressources.ressources null=false / However the JSP declaration is : html:errors bundle=angersErreurs/ Because of the dynamic call of the resource bundle(in the jsp examples, i hide the dynamic bundle call for more readability ), it isn't possible to specify the resource bundle on the validation.xml file as field arg0 attribute from the field field. Extract of the file validation.xml : formset form name=frmSelection field property=contexte depends=required arg0 key=frmSelection.contexte / /field field property=selection depends=required arg0 key=frmSelection.selection / /field /form Does exists a solution at this problem of behavior between server and client or is it a bug from struts? Regards Olivier Godineau -- View this message in context: http://www.nabble.com/-STRUTS--Resource-bundle-and-form-validation-tf1884718.html#a5152197 Sent from the Struts - User forum 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: Object field validation
This is indicating that getTaskDefinition() from your form is returining null - so you need to ensure that the taskDefinition property is intialized first. Niall On 7/3/06, Halgurt Mustafa Ali [EMAIL PROTECTED] wrote: Hallo all, I posted yasterday the below message. I changed my formset to: form name=TASKMANAGERform field property=taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form and now I am getting this error message: 16:55:35,332 ERROR [ValidatorAction] Unhandled exception thrown during validation: Null property value for 'taskDefinition' java.lang.IllegalArgumentException: Null property value for 'taskDefinition' I think the validator is not able to recognize taskDefinition as a property of type TaskDefinition and then get the field domian of this type. Is there any way to do such a validation? I appreciate your help :-) thanks a lot, Halgurt -Ursprüngliche Nachricht- Von: Halgurt Mustafa Ali Gesendet: Freitag, 30. Juni 2006 13:04 An: Struts Users Mailing List Betreff: AW: Object field validation Hi, Sorry, I tried that also, but it seems not to work, I am not sure if it is possible to validate fields von objects, do you mean it works? Regards, Halgurt -Ursprüngliche Nachricht- Von: Truong Xuan Tinh [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 13:05 An: Struts Users Mailing List Betreff: Re: Object field validation Try form name=TASKMANAGERform field property=taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form Hope this may help. Halgurt Mustafa Ali wrote: Hi all, I have a form called TASKMANAGERform and in this form I have a field called taskDefinition of type TaskDefinition. TaskDefinition has a field domain of type Integer. Is it possible to validate this field? I meen to validate taskDefinition.domain? If aes, in which way? I have tried this: form name=TASKMANAGERform field property=TASKMANAGERform.taskDefinition.domain depends=integer arg position=0 key=TASKMANAGERform.taskDefinition.domain/ /field /form but it doesn`t work.. Many Thanks, Halgurt -Ursprüngliche Nachricht- Von: Jorge Martín Cuervo [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 10:33 An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: AW: xhtml-mobile with Struts? thank. It looks good pretty! El vie, 30 de 06 de 2006 a las 10:14, Martin Kindler escribió: Sorry for that! I sent the wrong URL (normally a Typo3/PHP-page is in front of the main Struts-app, so to force XHTML MP I have to skip the T3 part). The correct one is: http://www.cityexperience.net/cxpCat/Welcome.do?ua=MOBILE Martin -Ursprüngliche Nachricht- Von: Jorge Martín Cuervo [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 09:33 An: [EMAIL PROTECTED] Cc: 'Struts Users Mailing List' Betreff: Re: AW: xhtml-mobile with Struts? El vie, 30 de 06 de 2006 a las 09:12, Martin Kindler escribió: I do not know, if there is a tool for XHTML MP, but we have done our mobile site with ordinary Struts and a set of XHTML MP JSPs. Very easy. If you want to look: http://www.cityexperience.net/ http://www.cityexperience.net/. If you do use a normal browser and would like to see the mobile version, start at http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE http://www.cityexperience.net/cxpCat/Catalog.do?ua=MOBILE. this link doesn't work: HTTP Status 404 - /pages//catalog.jsp (Sorry, only German at this moment). Martin -Ursprüngliche Nachricht- Von: Jose Benjamin Perez Soto [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Gesendet: Freitag, 30. Juni 2006 08:16 An: user@struts.apache.org Betreff: xhtml-mobile with Struts? Hello! Good, my question is, if there is some tool to work with xhtml-mobile with the Struts, like the one of wml, but I need is something for xhtml-mobile. cheers, Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
This seems like a cleaner alternative. What about errors in the ActionForm? What about firing javascript function before the submit? I.e., to validate the form (I don't use Validator). Does the Action have to return 'null' and write directly to the response, or can the struts config still be used? -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 14:03:45 -0400 Oops, messed up my own config file! Should be... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton event type=onclick target=/process_new_mail.do requestHandler type=std:QueryString parameterto=to/parameter /requestHandler responseHandler type=std:Alerter parameter / /responseHandler /event /element /group /ajaxConfig Frank W. Zammetti wrote: I'm a big fan of DWR as well, it's a very worthy alternative. But, I don't mind a little self-promotion, so... how does this strike you? ... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton requestHandler type=std:QueryString target=/process_new_mail.do parameterto=to/parameter responseHandler type=std:Alerter parameter / /element /group /ajaxConfig Then, in your JSP: html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=#SUBMIT/aajax:event ajaxRef=MyForm/SubmitButton / /html:form ajax:enable / This would result in some Action, mapped to process_new_mail.do being executed, and you would get a single parameter submitted, to, using the value of the form field to. The response from the server, whatever it is, would be displayed via alert(). This is what AjaxParts Taglib (APT) offers... you define an event in a config file, some user-initiated (usually) event that fires an AJAX request. For each event, you define a request handler, which forms the request to the server... there are a number of standard handlers, for instance, if you want to construct XML from your form, that's standard. You also define one (or more) response handlers, which is something that happens when the response comes back. Again, there are a number of standard handlers, like Alerter... there is also things like InnerHTML (populate a page element by updating innerHTML), stdXSLT (transform XML response via XSLT on client), and much more. Note that you didn't have to right ANY Javascript whatsoever! And the changes to your JSP amounts to adding an ajax:event tag to any element that will fire an AJAX event, and the ajax:enable tag at the end (plus the taglib declaration of course). Changing the AJAX functionality is as easy as modifying the config file, you wouldn't need to touch your JSP again! And, should you need to do more advanced things that the standard handlers don't cover (they should do the job probably 80% of the time or better though), there is a pretty simple mechanism for writing your own custom handlers, which you can then use just like the standard handlers. If the no coding approach sounds good, check it out further: http://javawebparts.sourceforge.net/ I suggest clicking the Javadocs link and going to the first package listed, javawebparts.ajaxparts.taglib... all the details can be found there... then, download JWP and check out the sample app for all sorts of examples of APT usage. Shill time over :) Frank draegoon Z wrote: Hey, I use DWR + dojo to use AJAX with struts: http://getahead.ltd.uk/dwr/ http://dojotoolkit.com/ Although dojo has some flashy widgets and stuff, its power is the dojo.io.bind() function: http://dojotoolkit.org/docs/intro_to_dojo_io.html Here is an example of using Struts Actions with bind(): html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=# onclick=submitNewMail();SUBMIT/a /html:form NOTE: form has been given a 'styleId' and using logic:messagesPresent to display errors in form function submitNewMail(){ //validateNewMail(form); var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data,
Re: [STRUTS] Resource bundle and form validation
Thanks for your message. In fact, the solution you propose isn't appropriate to my problem. Because, in my application, the choice of the resource bundle depends on the user. The key of the ressource bundle is in the user session, so i can't specify it in the validation configuration file. Olivier -- View this message in context: http://www.nabble.com/-STRUTS--Resource-bundle-and-form-validation-tf1884718.html#a5156387 Sent from the Struts - User forum at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
This seems like a cleaner alternative. What about errors in the ActionForm? What about firing javascript function before the submit? I.e., to validate the form (I don't use Validator). Does the Action have to return 'null' and write directly to the response, or can the struts config still be used? -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 14:03:45 -0400 Oops, messed up my own config file! Should be... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton event type=onclick target=/process_new_mail.do requestHandler type=std:QueryString parameterto=to/parameter /requestHandler responseHandler type=std:Alerter parameter / /responseHandler /event /element /group /ajaxConfig Frank W. Zammetti wrote: I'm a big fan of DWR as well, it's a very worthy alternative. But, I don't mind a little self-promotion, so... how does this strike you? ... ajaxConfig group ajaxRef=MyForm form=compose_mail_form element ajaxRef=SubmitButton requestHandler type=std:QueryString target=/process_new_mail.do parameterto=to/parameter responseHandler type=std:Alerter parameter / /element /group /ajaxConfig Then, in your JSP: html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=#SUBMIT/aajax:event ajaxRef=MyForm/SubmitButton / /html:form ajax:enable / This would result in some Action, mapped to process_new_mail.do being executed, and you would get a single parameter submitted, to, using the value of the form field to. The response from the server, whatever it is, would be displayed via alert(). This is what AjaxParts Taglib (APT) offers... you define an event in a config file, some user-initiated (usually) event that fires an AJAX request. For each event, you define a request handler, which forms the request to the server... there are a number of standard handlers, for instance, if you want to construct XML from your form, that's standard. You also define one (or more) response handlers, which is something that happens when the response comes back. Again, there are a number of standard handlers, like Alerter... there is also things like InnerHTML (populate a page element by updating innerHTML), stdXSLT (transform XML response via XSLT on client), and much more. Note that you didn't have to right ANY Javascript whatsoever! And the changes to your JSP amounts to adding an ajax:event tag to any element that will fire an AJAX event, and the ajax:enable tag at the end (plus the taglib declaration of course). Changing the AJAX functionality is as easy as modifying the config file, you wouldn't need to touch your JSP again! And, should you need to do more advanced things that the standard handlers don't cover (they should do the job probably 80% of the time or better though), there is a pretty simple mechanism for writing your own custom handlers, which you can then use just like the standard handlers. If the no coding approach sounds good, check it out further: http://javawebparts.sourceforge.net/ I suggest clicking the Javadocs link and going to the first package listed, javawebparts.ajaxparts.taglib... all the details can be found there... then, download JWP and check out the sample app for all sorts of examples of APT usage. Shill time over :) Frank draegoon Z wrote: Hey, I use DWR + dojo to use AJAX with struts: http://getahead.ltd.uk/dwr/ http://dojotoolkit.com/ Although dojo has some flashy widgets and stuff, its power is the dojo.io.bind() function: http://dojotoolkit.org/docs/intro_to_dojo_io.html Here is an example of using Struts Actions with bind(): html:form styleId=compose_mail_form method=post action=process_new_mail enctype=multipart/form-data focus=to label for='to' logic:messagesPresent property=toclass='error'/logic:messagesPresentTo:/label html:text property=to styleClass=text style=width: 25%; / br class=clear / ... //more form elements ... a href=# onclick=submitNewMail();SUBMIT/a /html:form NOTE: form has been given a 'styleId' and using logic:messagesPresent to display errors in form function submitNewMail(){ //validateNewMail(form); var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data,
Re: Form validation not happening
I did a deeper look on my project, enabled debug output and even though on the log it says that the requestprocessor is calling validate, my validate method on my class (gave up on validation using xml) does not even get called... Any ideas? Regards On 7/3/06, Vinicius Carvalho [EMAIL PROTECTED] wrote: Hello there! I'm trying to use form validation (It was working, but somehow, I messed something and it quit working). Here are my files: struts-config.xml form-beans form-bean name=userForm type=com.acme.UserForm/form-bean /form-beans action path=/register scope=request validate=true type=com.acme.RegisterAction name=userForm input=/registerScreen.do plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in form name=userForm field property=name depends=required msg name=required key=error.nameRequired/ /field field property=email depends=required msg name=required key=error.emailRequired/ /field /form My UserForm extends ValidatorActionForm! When the user submits, instead of returning to the input page and display the errors he's redirect to the action that deals with the register. Any ideas? Best regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
Good questions! Let me see if I can answer them... draegoon Z wrote: What about errors in the ActionForm? APT doesn't say anything at all about what happens on the server, so, the short answer is its up to you :) The longer answer is that each of the response handlers (as of the latest beta5 release) has a matchPattern parameter, which is a regex... with that, you can examine the response and either fire the handler or skip it. So, for instance, it may be that you want to make an AJAX request when the user clicks a button to do some validations... there are two possible outcomes... one is an OK response, for which you just want to put the returned message into a div let's say... the other outcome is validation errors, in which case you want to pop the response via alert() let's say. So, configure two response handlers: responseHandler type=std:InnerHTML matchPattern=/ok/ parametermyResultDiv/parameter /responseHandler responseHandler type=std:Alerted matchPAttern=/error/ parameter / /responseHandler Now, my regex is a bit rusty, so pay attention more to the theory than the details :) The idea is that the first handler will only fire is ok is found in the response. Likewise, the second one will only fire if error is found. Since you can absolutely use a JSP to render the two responses, you use the same set of Struts skills as you always have to create the response. What about firing javascript function before the submit? I.e., to validate the form (I don't use Validator). As of the latest beta5 release, you can specify both a post-processing and pre-processing function to do exactly that. You can set this on the group, element or event levels. Alternatively, if your really doing something more complex, you can write a custom handler. This amounts to an entry in the config file like so: handler name=MyHandler type=request functionMyJSHandler/function locationlocal/location /handler From then on, you can use MyHandler as the value of the type attribute of a requestHandler element. You can do whatever you want there, and, you STILL won't have to write much code because you can use the built-in RequestSender() function, which takes care of all the AJAX details for you... you just write the business logic, so to speak, and call RequestSender() to take care of all the call details. Does the Action have to return 'null' and write directly to the response, or can the struts config still be used? You can do either. Your response can be rendered via JSP, which we actually recommend 99% of the time, so you can write your struts-config the same as always. In fact, I've taken an existing Struts app and added AJAX to it using APT, and all I had to do was alter the JSPs, the actual code didn't even need a recompile! -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
Sounds great so far, but I think I lost you on the first part. Let's work through a simple problem... Let's say I have in my struts-config: action path=/my_action forward=tile.my_action / action path=/success forward=tile.success / action path=/error forward=tile.error / action name=MyForm path=/process_my_action input=/my_action.do scope=request type=com.draegoonZ.action.MyAction forward name=success path=/success.do / forward name=error path=/error.do / /action First, what happens if MyForm just simply returns an ActionError? Second, what if MyAction has ActionErrors and forwards to its 'error' page? Are you saying that APT gets the response (JSP,text,HTML, whatever) and matches the regex to that entire response string? If so, how do you advise setting flags in the response to ensure the proper responseHandler is called without neccessarily displaying the flag itself. Like, THIS_IS_MY_UGLY_FLAG_BEFORE_CONTENT_AND_FIRST_IN_THE_RESPONSE:pcontent/p -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 14:54:47 -0400 Good questions! Let me see if I can answer them... draegoon Z wrote: What about errors in the ActionForm? APT doesn't say anything at all about what happens on the server, so, the short answer is its up to you :) The longer answer is that each of the response handlers (as of the latest beta5 release) has a matchPattern parameter, which is a regex... with that, you can examine the response and either fire the handler or skip it. So, for instance, it may be that you want to make an AJAX request when the user clicks a button to do some validations... there are two possible outcomes... one is an OK response, for which you just want to put the returned message into a div let's say... the other outcome is validation errors, in which case you want to pop the response via alert() let's say. So, configure two response handlers: responseHandler type=std:InnerHTML matchPattern=/ok/ parametermyResultDiv/parameter /responseHandler responseHandler type=std:Alerted matchPAttern=/error/ parameter / /responseHandler Now, my regex is a bit rusty, so pay attention more to the theory than the details :) The idea is that the first handler will only fire is ok is found in the response. Likewise, the second one will only fire if error is found. Since you can absolutely use a JSP to render the two responses, you use the same set of Struts skills as you always have to create the response. What about firing javascript function before the submit? I.e., to validate the form (I don't use Validator). As of the latest beta5 release, you can specify both a post-processing and pre-processing function to do exactly that. You can set this on the group, element or event levels. Alternatively, if your really doing something more complex, you can write a custom handler. This amounts to an entry in the config file like so: handler name=MyHandler type=request functionMyJSHandler/function locationlocal/location /handler From then on, you can use MyHandler as the value of the type attribute of a requestHandler element. You can do whatever you want there, and, you STILL won't have to write much code because you can use the built-in RequestSender() function, which takes care of all the AJAX details for you... you just write the business logic, so to speak, and call RequestSender() to take care of all the call details. Does the Action have to return 'null' and write directly to the response, or can the struts config still be used? You can do either. Your response can be rendered via JSP, which we actually recommend 99% of the time, so you can write your struts-config the same as always. In fact, I've taken an existing Struts app and added AJAX to it using APT, and all I had to do was alter the JSPs, the actual code didn't even need a recompile! -Joe Frank - 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 AJAX
draegoon Z wrote: Sounds great so far, but I think I lost you on the first part. Let's work through a simple problem... Let's say I have in my struts-config: action path=/my_action forward=tile.my_action / action path=/success forward=tile.success / action path=/error forward=tile.error / action name=MyForm path=/process_my_action input=/my_action.do scope=request type=com.draegoonZ.action.MyAction forward name=success path=/success.do / forward name=error path=/error.do / /action First, what happens if MyForm just simply returns an ActionError? MyForm, which I assume extends from Action, would have to return an ActionForward, or null... if null, then the response would have to be fully formed by the Action, otherwise it presumably returns a forward to a JSP that renders some response. That JSP would have to make use of the ActionErrors, and render a response appropriate for what you want to happen on the client, whether that's updating a div, popping an alert(), or something else. I feel like I'm not understanding what your getting at though :) Second, what if MyAction has ActionErrors and forwards to its 'error' page? Same basic answer as above... you wouldn't, in all probability, reuse the same JSP as rendered the form, as is typical in Struts apps. In this case, you would probably be submitting to some mapping that is expressly set up to handle the AJAX request. That means that the input attribute would make to some JSP that renders the response appropriate for the error condition (the same basic mechanism as described above). Are you saying that APT gets the response (JSP,text,HTML, whatever) and matches the regex to that entire response string? That's correct, it executes the regex against responseText of XMLHttpRequest. If so, how do you advise setting flags in the response to ensure the proper responseHandler is called without neccessarily displaying the flag itself. Like, THIS_IS_MY_UGLY_FLAG_BEFORE_CONTENT_AND_FIRST_IN_THE_RESPONSE:pcontent/p I think more than likely you would key off of some text in a real response... i.e., if the error message is something like To field cannot be blank, then check for something like /cannot be blank/. If you wanted to do something like you show above, you probably would need to write a custom handler because there would be no opportunity to essentially strip the flag from the response... the post-processing function does not fire until AFTER all the response handlers have fired. I think you've found a good enhancement opportunity :) Another possibility is to return Javascrpt... APT will always execute any script blocks it finds in the response. There is also a standard CodeExecuter response handler that assumes the response is Javascript and executes it even without the script block. This would allow you to do whatever you wanted upon return, i.e., flag error fields, whatever. -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Changing Role Access to Actions on the Fly
Acegi Security can be used with anything. It protects URLs and no framework has a trademark on those :) Stasica, Grzegorz [EMAIL PROTECTED] wrote: Hi Please mind that http://acegisecurity.org/ works on Spring not Struts. There is possibility to use Struts in Spring but I don't suppose the opposite is possible :-( -Original Message- From: Paul Benedict [mailto:[EMAIL PROTECTED] Sent: Monday, July 03, 2006 2:54 PM To: Struts Users Mailing List Subject: Re: Changing Role Access to Actions on the Fly Joseph, modifying the user's permissions (not the struts action mapping), is definitely the way to go. Your app should be able to run with any framework, and so go with the advice I gave. Also check out http://acegisecurity.org/ Paul Thomas Joseph wrote: Thank you Paul for your comments, Adding/removing Roles, adding/removing users to roles, then permitting/forbidding various actions for these roles is what I want as the main feature of my App. I have an idea of using filter that would do explicit permissions to roles on actions, based on configurations of role-action mappings from the database. How good do you consider this design? Any other/better design choices?? If other frameworks lack this and if this design goes good enough, I would like to roll out this one to the Open Source. :) Thanks for your help and support Thomas Joseph - Original Message - From: Paul Benedict To: Struts Users Mailing List Sent: Monday, July 03, 2006 2:48 PM Subject: Re: Changing Role Access to Actions on the Fly I can say with mild confidence that the action mapping is frozen once loaded, and changes to it during runtime cannot be made. Since roles are part of a mapping, it cannot be done. But don't let the framework stop you! Just because its automated configuration features are frozen, doesn't mean you can't get around it. If you are willing to perform explicit role checking inside the action, then you can achieve what you're trying to do. Yes, you will be giving up the XML configuration, but, you're doing something very special; I don't even know if *ANY* framework allows something like this. In my opinion, you might search for a better solution. Perhaps dynamic role changing is a symptom of a bad design. For instance, instead of changing the role mapping, update the roles the user actually has -- that's usually how security apps work: change the user, not the app :) Paul Thomas Joseph wrote: I couldnt see any replies, thats why I am adding up these comments. Actually I want the application users to create groups (roles), and then assign access rights to various actions for this group. Later group membership/access rights should be editable. This should be something like how we can do in Operating Systems. Any help in this regard is highly appriciated. Also tell if this is not possible Thanks in advance. Thomas Joseph - Original Message - From: Thomas Joseph To: Struts Users Mailing List Sent: Friday, June 30, 2006 5:37 PM Subject: Changing Role Access to Actions on the Fly Hi all great brains, I would like my application to use roles to access any actions. However, I want to make access to these actions change while the application is running. User in a role could access a particular action at one time, but not the other time (when change has been made). (I understand that role based access to the Action Mapping is static.) Is there any way I can do this.? Any pointers,... ideas ?? Thanks in advance!! Thomas Joseph - 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] - How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates. Note: If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
Re: Form validation not happening
Make sure you're using the correct ValidatorXYZForm base class. ValidatorActionForm uses the key of the URI, ValidatorForm uses the key of the form name. Did you recently upgrade Struts or the Validator? Vinicius Carvalho [EMAIL PROTECTED] wrote: I did a deeper look on my project, enabled debug output and even though on the log it says that the requestprocessor is calling validate, my validate method on my class (gave up on validation using xml) does not even get called... Any ideas? Regards On 7/3/06, Vinicius Carvalho wrote: Hello there! I'm trying to use form validation (It was working, but somehow, I messed something and it quit working). Here are my files: struts-config.xml type=com.acme.RegisterAction name=userForm input=/registerScreen.do property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ My UserForm extends ValidatorActionForm! When the user submits, instead of returning to the input page and display the errors he's redirect to the action that deals with the register. Any ideas? Best regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Sneak preview the all-new Yahoo.com. It's not radically different. Just radically better.
Re: Struts and AJAX
Just wanted to say +1 for the JWP tags. Plus the support you get it is top-notch. Use them. On 7/3/06, Frank W. Zammetti [EMAIL PROTECTED] wrote: draegoon Z wrote: Sounds great so far, but I think I lost you on the first part. Let's work through a simple problem... Let's say I have in my struts-config: action path=/my_action forward=tile.my_action / action path=/success forward=tile.success / action path=/error forward=tile.error / action name=MyForm path=/process_my_action input=/my_action.do scope=request type=com.draegoonZ.action.MyAction forward name=success path=/success.do / forward name=error path=/error.do / /action First, what happens if MyForm just simply returns an ActionError? MyForm, which I assume extends from Action, would have to return an ActionForward, or null... if null, then the response would have to be fully formed by the Action, otherwise it presumably returns a forward to a JSP that renders some response. That JSP would have to make use of the ActionErrors, and render a response appropriate for what you want to happen on the client, whether that's updating a div, popping an alert(), or something else. I feel like I'm not understanding what your getting at though :) Second, what if MyAction has ActionErrors and forwards to its 'error' page? Same basic answer as above... you wouldn't, in all probability, reuse the same JSP as rendered the form, as is typical in Struts apps. In this case, you would probably be submitting to some mapping that is expressly set up to handle the AJAX request. That means that the input attribute would make to some JSP that renders the response appropriate for the error condition (the same basic mechanism as described above). Are you saying that APT gets the response (JSP,text,HTML, whatever) and matches the regex to that entire response string? That's correct, it executes the regex against responseText of XMLHttpRequest. If so, how do you advise setting flags in the response to ensure the proper responseHandler is called without neccessarily displaying the flag itself. Like, THIS_IS_MY_UGLY_FLAG_BEFORE_CONTENT_AND_FIRST_IN_THE_RESPONSE:pcontent/p I think more than likely you would key off of some text in a real response... i.e., if the error message is something like To field cannot be blank, then check for something like /cannot be blank/. If you wanted to do something like you show above, you probably would need to write a custom handler because there would be no opportunity to essentially strip the flag from the response... the post-processing function does not fire until AFTER all the response handlers have fired. I think you've found a good enhancement opportunity :) Another possibility is to return Javascrpt... APT will always execute any script blocks it finds in the response. There is also a standard CodeExecuter response handler that assumes the response is Javascript and executes it even without the script block. This would allow you to do whatever you wanted upon return, i.e., flag error fields, whatever. -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Rick
Re: Struts and AJAX
On 7/3/06, Frank W. Zammetti [EMAIL PROTECTED] wrote: draegoon Z wrote: Sounds great so far, but I think I lost you on the first part. Let's work through a simple problem... Let's say I have in my struts-config: action path=/my_action forward=tile.my_action / action path=/success forward=tile.success / action path=/error forward=tile.error / action name=MyForm path=/process_my_action input=/my_action.do scope=request type=com.draegoonZ.action.MyAction forward name=success path=/success.do / forward name=error path=/error.do / /action First, what happens if MyForm just simply returns an ActionError? MyForm, which I assume extends from Action, would have to return an ActionForward, or null... if null, then the response would have to be fully formed by the Action, otherwise it presumably returns a forward to a JSP that renders some response. That JSP would have to make use of the ActionErrors, and render a response appropriate for what you want to happen on the client, whether that's updating a div, popping an alert(), or something else. I feel like I'm not understanding what your getting at though :) Frank, please ignore my ignorance, if I understand correctly, an Action still returns a full page, but your JS engine parses the response and pulls out only relevant ajaxified parts and replaces them in a page? So, if I need to print out error messages, I just need to mark html:errors/ tag with ajax:enable / ? What if I print errors separately for every input field, will this still work? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
That CodeExecuter is nice! With dojo.io.bind() I use DWRUtil.setValue() to load the response into my div, which doesn't execute any script tags. I've had to use a hack-around to include JSPs, hence evaluating javascript. Bad stuff! About below, I'm talking about when my MyForm (extends ActionForm, not Action) returns an ActionErrors object as it is configured in the example struts-config below. Like if to parameter was supposed to be a valid email address and someone entered: blah blah blah Will this be handled normally, like a Non-Ajax struts action app, returning the input mapping to display the errors, or whatever else. -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 15:38:17 -0400 draegoon Z wrote: Sounds great so far, but I think I lost you on the first part. Let's work through a simple problem... Let's say I have in my struts-config: action path=/my_action forward=tile.my_action / action path=/success forward=tile.success / action path=/error forward=tile.error / action name=MyForm path=/process_my_action input=/my_action.do scope=request type=com.draegoonZ.action.MyAction forward name=success path=/success.do / forward name=error path=/error.do / /action First, what happens if MyForm just simply returns an ActionError? MyForm, which I assume extends from Action, would have to return an ActionForward, or null... if null, then the response would have to be fully formed by the Action, otherwise it presumably returns a forward to a JSP that renders some response. That JSP would have to make use of the ActionErrors, and render a response appropriate for what you want to happen on the client, whether that's updating a div, popping an alert(), or something else. I feel like I'm not understanding what your getting at though :) Second, what if MyAction has ActionErrors and forwards to its 'error' page? Same basic answer as above... you wouldn't, in all probability, reuse the same JSP as rendered the form, as is typical in Struts apps. In this case, you would probably be submitting to some mapping that is expressly set up to handle the AJAX request. That means that the input attribute would make to some JSP that renders the response appropriate for the error condition (the same basic mechanism as described above). Are you saying that APT gets the response (JSP,text,HTML, whatever) and matches the regex to that entire response string? That's correct, it executes the regex against responseText of XMLHttpRequest. If so, how do you advise setting flags in the response to ensure the proper responseHandler is called without neccessarily displaying the flag itself. Like, THIS_IS_MY_UGLY_FLAG_BEFORE_CONTENT_AND_FIRST_IN_THE_RESPONSE:pcontent/p I think more than likely you would key off of some text in a real response... i.e., if the error message is something like To field cannot be blank, then check for something like /cannot be blank/. If you wanted to do something like you show above, you probably would need to write a custom handler because there would be no opportunity to essentially strip the flag from the response... the post-processing function does not fire until AFTER all the response handlers have fired. I think you've found a good enhancement opportunity :) Another possibility is to return Javascrpt... APT will always execute any script blocks it finds in the response. There is also a standard CodeExecuter response handler that assumes the response is Javascript and executes it even without the script block. This would allow you to do whatever you wanted upon return, i.e., flag error fields, whatever. -Joe Frank - 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 AJAX
Michael Jouravlev wrote: Frank, please ignore my ignorance, Ignorance is thinking you know something when you don't... not knowing something you have no experience with isn't :) if I understand correctly, an Action still returns a full page, but your JS engine parses the response and pulls out only relevant ajaxified parts and replaces them in a page? So, if I need to print out error messages, I just need to mark html:errors/ tag with ajax:enable / ? No, that isn't quite right... What APT does is attaches AJAX events to an element on a page (it can theoretically be any DOM element). This attached event fires in response to one of the usual event handlers, i.e., onClick, onBlur, whatever (you can also have an AJAX event that fires continuously via timer, and you can also have a function rendered that you can call at will to fire an AJAX event which is still configured like any other). So, when working with Struts, your Action (or more usually, a JSP) can really render whatever it wants... APT has nothing to say about that (at this point... some plans in the works). Most of the time is would probably NOT be a full page... then, back on the client, APT kicks in again via a response handler, and does something with the response. That something can be updating a div, populating a select, doing an XSLT transformation, popping an alert, or a number of other things (and that's the just standard handlers... with a custom handlers, the possibilities are limited only by your imagination). Now, one new capability that a lot of people were asking for is the ability to use APT tags in a response rendered by a JSP that is itself called as the result of an AJAX call... imagine a button on a page that, when clicked, adds a new item entry line to a list. This new line will contain two text fields, one of which you want to fire an AJAX event onBlur for. Previously, you had to do some somewhat annoying things to make that happen, now it's perfectly natural: just use the tags in a JSP that renders the markup for that new item line. Specifically on your question of rendering html:errors/, you would first need to decide how you want to display the errors... in a popup? In a div? Something else? Whatever the case, you create a JSP that contains that html:errors/ tag, and that might in fact be the ONLY thing in that JSP. Then, you configure a response handler to display it however you want. Nothing more to it. What if I print errors separately for every input field, will this still work? Yes, it can, it all depends on what events fire the AJAX call, and what you do with the response. APT is a bit more low-level than some other libraries in that we don't really say much about what you do or how you do it, we just provide tools that we feel makes it really easy to do whatever you want, and saves you from doing Javascript coding yourself (usually, custom handlers excepted). I think grabbing JWP and looking at the sample app is the best way to go... there is a page with probably close to 20 different usages of APT, and I think if you look at that and then glance at the JSP, it'll become clear pretty quickly (there's also a cookbook that might be helpful, although it hasn't been updated for beta5 yet). Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
draegoon Z wrote: That CodeExecuter is nice! Thanks! The interesting thing is that as of beta5, it doesn't matter what response handler you use, the script blocks will ALWAYS be executed. That's why there's a seemingly superfluous DoNothing handler... you may want to use that instead of CodeExecuter in some cases. About below, I'm talking about when my MyForm (extends ActionForm, not Action) returns an ActionErrors object as it is configured in the example struts-config below. Like if to parameter was supposed to be a valid email address and someone entered: blah blah blah Will this be handled normally, like a Non-Ajax struts action app, returning the input mapping to display the errors, or whatever else. That's what I kinda thought you meant :) I got confused because you showed an action mapping... anyway... if you took an existing Struts app that handled this, then no, APT would probably not work right... although it still could... imagine if the page that the input JSP renders is displayed in an iFrame... in that case, you could use the std:IFrame handler to re-render it, so you wouldn't have to change a thing about your app. Likewise, you could display it in a div and get the same effect. However, more than likely your app isn't built this way today, so it wouldn't work unaltered. What you would more than likely do is copy the action mapping that uses that MyForm, and change the input attribute to point to a JSP that renders just a snippet of markup displaying the error. Then, insert that markup into a div using std:InnerHTML, or maybe pop it in an alert() with std:Alerter, etc. This way, you kind of have a parallel action mapping, one for the AJAX request, one for the regular form submission (I've done this in a proof of concept by the way, it works great). -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
Hey Frank, Check out this code from my first post using dojo.io.bind() : function submitNewMail(){ //validateNewMail(form); //use javascript validate before form submit var bindArgs = { url: html:rewrite action=process_new_mail /, error: function(type, data, evt){ alert(An error occurred submitting new mail: + data); }, load: function(type, data, evt){ DWRUtil.setValue(social_mail_right_con, data);/* setValue doesn't execute javascript! */ document.getElementById('social_popup_layer_container').innerHTML=document.getElementById('ajax_hidden_helper').innerHTML; popup('social_popup_layer_container',true); }, mimetype: text/html, formNode: document.getElementById(compose_mail_form) }; dojo.io.bind(bindArgs); } I'm sure you're probably familiar with dojo, so forgive me if I'm beating a dead horse. What happens here is that my action, /process_new_mail.do, processes like a normal struts app,i.e., ActionForm.validate() gets called first. If there are ActionErrors, the input mapping page is returned via the 'data' object. It is the 'responseText'. The error: argument: error: function(type, data, evt){ alert(An error occurred submitting new mail: + data); } is NOT called because no Javascript error was thrown. Instead, the load: function is called: function(type, data, evt){ DWRUtil.setValue(social_mail_right_con, data);/* setValue doesn't execute javascript! */ document.getElementById('social_popup_layer_container').innerHTML=document.getElementById('ajax_hidden_helper').innerHTML; popup('social_popup_layer_container',true); } The line: DWRUtil.setValue(social_mail_right_con, data); is what displays the response, which is the input page. Anyways, if there are ActionErrors in the ActionForm and the server naturally forwards to the input mapping in the struts-config, Why doesn't APT get this same response? Why doesn't it get forwarded to the input page automatically, returning it in the response? Does it go through the ActionForm.validate() method in the first place? If this could happen, you would pretty much have a drop-in solution! I could be missing something, so feel free to yell at me, but if dojo does it I can't see why this shouldn't work for APT also. -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 17:47:06 -0400 draegoon Z wrote: That CodeExecuter is nice! Thanks! The interesting thing is that as of beta5, it doesn't matter what response handler you use, the script blocks will ALWAYS be executed. That's why there's a seemingly superfluous DoNothing handler... you may want to use that instead of CodeExecuter in some cases. About below, I'm talking about when my MyForm (extends ActionForm, not Action) returns an ActionErrors object as it is configured in the example struts-config below. Like if to parameter was supposed to be a valid email address and someone entered: blah blah blah Will this be handled normally, like a Non-Ajax struts action app, returning the input mapping to display the errors, or whatever else. That's what I kinda thought you meant :) I got confused because you showed an action mapping... anyway... if you took an existing Struts app that handled this, then no, APT would probably not work right... although it still could... imagine if the page that the input JSP renders is displayed in an iFrame... in that case, you could use the std:IFrame handler to re-render it, so you wouldn't have to change a thing about your app. Likewise, you could display it in a div and get the same effect. However, more than likely your app isn't built this way today, so it wouldn't work unaltered. What you would more than likely do is copy the action mapping that uses that MyForm, and change the input attribute to point to a JSP that renders just a snippet of markup displaying the error. Then, insert that markup into a div using std:InnerHTML, or maybe pop it in an alert() with std:Alerter, etc. This way, you kind of have a parallel action mapping, one for the AJAX request, one for the regular form submission (I've done this in a proof of concept by the way, it works great). -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,
Re: Struts and AJAX
draegoon Z wrote: Why doesn't APT get this same response? What response does it get? As far as I can see, it *SHOULD* get the same response, the only difference would be what happens on the client-side with it. Why doesn't it get forwarded to the input page automatically, returning it in the response? That's exactly what should happen. If your seeing something different, definitely let me know! :) Does it go through the ActionForm.validate() method in the first place? Yes, it will... assuming you were to use std:QueryString or std:Poster, the request to the server would look no different to Struts than a normal form submission, or GET request. It will be processed in exactly the same way. If you used, say, std:SimpleXML, then Struts would not automatically parse that XML or anything, you would have to do that on your own. I could be missing something, so feel free to yell at me, but if dojo does it I can't see why this shouldn't work for APT also. Actually, I suspect it's *ME* that's missing something :) I'm not an expert in Dojo, but I have worked with it a bit... from what you've described here, you should be able to do the exact same thing with APT without touching anything server-side... Well, hang on... I'm assuming that Dojo makes a request that either has a query string attached with the parameters, or a POST body with them... I'm pretty sure that's the case though. -Joe Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts and AJAX
I think we were just on two different brainwaves. If APT still goes through the ActionForm.validate() and returns to input page upon ActionErrors, as it should, then APT serves all my purposes with a lot less javascript! PS: just downloaded beta5, installed and got: org.apache.jasper.JasperException: /packages_jsp/ajaxparts/index.jsp(15,0) File /packages_jsp/ajaxparts/javawebparts/ajaxparts/taglib not found Think the problem is first line of packages_jsp/ajaxparts/content.jsp -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 18:51:43 -0400 draegoon Z wrote: Why doesn't APT get this same response? What response does it get? As far as I can see, it *SHOULD* get the same response, the only difference would be what happens on the client-side with it. Why doesn't it get forwarded to the input page automatically, returning it in the response? That's exactly what should happen. If your seeing something different, definitely let me know! :) Does it go through the ActionForm.validate() method in the first place? Yes, it will... assuming you were to use std:QueryString or std:Poster, the request to the server would look no different to Struts than a normal form submission, or GET request. It will be processed in exactly the same way. If you used, say, std:SimpleXML, then Struts would not automatically parse that XML or anything, you would have to do that on your own. I could be missing something, so feel free to yell at me, but if dojo does it I can't see why this shouldn't work for APT also. Actually, I suspect it's *ME* that's missing something :) I'm not an expert in Dojo, but I have worked with it a bit... from what you've described here, you should be able to do the exact same thing with APT without touching anything server-side... Well, hang on... I'm assuming that Dojo makes a request that either has a query string attached with the parameters, or a POST body with them... I'm pretty sure that's the case though. -Joe Frank - 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]
Warning: modified in the future
Hi, I have a very strange problem here, I modify my actions and my jsp pages , but nothing happened, the modification never take effect, when I run the project with NetBeans5 I got this : Warning: org\okip\service\authorization modified in the future Please your help is appreciated. thank you - How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
Problem the with contentType with XHTML MP
Hello! I have this question, when I place this contentType my emulator of a mobile device shows correctly, %@ include file=/Includes.jsp% %@ page contentType=application/vnd.wap.xhtml+xml % html:html xhtml=true bodyHello World/body /html:html but my browser no, not show nothing, the browser show when I place in following contentType=application/xhtml+xml %@ include file=/Includes.jsp% %@ page contentType=application/xhtml+xml % html:html xhtml=true bodyHello World/body /html:html this is correct for the browser, if I use the second case, the mobile device would have problems? cheers, Ben
Re: Struts and AJAX
Well that's a bit embarassing, to say the least :( I think I flubbed the build process, although it would have been flubbed days ago, so I'm not sure how it was working during testing. In any case, the TLD isn't in the right place in the JAR, so it isn't being found. Until a new build can be rolled, a quick work-around is to extract the file javawebparts_ajaxparts.tld from the javawebparts-ajaxparts-1.0-beta5.jar JAR and place it in WEB-INF. That should do the trick (did for me). Sorry about that! Frank draegoon Z wrote: I think we were just on two different brainwaves. If APT still goes through the ActionForm.validate() and returns to input page upon ActionErrors, as it should, then APT serves all my purposes with a lot less javascript! PS: just downloaded beta5, installed and got: org.apache.jasper.JasperException: /packages_jsp/ajaxparts/index.jsp(15,0) File /packages_jsp/ajaxparts/javawebparts/ajaxparts/taglib not found Think the problem is first line of packages_jsp/ajaxparts/content.jsp -Joe --- WEB DESIGN BY DRAEGOONZ Joseph DraegoonZ McGranaghan http://www.draegoonZ.com 603-620-0854 [EMAIL PROTECTED] From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Struts and AJAX Date: Mon, 03 Jul 2006 18:51:43 -0400 draegoon Z wrote: Why doesn't APT get this same response? What response does it get? As far as I can see, it *SHOULD* get the same response, the only difference would be what happens on the client-side with it. Why doesn't it get forwarded to the input page automatically, returning it in the response? That's exactly what should happen. If your seeing something different, definitely let me know! :) Does it go through the ActionForm.validate() method in the first place? Yes, it will... assuming you were to use std:QueryString or std:Poster, the request to the server would look no different to Struts than a normal form submission, or GET request. It will be processed in exactly the same way. If you used, say, std:SimpleXML, then Struts would not automatically parse that XML or anything, you would have to do that on your own. I could be missing something, so feel free to yell at me, but if dojo does it I can't see why this shouldn't work for APT also. Actually, I suspect it's *ME* that's missing something :) I'm not an expert in Dojo, but I have worked with it a bit... from what you've described here, you should be able to do the exact same thing with APT without touching anything server-side... Well, hang on... I'm assuming that Dojo makes a request that either has a query string attached with the parameters, or a POST body with them... I'm pretty sure that's the case though. -Joe Frank - 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] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: [EMAIL PROTECTED] 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: Warning: modified in the future
It sounds like the time on your computer was accidently advanced. I'd reset your computer time and re-save your pages. A. Lotfi [EMAIL PROTECTED] wrote: Hi, I have a very strange problem here, I modify my actions and my jsp pages , but nothing happened, the modification never take effect, when I run the project with NetBeans5 I got this : Warning: org\okip\service\authorization modified in the future Please your help is appreciated. thank you - How low will we go? Check out Yahoo! Messenger�s low PC-to-Phone call rates. - Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta.