|
|
|
|
|||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Integrating Struts in DWR??
Please suggest if there are any good links, or some working examples that
explain how Struts could be integrated into the DWR (AJAX) framework. Any help would be appreciated. There is hardly any online support or documentation. Thanks! |
|
#2
|
|||
|
|||
|
Integrating Struts in DWR??
From the DWR web site:
Just reading through it quickly, that's just about what I would have suggested too in terms of separating out core logic from Actions and letting your Actions and DWR servlet call them as needed. There might be some better approaches, but it sounds like the DWR team is looking for those approaches themselves. Frank Sonali Kulkarni wrote: Please suggest if there are any good links, or some working examples that explain how Struts could be integrated into the DWR (AJAX) framework. Any help would be appreciated. There is hardly any online support or documentation. Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: fzammetti (AT) hotmail (DOT) com To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#3
|
|||
|
|||
|
Integrating Struts in DWR??
So, does it mean that is it not a good idea to use DWR with Struts just as
yet? If so, what would be the best way to integrate AJAX into our Struts application? is a full-blown *financial* banking Struts application. Please also let me know if it is a good idea to use AJAX in the first place, considering (1) the security risks imposed, especially for a financial application (2) ease of integrating AJAX with Struts. (some of the questions i have, for starters are how do i pass the request object from the javascript to my action class method, how do i handle errors returned etc) Thanks for your time! Any replies would be appreciated! 12/3/05, Frank W. Zammetti <fzlists (AT) omnytex (DOT) comwrote: > From the DWR web site: > > Just reading through it quickly, that's just about what I would have suggested too in terms of separating out core logic from Actions and letting your Actions and DWR servlet call them as needed. There might be some better approaches, but it sounds like the DWR team is looking for those approaches themselves. > Frank > Sonali Kulkarni wrote: Please suggest if there are any good links, or some working examples that explain how Struts could be integrated into the DWR (AJAX) framework. Any help would be appreciated. There is hardly any online support or documentation. > Thanks! > > -- Frank W. Zammetti Founder and Chief Software Architect Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: fzammetti (AT) hotmail (DOT) com > To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org > > |
|
#4
|
|||
|
|||
|
Integrating Struts in DWR??
Some of the questions you ask here are really more for you to decide
there aren't any canned answers. That being said, I'll do my best To begin with, I highly suggest checking out the numerous articles on AJAX out there to get a firm grasp on what it really is, and if I may be so bold, start with my own: This will show one way AJAX can be integrated with Struts. You can also check out my AjaxChat example app on the Struts Apps SourceForge site: http://struts.sourceforge.net The short answer is that AJAX, generically, is nothing but an HTTP request. As far as whatever is on the server is concerned, be it a Struts apps or something else, it doesn't look any different than any other request. Well, I suppose more accurately, it doesn't *have* to look any different. If you simply pass simple parameters from the client and forego XML, then to Struts there's no difference. If you want to use XML and Struts, then you will at this point have to do your own parsing. With Struts 1.3, it would be trivial to add a Command to the processing chain to parse an incoming XML message and translate it to request parameters come to think of it, that exists already: Although that's for Web Services, the underlying theory is identical. There is a 1.3 version, courtesy of Marco Mistroni, but you can see my original version with the customized RP. The same thing would work nicely for AJAX, although one can envision other ways of doing it too. You could just as well have this function in your servlet it's just a matter of getting the body content of the HTTP request, which would be XML, parsing it and doing what you'd always do. If this interests you, have a look at the code in CVS HEAD here: I'll probably cut a release this weekend, but the code in CVS for the AjaxTags component in the sample app does exactly that an AJAX request is made with XML in the HTTP body, and a servlet in this case gets it (via the handy RequestHelpers.getBodyContent() method) and then uses Digester to parse it. Everything I've talked about here is "naked" AJAX, i.e., without the help of any particular library. AJAX is really quite simple, aside from a few gotchas, but there are some very robust libraries that will help with more than the basics in most cases. They all seem to have a slightly different focus from one another, so if you'd prefer to go that route, some (of the many!) to look at are: This is the AjaxTags component of Java Web Parts this is a little different than the rest in that it makes enabling specific events very easy. All it requires is adding custom tags to your page, and configuring various AJAX events via XML config file. For instance, if you want to fire an AJAX event when a <divis clicked, and then you want a function that will populate another <divfrom what the server returns, this is a trivial exercise with AjaxTags, and it's all driven by config file so there is no coding involved, aside from adding a tag or two to your page. This is my own creation, so obviously I'll push it a little more than the rest, but I truly do believe it offers something than most other options do not and you probably should at least check it out and see if it meets your needs. http://dojotoolkit.com/ This is the one people are starting to really get behind, and from what I can see there is good reason for it. This is one of the ones that will give you more than just AJAX, and that might be very appealing to you. DWR of course you already know about. http://prototype.conio.net/ Prototype is actually more of a foundation as there are other libraries that use it. So certainly check out some of those libraries, but Prototype on its own might be something you want to use. There is no canonical answer at present for integrating with Struts, but the point is there probably doesn't ever have to be one it's just an HTTP request. , there could be something added to Struts to handle automatic parsing of XML and stuffing it into an ActionForm, that might not be a bad idea, but since you have access to the request object anyway in an Action, you can do everything that Struts would ever do for you so it would probably be unnecessary to add it to Struts. To the question of whether AJAX is appropriate or not first, from a security standpoint, AJAX is no different from every form you submit, every window.location call you make, every image you GET, etc. The same security concerns that arise in those instances are present with AJAX. AJAX has a limitation in that it can't make requests to domains other than the one that served the page it's on, so in a sense it's MRE secure. But the bottom line is you secure AJAX the same way you secure your webapps generally. If your wondering if it's worth it, that of course is for you to answer. There are some cases where it absolutely makes things better, but it comes with some baggage unless you spend a lot of time worrying about graceful degredation, your app will now *require* scripting. This might not be a problem for you, but it might be. AJAX is also a problem for accessability. In some cases this is a major problem, but even when it's not it's something we should all think about. It also raises the level of expertise your app requires to maintain. I'm personally a fan of AJAX. I've been doing AJAX for over 5 years (keep in mind that AJAX is really more a philosophy and an approach than it is any specific technology I haven't used XMLHttpRequest for very long, but I accomplished the same types of things in an app 5 years ago). I believe the age of the "classic" web, where scripting is optional and apps redraw entire screens, is dead. AJAX itself is nothing knew, but the mindset that accompanies it largely is, so if your asking *me* if its a good idea in the first place, I'd say absolutely yes, assuming two things first, that the way you want to apply it makes sense; anything can be used in a pointless way of course!, and second, that you understand and can accept all the caveats that go along with it. Hope that helps! Frank Sonali Kulkarni wrote: So, does it mean that is it not a good idea to use DWR with Struts just as yet? If so, what would be the best way to integrate AJAX into our Struts application? is a full-blown *financial* banking Struts application. Please also let me know if it is a good idea to use AJAX in the first place, considering (1) the security risks imposed, especially for a financial application (2) ease of integrating AJAX with Struts. (some of the questions i have, for starters are how do i pass the request object from the javascript to my action class method, how do i handle errors returned etc) Thanks for your time! Any replies would be appreciated! 12/3/05, Frank W. Zammetti <fzlists (AT) omnytex (DOT) comwrote: >>From the DWR web site: >> >> >> >>Just reading through it quickly, that's just about what I would have >>suggested too in terms of separating out core logic from Actions and >>letting your Actions and DWR servlet call them as needed. There might >>be some better approaches, but it sounds like the DWR team is looking >>for those approaches themselves. >> >>Frank >> >>Sonali Kulkarni wrote: >> Please suggest if there are any good links, or some working examples >> >>that >> explain how Struts could be integrated into the DWR (AJAX) framework. >> >>Any >> help would be appreciated. There is hardly any online support or documentation. Thanks! >> >>Frank W. Zammetti >>Founder and Chief Software Architect >Technologies >>http://www.omnytex.com >>AIM: fzammetti >>Yahoo: fzammetti >>MSN: fzammetti (AT) hotmail (DOT) com >> >> >>To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org >>For additional commands, e-mail: user-help (AT) struts (DOT) apache.org >> >> -- Frank W. Zammetti Founder and Chief Software Architect Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: fzammetti (AT) hotmail (DOT) com To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#5
|
|||
|
|||
|
Integrating Struts in DWR??
Sorry to be a broken record but Shale + DWR might be a good combo to
consider since Shale has an Ajax module. V Frank W. Zammetti wrote: From the DWR web site: Just reading through it quickly, that's just about what I would have suggested too in terms of separating out core logic from Actions and letting your Actions and DWR servlet call them as needed. There might be some better approaches, but it sounds like the DWR team is looking for those approaches themselves. Frank Sonali Kulkarni wrote: >Please suggest if there are any good links, or some working examples that >explain how Struts could be integrated into the DWR (AJAX) framework. Any >help would be appreciated. There is hardly any online support or >documentation. >> >Thanks! >> To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#6
|
|||
|
|||
|
Integrating Struts in DWR??
Sorry about that, I obviously screwed up in QC the latest build of
AjaxChat IS NT A PRPER WEBAPP. My build script is obviously not working right as far as the distro task goes, and I didn't notice. Please use the v1.0 alpha, NT alpha2, which is, AFAIK, correct. It does have some bugs, but they shouldn't bother you if you are just checking the AJAX stuff out. I will correct the latest version tomorrow and cut a new release it is ready to be called 1.0 GA at this point anyway, so it's just as well. Alternatively, you could check out from CVS HEAD right now, which should work fine, but you'll have to compile first. Frank Sonali Kulkarni wrote: Hi Frank, I downloaded ajaxchat.zip from link <> But I could not find abt jsp files in the zip, Hence cannot run the application. I am planning to run it in Tomcat. Where can I get the complete source code for the application, that I can run, and study. Thanks, Sonali 12/3/05, *Frank W. Zammetti* <fzlists (AT) omnytex (DOT) com <mailto:fzlists (AT) omnytex (DOT) com>wrote: Some of the questions you ask here are really more for you to decide there aren't any canned answers. That being said, I'll do my best To begin with, I highly suggest checking out the numerous articles on AJAX out there to get a firm grasp on what it really is, and if I may be so bold, start with my own: This will show one way AJAX can be integrated with Struts. You can also check out my AjaxChat example app on the Struts Apps SourceForge site: http://struts.sourceforge.net The short answer is that AJAX, generically, is nothing but an HTTP request. As far as whatever is on the server is concerned, be it a Struts apps or something else, it doesn't look any different than any other request. Well, I suppose more accurately, it doesn't *have* to look any different. If you simply pass simple parameters from the client and forego XML, then to Struts there's no difference. If you want to use XML and Struts, then you will at this point have to do your own parsing. With Struts 1.3, it would be trivial to add a Command to the processing chain to parse an incoming XML message and translate it to request parameters come to think of it, that exists already: Although that's for Web Services, the underlying theory is identical. There is a 1.3 version, courtesy of Marco Mistroni, but you can see my original version with the customized RP. The same thing would work nicely for AJAX, although one can envision other ways of doing it too. You could just as well have this function in your servlet it's just a matter of getting the body content of the HTTP request, which would be XML, parsing it and doing what you'd always do. If this interests you, have a look at the code in CVS HEAD here: I'll probably cut a release this weekend, but the code in CVS for the AjaxTags component in the sample app does exactly that an AJAX request is made with XML in the HTTP body, and a servlet in this case gets it (via the handy RequestHelpers.getBodyContent() method) and then uses Digester to parse it. Everything I've talked about here is "naked" AJAX, i.e., without the help of any particular library. AJAX is really quite simple, aside from a few gotchas, but there are some very robust libraries that will help with more than the basics in most cases. They all seem to have a slightly different focus from one another, so if you'd prefer to go that route, some (of the many!) to look at are: <> This is the AjaxTags component of Java Web Parts this is a little different than the rest in that it makes enabling specific events very easy. All it requires is adding custom tags to your page, and configuring various AJAX events via XML config file. For instance, if you want to fire an AJAX event when a <divis clicked, and then you want a function that will populate another <divfrom what the server returns, this is a trivial exercise with AjaxTags, and it's all driven by config file so there is no coding involved, aside from adding a tag or two to your page. This is my own creation, so obviously I'll push it a little more than the rest, but I truly do believe it offers something than most other options do not and you probably should at least check it out and see if it meets your needs. http://dojotoolkit.com/ This is the one people are starting to really get behind, and from what I can see there is good reason for it. This is one of the ones that will give you more than just AJAX, and that might be very appealing to you. DWR of course you already know about. http://prototype.conio.net/ Prototype is actually more of a foundation as there are other libraries that use it. So certainly check out some of those libraries, but Prototype on its own might be something you want to use. There is no canonical answer at present for integrating with Struts, but the point is there probably doesn't ever have to be one it's just an HTTP request. , there could be something added to Struts to handle automatic parsing of XML and stuffing it into an ActionForm, that might not be a bad idea, but since you have access to the request object anyway in an Action, you can do everything that Struts would ever do for you so it would probably be unnecessary to add it to Struts. To the question of whether AJAX is appropriate or not first, from a security standpoint, AJAX is no different from every form you submit, every window.location call you make, every image you GET, etc. The same security concerns that arise in those instances are present with AJAX. AJAX has a limitation in that it can't make requests to domains other than the one that served the page it's on, so in a sense it's MRE secure. But the bottom line is you secure AJAX the same way you secure your webapps generally. If your wondering if it's worth it, that of course is for you to answer. There are some cases where it absolutely makes things better, but it comes with some baggage unless you spend a lot of time worrying about graceful degredation, your app will now *require* scripting. This might not be a problem for you, but it might be. AJAX is also a problem for accessability. In some cases this is a major problem, but even when it's not it's something we should all think about. It also raises the level of expertise your app requires to maintain. I'm personally a fan of AJAX. I've been doing AJAX for over 5 years (keep in mind that AJAX is really more a philosophy and an approach than it is any specific technology I haven't used XMLHttpRequest for very long, but I accomplished the same types of things in an app 5 years ago). I believe the age of the "classic" web, where scripting is optional and apps redraw entire screens, is dead. AJAX itself is nothing knew, but the mindset that accompanies it largely is, so if your asking *me* if its a good idea in the first place, I'd say absolutely yes, assuming two things first, that the way you want to apply it makes sense; anything can be used in a pointless way of course!, and second, that you understand and can accept all the caveats that go along with it. Hope that helps! Frank Sonali Kulkarni wrote: So, does it mean that is it not a good idea to use DWR with Struts just as yet? > If so, what would be the best way to integrate AJAX into our Struts application? > is a full-blown *financial* banking Struts application. Please also let me know if it is a good idea to use AJAX in the first place, considering (1) the security risks imposed, especially for a financial application (2) ease of integrating AJAX with Struts. (some of the questions i have, for starters are how do i pass the request object from the javascript to my action class method, how do i handle errors returned etc) > Thanks for your time! Any replies would be appreciated! > > 12/3/05, Frank W. Zammetti < fzlists (AT) omnytex (DOT) com <mailto:fzlists (AT) omnytex (DOT) com>wrote: > >>From the DWR web site: >> >> >> >>Just reading through it quickly, that's just about what I would have >>suggested too in terms of separating out core logic from Actions and >>letting your Actions and DWR servlet call them as needed. There might >>be some better approaches, but it sounds like the DWR team is looking >>for those approaches themselves. >> >>Frank >> >>Sonali Kulkarni wrote: >> Please suggest if there are any good links, or some working examples >> >>that >> explain how Struts could be integrated into the DWR (AJAX) framework. >> >>Any >> help would be appreciated. There is hardly any online support or documentation. Thanks! >> >>Frank W. Zammetti >>Founder and Chief Software Architect >Technologies >>http://www.omnytex.com >>AIM: fzammetti >>Yahoo: fzammetti >>MSN: fzammetti (AT) hotmail (DOT) com <mailto:fzammetti (AT) hotmail (DOT) com> >> >> >>To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org <mailto:user-unsubscribe (AT) struts (DOT) apache.org> >>For additional commands, e-mail: user-help (AT) struts (DOT) apache.org <mailto:user-help (AT) struts (DOT) apache.org> >> >> > > -- Frank W. Zammetti Founder and Chief Software Architect Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: fzammetti (AT) hotmail (DOT) com <mailto:fzammetti (AT) hotmail (DOT) com> To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org <mailto:user-unsubscribe (AT) struts (DOT) apache.org> For additional commands, e-mail: user-help (AT) struts (DOT) apache.org <mailto:user-help (AT) struts (DOT) apache.org> -- Frank W. Zammetti Founder and Chief Software Architect Technologies http://www.omnytex.com AIM: fzammetti Yahoo: fzammetti MSN: fzammetti (AT) hotmail (DOT) com To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#7
|
|||
|
|||
|
Integrating Struts in DWR??
At 6:27 PM -0600 12/3/05, netsql wrote:
>Sorry to be a broken record but Shale + DWR might be a good >combo to consider since Shale has an Ajax module. That Shale has an Ajax module has nothing to do with DWR; DWR provides all of its own AJAX plumbing, if by AJAX you mean having a page communicate with a server without a full page refresh. (The other facet of behavior commonly lumped under AJAX is DHTML effects; DWR has a small util library for those but doesn't really try to serve that space.) Frank's pointer to the DWR site hits the button, I think. If you have designed your Struts application correctly, then you can easily use DWR where you need to, but DWR has no need to know anything about Struts at all. You would have two servlets in one application context sharing access to the same business-level components. If you have so much behavior bound up in Struts Actions and ActionForms that you can't easily use DWR in the same application context, then you have too much behavior bound up in Struts. Time to refactor! We're using DWR on my most current project to very nice effect. I heartily recommend it. I wouldn't presume to make security recommendations for a banking application, but DWR seems to have a pretty good handle on basic security issues, in that it only exposes the things you configure for exposure, rather than automatically allowing things. Joe >.V > >Frank W. Zammetti wrote: >From the DWR web site: >> >> >> >>Just reading through it quickly, that's just about what I would >>have suggested too in terms of separating out core logic from >>Actions and letting your Actions and DWR servlet call them as >>needed. There might be some better approaches, but it sounds like >>the DWR team is looking for those approaches themselves. >> >>Frank >> >>Sonali Kulkarni wrote: >> Please suggest if there are any good links, or some working examples that explain how Struts could be integrated into the DWR (AJAX) framework. Any help would be appreciated. There is hardly any online support or documentation. Thanks! >> > > > >To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org >For additional commands, e-mail: user-help (AT) struts (DOT) apache.org -- Joe Germuska Joe (AT) Germuska (DOT) com http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#8
|
|||
|
|||
|
Integrating Struts in DWR??
But Ajax is only one example of Remoting and "RiA". If Shale lets me do
JDNC remoting (and 6 others) as well, that's a plus and less refactoring. Yes, if everything is CR, one is ahead of the game (and that is my case at the moment, everything is CR on back end). ot: http://prototype.conio.net any coments on this? realy, I keep looking for a good stable stack. V Joe Germuska wrote: That Shale has an Ajax module has nothing to do with DWR; DWR provides all of its own AJAX plumbing, if by AJAX you mean having a page communicate with a server without a full page refresh. <snip> You would have two servlets in one application context sharing access to the same business-level components. If you have so much behavior bound up in Struts Actions and ActionForms that you can't easily use DWR in the same application context, then you have too much behavior bound up in Struts. Time to refactor! To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#9
|
|||
|
|||
|
Integrating Struts in DWR??
netsql wrote:
ot: http://prototype.conio.net any coments on this? realy, I keep looking for a good stable stack. I don't like anything that uses the term "Web 2.0" right out of the gate :) all the recent terms that have arisen, that one just bugs me to no end. But more seriously, Prototype I've seen before, and it definitely looks pretty good to me. Frank To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
|
#10
|
|||
|
|||
|
Integrating Struts in DWR??
Frank W. Zammetti wrote:
netsql wrote: >ot: http://prototype.conio.net any coments on this? >realy, I keep looking for a good stable stack. I don't like anything that uses the term "Web 2.0" right out of the gate :) all the recent terms that have arisen, that one just bugs me to no end. But more seriously, Prototype I've seen before, and it definitely looks pretty good to me. I like Prototype too, in that it adds real value without being at all bloated. I've seen arguments that it's 'evil' though, as it injects properties/functions into standard Java objects and pollutes the global namespace. I'm not Javascript-savvy enough to assess the impact of that L. To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org For additional commands, e-mail: user-help (AT) struts (DOT) apache.org |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Java > Integrating Struts in DWR?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|