Re: JPA with Struts 1
On 1/11/2011 1:57 PM, Jari Fredriksson wrote: On 11.1.2011 18:07, Anjib Mulepati wrote: Can I use JPA with Struts 1? If yes is there any good tutorial I can look into? I have used it so that I manipulated all JPA objects in a EJB 3.x Session bean, which was called from Structs Actions. Session bean Dependency Injection does not work from Struts 1.x modules, you have to create some kind of a factory or other loader for the Session beans. Basically JNDI calls, and very EJB container specific. But Persistence API works then fine in the Session bean. JPA is independent of web framework, so yes, you can use it. As such, any JPA tutorial should do the trick. The first Google hit looks decent enough: http://download.oracle.com/javaee/5/tutorial/doc/bnbpz.html Frank -- Frank W. Zammetti Author of Practical Palm Pre webOS Projects and Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Ajax ActionErrors
On 1/11/2011 1:43 PM, CRANFORD, CHRIS wrote: Can someone explain how I can render my action errors when I use Ajax to post a form to the server? Assuming you're talking Struts 1... error are rendered via JSP custom tags, so to make it work with AJAX, without hacking the framework, all you need to do is render the AJAX result using a JSP... the output of that JSP can include the errors... you can use a JSP to render JSON for example, or XML if you wish, or some other custom format. Frank -- Frank W. Zammetti Author of Practical Palm Pre webOS Projects and Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: best way to ajaxize a Struts2 application
Depends very much on what your goals and requirements are. Do you want to just sprinkle in some AJAX calls to your server? Pretty much any library or plug-in will do the trick pretty well for you. Are you looking for a whole GUI toolkit? If so I'd personally suggest ExtJS as being the best, but others are more than worthy of being considered (Dojo, YUI, jQuery UI to name a few). Any of them can be used just fine with Struts... I'm personally of the opinion that life is beter without Struts (ExtJS+DWR is a magnificent beast IMO) but this is of course the Struts mailing list and lots of people still find plenty of value in Struts and that's perfectly fine, any of these libraries, and others, can be mixed in with Struts without much effort. I in fact still support a couple of Struts-based applications and we've used Dojo and ExtJS in some of them with no problem, even adding them after the fact. Again though, really depends on what your needs actually are... just augmenting a Struts-based app or developing a true RIA? What best answers your question will be heavily influenced by that factor, among others. hth, Frank -- Frank W. Zammetti Author of Practical Palm Pre webOS Projects and Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Thu, December 2, 2010 3:15 pm, webmeiker wrote: Hi, I want to ask to the Struts2 community what technology do you recommend to ajaxize a Struts2 web application? (Dojo, Jquery, YUI, ) What do you think are the newest tendencies? Thanks in advance (and sorry if it has been asked thousands of times before Iam new in the mailing list-) -- - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: AJAX file upload
On 12/1/2010 9:00 AM, Robert Graf-Waczenski wrote: Am 30.11.2010 21:59, schrieb Harsh C: How can I setup a AJAX-ified file upload page using Struts 2? If there is some integration with Dojo, it would be even better i.e. not use the OS specific file upload button etc. There are various resources floating around in the net regarding AJAX file upload. Strictly speaking, there is no such thing as an ajax file upload to begin with. If your web app needs to upload a file, there are two choices: Either you use input type=file in all its ugliness (or beauty, if you put effort into styling the control properly), or you implement a (signed) Java applet to grab the file from your client's disk and upload it to the server. That being said, i would still suggest to google for AJAX file upload because some of the resources that you can find are actually quite useful and describe a solution to the problem that your web app may have here and there, namely that you have an html form on your page already and that you now need an extra form (on a popup dialog, layer, whatever) that can be submitted while the original form is *not* (or not yet) submitted. For this, ajax comes into the picture: It allows you to handle a separate HTTP submit roundtrip to accept the uploaded file, do some validation with it and show the appropriate errors on your popup dialog when the rest of the other form has not yet been submitted. And, finally: All this has nothing to do with Struts specifically. Robert FYI, DWR v3 has a super-sweet implementation of an AJAX upload. Doesn't solve the look-and-feel issue WRT the button, but if you want to really be fooled into thinking you're actually using AJAX to do an upload (because Robert is 100% right that there isn't actually such a thing) than DWR v3 will make you smile as you write the 2-3 lines of code you need :) -- Frank W. Zammetti Author of Practical Palm Pre webOS Projects and Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Ajax support for Struts 2.2.1
As the creator of an AJAX taglib (As the developer of an AJAX taglb (http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html) I have to say... I agree with Dave :) There was a time (like, around the time I created the library perhaps?!?) where I would have argued otherwise. And maybe it's true that in shops with absolutely zero Javascript experience the tags still make some sense... but in general, they don't really buy you anything IMO, and in many cases will just get in your way. That's mine or anyone else' taglib. Frank -- Frank W. Zammetti Author of Practical Palm Pre webOS Projects and Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Tue, August 24, 2010 7:58 am, Dave Newton wrote: On Tue, Aug 24, 2010 at 5:55 AM, Johannes Geppert wrote: Even in the trivial cases a taglib has a benefit. *Only* in the trivial cases. A normal AJAX request with a simple indicator and an effect after completing, needs a lot of boiler plate code, which is hard to maintenance and to debug. There's not much boiler-plate code for that, and as with anything else, you refactor your JavaScript. It's a function call, not embedded in the body in keeping with good practices, etc. And since no two apps are the same, what you need is almost certainly what I need. And I'm not locked in to a specific version of a specific framework. And I could just as easily put *exactly* what I need into my *own* tag library. I can count on one finger the number of times an existing tag library solution worked for me. I see almost zero benefit, except for the most trivial use cases (as long as the tag library uses the JavaScript framework I'm already using and does precisely what I need). I'm not saying don't use them, I'm saying they're not that useful for me and save me very little effort (if any), and occasionally make things *more* work. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts vs Other competitors
The phrase OH GOD KILL IT! KILL IT WITH FIRE! has been heard exclaimed in relation to JSF on more than one occassion. -- Frank W. Zammetti Author of Practical Ext JS Projects with Gears and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Mon, July 27, 2009 12:07 pm, Musachy Barroso wrote: On Mon, Jul 27, 2009 at 4:42 AM, Andrey Rogovstrut...@gmail.com wrote: I agree with Matt Rable that JSF programming based on RAD methods makes us transition to JSF. I think many, many people have crossed that bridge and came back in rush after a while. musachy -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: opening a popup window from Action Class
This is a question asked so frequently that someone should create an FAQ entry or something. Oh, wait... http://wiki.apache.org/struts/OpenWindowFromAction :) Frank -- Frank W. Zammetti Author of Practical Ext JS Projects with Gears (coming soon) and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Thu, June 11, 2009 2:03 am, abhishek reddy wrote: hi every one, How to open a popup window from Struts Action Class? thanks in advance -- Abhishek - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: opening a popup window from Action Class
I assume you're referring specifically to the AJAX option outlined on that page... in that case, I have to admit I've never dealt with that scenario so I'm not certain... but, wouldn't just escaping quotes in the response on the server-side do the trick? That would ensure the JavaScript doesn't break, which I think is the only real consideration because I'd expect the browser to handle the content regardless of what what charset it uses once it's opened in the new window. I may be very wrong of course :) -- Frank W. Zammetti Author of Practical Ext JS Projects with Gears (coming soon) and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Thu, June 11, 2009 10:58 am, Martin Gainty wrote: yes that works for UTF-8 with text/html meta http-equiv=Content-Type content=text/html;charset=UTF-8 / http://www.dojotoolkit.com/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/i18n/encoding-considerations how would you accomodate a different charset such as GB18030 http://en.wikipedia.org/wiki/Chinese_character_encoding ? Martin Gainty __ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Thu, 11 Jun 2009 10:07:20 -0400 Subject: Re: opening a popup window from Action Class From: fzli...@omnytex.com To: user@struts.apache.org This is a question asked so frequently that someone should create an FAQ entry or something. Oh, wait... http://wiki.apache.org/struts/OpenWindowFromAction :) Frank -- Frank W. Zammetti Author of Practical Ext JS Projects with Gears (coming soon) and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Thu, June 11, 2009 2:03 am, abhishek reddy wrote: hi every one, How to open a popup window from Struts Action Class? thanks in advance -- Abhishek - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org _ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutorial_QuickAdd_062009 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: executing inline scripts from ajax responses (dojo 0.4)
I take it what you want to do is insert Content into divId, and then fire an alert(). The problem you have is that the value of data is nothing but a simple string. Your callback has to know what to do with it. IIRC, Dojo has a function that will execute all script tags within a string, so you could certainly call that to get the alert() to fire... but that doesn't help you put the content in the DOM. I suggest what you should do instead is have your response returned a bit differently. Something as simple as this: Content~~test Then in your callback you do: var a = data.split(~~); document.getElementById(divId).innerHTML = a[0]; alert(a[1]); The response could also be JSON: { divContent: Content, msg : test } Then you do: data = eval(data); document.getElementById(divId).innerHTML = data.divContent; alert(data.msg); hth, Frank -- Frank W. Zammetti Author of Practical Ext JS Projects with Gears (coming soon) and Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects with Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) All you could possibly want is here: zammetti.com On Mon, March 30, 2009 10:27 am, Tedy Marcos Colombini wrote: Hi there, After being able to submit an ajax form request using javascript, I am stuck in the second (and last) problem. The response contains an inline script which I wanna execute when the it is rendered. I am using Struts 2.0.11 and Dojo 0.4. I did some research but everything I found is incomplete. This is the code. It works, only the alert from the response doesn't pop out. So what I should do to make this script run? %@ page contentType=text/html; charset=UTF-8 % %@ taglib prefix=s uri=/struts-tags % html head s:head theme=ajax debug=true/ script type=text/javascript function submitForm(formId, divId) { var kw = { formNode: dojo.byId(formId), mimetype: text/plain, method: post, transport: XMLHTTPTransport, load: function(type, data, http, kwArgs){ dojo.byId(divId).innerHTML = data; }, error: function(type, error, http){ alert(error); } }; dojo.io.bind(kw); } /script /head body s:form id=myForm action=example/Test.action input type=button onclick=submitForm('myForm', 'divResult') value=Javascript / /s:form div id=divResult/div /body /html This is the response from Test.action: Content script alert(test) /script Thank you for your help, -- Tedy Marcos Colombini - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts2.1 and ajax
Just wanted to clarify, as the creator of APT (AjaxParts Taglib, what both of you are referring to), that APT has not replaced Dojo or anything else in S2... at least, if it has, it's news to me :) That being said, it's true that you can use APT with S2, or virtually any other JSP-based framework. APT doesn't say anything about what server technology is used, other than JSP since its a taglib... be it Struts, plain servlets or whatever else you like, so long as you have URLs that serve content, APT can work with it. There's lots of ways to do Ajax, APT is just one of them that you might consider. Here's an introductory article that, while not dealing with Struts specifically, would still generally be applicable: http://www.omnytex.com/articles/apt/ hth, Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog Seshagiri V wrote: Hi , Java Web Parts, The AjaxTags component of the Java Web Parts project is a taglib. Please follows url: http://www.ajaxwith.com/AjaxTags-Sub-Component-of-the-Java-Web-Parts-oject.h tml may be given solution. Thank you, Seshagiri V seshagi...@kensium.com. US Main: 877 KENSIUM (536.7486) US Fax: 312.242.3029 Kensium 200 S Wacker Dr, Suite 3100 Chicago, IL 60606 Confidentiality Note: - The information contained in this e-mail is strictly confidential and for the intended use of the addressee only. Any disclosure, use or copying of the information by anyone other than the intended recipient is prohibited. If you have received this message in error, please notify the sender immediately by return e-mail and securely discard this message. -Original Message- From: k...@chalu.cz [mailto:k...@chalu.cz] Sent: Wednesday, February 18, 2009 6:51 PM To: Struts Users Mailing List Subject: Struts2.1 and ajax BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }Hi, I found a lot of articles which describes how to use ajax in Struts2.0 using DOJO / JSON But in Struts 2.1 I found that DOJO is deprecated and replaced by Java Web Part - but I did not found any tutorial. In JWP pages I found something about using in classic servlets, but nothing about using in Struts framework. Can anybody send me some link? Thanks Jiri No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.237 / Virus Database: 270.11.0/1959 - Release Date: 02/18/09 20:55:00 - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org __ Information from ESET Smart Security, version of virus signature database 3866 (20090218) __ The message was checked by ESET Smart Security. http://www.eset.com - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Is Spring worth it?
I think one of the benefits of Spring is that, theoretically at least, it allows for a somewhat more vendor-neutral approach to development. For example... where I work, we're a Websphere shop. For better or worse, period, that's it, end of story. As a result I've seen many developers doing Websphere-specific things. Now, on one level that makes sense: why pay for an app server if you aren't going to fully use its capabilities? The other perspective though is the one I subscribe to more which says that the ability to swap out app servers with as little trouble as possible is a nice place to be. I think this way about databases as well, and in fact as many things as possible! If you go down the route of using Spring then I think it helps you get there. For example, you have Spring Web Services that you can use in place of Websphere's WS engine (in practice this has proven to be a far more difficult task than the theory says it should be, but still!). Using Spring Security (which, as I understand it, used to be Acegi) can help you get away from container-manager security a bit (and if that sounds wrong to you then keep in mind that Spring is, to a large extent, playing the role of the container itself). Using Spring's DI can get you away from JNDI to some degree. And so on. Talking about Spring JDBC in particular, because this is probably the part of Spring I've personally had the most experience with and have gotten the most beneift from... I'm on the same page as a couple of posters here seem to be in that the infatuation that people had for a couple of years with getting away from SQL and JDBC largely didn't pan out (and yes, I recognize that's a controversial statement for many still today). I'm someone that feels shying away from SQL is not the way to architect a good application. That being said, I think that Spring JDBC, which we've been using extensively for about a year now at work, really does help significantly. Not having to worry about all the details of JDBC while *still* dealing with naked SQL is a really nice thing to be able to do. It's really just a collection of convenience classes and methods, not another pointless abstraction layer. I like that I get to stay fairly low-level but in such a way that is more convenient. At the end of the day, Spring is largely just a well-rounded, full-featured library that you can in many ways look at the same way you look at the whole of Apache Commons: take the pieces you like (and that you see the point in) and simply ignore the rest! Spring makes doing that pretty easy, for the most part at least. Some see it more as an entire platform to build an app on, in many ways taking the place traditionally held by various J2EE spec components, and if you really buy into it completely I can see how it leads to that. But if you don't see the point in the whole thing like that, then cool, not a problem... don't let that stop you from finding the bits and pieces that will definitely save you time and effort though! Keep in mind too that there's such a breadth there that it takes a while to get through it all and pick out those useful pieces. That's both the blessing and the curse of something that presents so much power, simply finding what you need is daunting. Don't take that to mean there's no point or benefit to be had though :) Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog dusty wrote: You should look at Spring annotations. So awesome. And Spring Security!?! forget about it. If you don't drink the Injection/TDD koolaid then wiring up services with Spring may seem lame. I don't think the issue is how well Spring handles JDBC. We could talk about Hibernate, but I am assuming that Hibernate is only for noobs when we are talking about the value of writing your own JDBC management code. Spring definitely provides some convenience. Some developers may be the cat's meow at writing raw JDBC, but my experience has been raw JDBC = poor resource and exception handling. Something that Spring should help you with. Ralf Fischer-2 wrote: In my opinion this depends on the preferences of the developer and how he likes to organize his code. I never used Spring much. In the past I could never get used to the XML configurations. I simply don't like it. I especially don't like it in EJB2. Up to now I never had time to check out the Spring annotations. What I do like are working function keys in Eclipse, esp. F3 + F4 :-) Am 27.01.2009 um 20:38 schrieb johnrock: I have been reading 'Spring Recipes' and learning all about Spring 2.5 for the first time. I have read all about Spring JDBC
Re: Upgrading Struts from 1 to 2.0.14
SanJ.SANJAY wrote: Re-write? So if someone wants to upgrade struts, they have to be prepared to re-write their application in new version ..if thats the case then I think its the last thing a developer will do. If I have re-write the application, I would rather look at some much better frameworks, like spring-Hibernate/JSF. Not sure I'd say JSF is a better framework than *anything*, but I digress... You could always go with door #3: don't upgrade at all. S1 is still a perfectly viable framework, and especially if you have no pressing need (other than resume padding), then what's the point of upgrading at all? There are TONS of perfectly good applications still in the wild running on S1, and no one is clamoring to update many of them. Dave is 100% correct: S2 != S1. They have a few concepts in common naturally, but there is, I think it's fair to say, more that makes them different than makes them alike. A complete rewrite is probably the best bet (I heard tell of some porting possibilities, side-by-side execution possibilities, but I'm not sure what the status of those are). Or, as I said, no rewrite at all. Sometimes leaving well enough alone really is the best option. Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog newton.dave wrote: SanJ.SANJAY wrote: Thanks Dave for the reply. I did not follow any process. I just wanted to upgrade Struts from1 to 2.0.14. SO read at the user guide that you just need to throw the *.jar files to your lib(http://struts.apache.org/1.x/userGuide/installation.html#Prerequisites). That says Struts 1; you said you were upgrading to Struts 2. Anything found in Struts 1 documentation, by definition, isn't particularly useful for Struts 2. To upgrade is this not enough what is the complete process to do that? Re-write your application in Struts 2. I wasn't kidding when I said that Struts 2 is ***completely*** different than Struts 1. Dave - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Dijit Calendar usage in Struts 1.3
Ilan wrote: NB: http://docs.dojocampus.org/dijit/form/DateTextBox is what looks suitable. Again. I am just asking if there are any recommended practices when adding a Digit widgit to a Struts 1.3 jsp/view There really isn't... there's conceptually no difference between adding Dojo or anything else to a Struts 1.x application and adding it to a non-Struts application... S1 has no inherent knowledge of GUI widgets so it's all up to you. There aren't really even any recognized best-practices (yet) around RIA development in general, although many of us can point out things you probably should or shouldn't do when we see it. Dojo is nice because of its declarative approach to widgets, which saves you from having to muck around (as much) in the JavaScript world, if that's something you aren't comfortable with. That's how I'd suggest doing it (you have the option of that or a programmatic approach). Other libraries generally require a bigger investment in that regard (which many of us would argue is in fact better, but you also have to recognize that not every wants to travel that road... which was my motivation for creating APT, but I digress). It's a simple matter of a JavaScript import, a dojo.require() or two, and some extra attributes on a div (in simplest terms... your use case might dictate a little more work). FYI, the AjaxParts calendar I wrote literally 10 years ago, long before we had the really nice GUI toolkits we do today (or the level of knowledge we have now about making nice-looking and working widgets!), so I'd have been shocked if you thought it stacked up against Dojo's calendar :) Thanks, Ilan Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Displaying Please Wait message
RudyG wrote: function splashScreen() { document.write(p style='color:black;background-color:aqua;text-align:center;margin:25% 25% 10% 25%;border: medium double black;'Processing Data.brPlease Wait./p); document.forms[0].submit(); return true; } Put an alert(test); in place of your submit() line there... does the alert show up? I just tried in both FF and IE and in both cases it does... this indicates to me that it's the reference to the form that's not working. So, try alert(document.forms[0]); and make sure you're getting the object you expect. I actually expected the alert() to NOT work because I figured the document.write() call was overwriting your page, which would have made sense, but it appears document.write() actually appends to the document. I wouldn't swear to that, but that's what seems to be the case given my test. Anyway, as others have said, that's isn't the best approach anyway. Doing document.write() after the page has loaded is usually a good way to get yourself into trouble. I suggest instead doing something like this: body div style=width:100%;height:100%;display:none; id=pleaseWaitPlease wait/div div style=width:100%;height:100%; id=myContents !-- Everything else on your page goes here, including... -- input type=button onClick=document.getElementById('myConent').style.display='none';document.getElementById('pleaseWait').display='block'; /div /body You'll probably want to play some CSS tricks (or table tricks, if you don't mind the ridicule) to center the please wait message, which I assume you'd prefer. Also keep in mind with all the suggestions so far: what happens if the call to the server takes too long, or doesn't work as expected? Is there a graceful way for the user to recover? Probably not, and maybe you can live with that, otherwise you might want to do something fancier (possibly a click me to abort link below please wait, or a timeout() that fires after X period of time and redirects to some oops, the server's borked page). hth, Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Displaying Please Wait message
That's exactly the behavior I expected... odd that I didn't see it (IE7 and FF3.0.4 on XP). I can buy it's browser-dependent, just odd to hear that FF3 would be different on OSX than on Windows. Oh well, that's just *MORE* support for the idea of not using document.write() after the page has loaded :) Frank --- On Tue, 12/9/08, Frank W. Zammetti wrote: [...] I actually expected the alert() to NOT work because I figured the document.write() call was overwriting your page, which would have made sense, but it appears document.write() actually appends to the document. I wouldn't swear to that, but that's what seems to be the case given my test. It's browser-dependent; on OSX/FF3 the form is gone after the document.write() (at least when Firebug is installed...) so I get an error. Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Information from ESET Smart Security, version of virus signature database 3679 (20081209) __ The message was checked by ESET Smart Security. http://www.eset.com -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Refreshing image with AJAX request
Ajax by its nature deals with textual information only, be it HTML, XML, JavaScript or plain text. It has no capability to handle binary data (talking about XMLHttpRequest only, there are other Ajax techniques that can achieve it). So, when you make an Ajax request to get an image, you'll get the data back as planned, but you'll get a textual representation of it. There's no way to return an image, PDF, file to download, and so on, from an Ajax request, and have the browser do what you'd expect it to do with it because by the time it hits the browser it's just a stream of text that you have to deal with in JavaScript, and since there's no binary-handling capabilities in JavaScript (ignoring things like Gears for the moment), you're stuck essentially with a big blob of textual gibberish :) The reason the image works the first time by the way is because even though you point to an action, the img tag doesn't know that... so long as the URL it refers to returns a valid image, it'll work as expected. There's ways to do what you're trying to do... one is to simply update the src attribute of the img tag in script and point it to the action, and append a dummy parameter to it (something like the value of a new Date object) to avoid IE GET caching. So long as the action gives you the image back (based on whatever dynamic processing the target of your Ajax request currently does), that should work fine. I'll skip any other suggestions because they can get a bit wacky :) That one is simple, and should work fine. It's not an Ajax request per se as most people mean it, but it would update the image without rewriting the page, which is what counts :) hth, Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog On Thu, September 25, 2008 7:25 am, ManiKanta G wrote: Hi, I m returning an image through custom result from action, and when the page launches the image is getting displayed correctly. But when I clicked the link to refresh, image is coming from action, but as I've specified the targets= as the div, (instead of img tag) some garbage values are being displayed (I think it is displaying the content of the image). JSP: html head s:head theme=ajax/ /head body s:div id=imgDiv theme=ajax img src=ImageAction.action /s:div s:url action=ImageAction.action id=imgUrl/s:url s:a href=%{imgUrl} targets=imgDiv theme=ajaxRefresh/s:a /body /html Can some one tell me how to target an img tag instead of div tag? Regards, ManiKanta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Refreshing image with AJAX request
On Thu, September 25, 2008 12:07 pm, Manos Batsis wrote: Exactly, thus an XMLHttpRequest can be used update an image in two ways: * The image URL can be passed as information to the HTTP response, wrapped in XML or not (i.e. XMLHttpRequest.responseText). That can be used to update an image. Absolutely, but that doesn't quite do the same thing as updating the image as a result of the Ajax request. * The actual image data can be encoded in base64 and sent in an XML envelope obtained by an XMLHttpRequest. The base64 string can then be used with the data: URI scheme[1] to render the image. [1] http://en.wikipedia.org/wiki/Data:_URI_scheme Very interesting, I have to admit I wasn't aware of that, thanks for that info! No support in IE unfortunately, so may not be as useful (right now) as one might like, but still very interesting stuff. Cheers, Manos Frank -- Frank W. Zammetti Author of Practical Dojo Projects and Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology (For info: apress.com/book/search?searchterm=zammettiact=search) My look ma, I have a blog too! blog: zammetti.com/blog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 1 ajax integration
FYI, AjaxTags hasn't been supported or developed in a couple of years (the AjaxTags Laurie refers to here I mean... there's a whole AjaxTags project separate from this that's still very much alive). AjaxTags evolved into the AjaxParts Taglib, or APT for short, which is a component of Java Web Parts (JWP), as Laurie mentioned. If you (or anyone else) goes down this path I STRONGLY suggest NOT using AjaxTags at struts.sourceforge.net because it won't be supported (by me as the original author at least... others may decide to). APT on the other hand is 100% supported, has a decent community (not the largest, but quite helpful and I'm proud to say, from all evidence, quite happy with the product) and is still actively being developed (although the pace has definitely slowed of late). Also note that it is completely framework-agnostic (use it with S1, S2, or virtually any other JSP-based framework) and is immensely more powerful and flexiible than AjaxTags ever was. Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology for info: apress.com/book/search?searchterm=zammettiact=search Java Web Parts - javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! My look ma, I have a blog too! blog: zammetti.com/blog Laurie Harper wrote: Daniel wrote: Hello, Are there any good options to integrate ajax with struts 1? I woul like something based o tags. My problem is that i have an upload form html:form action=/something enctype=multipart/form-data styleId=somethingId. and the input files are like : html:file property=image1 styleId=image1/ The values are mapped on the form, private FileForm image1; .. Now, i whant to submit this form with ajax, and to react like it was a normal struts submit. To populate form values, s.o. Is there something that ca do what i need? Any library? Any Ajax library will let you accomplish that pretty easily, but you said 'something based on tags,' so I assume you are looking for a JSP tag library rather than a Javascript library? I haven't used it, but maybe Java Web Parts [1] or Ajax Tags [2] would have what you need? Or try googling for suggestions: http://www.google.com/search?q=%27Struts+1%27+Ajax+taglib [1] http://javawebparts.sourceforge.net/ [2] http://struts.sourceforge.net/ajaxtags/index.html L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: What can you do with S2?
Musachy Barroso wrote: I haven't looked into it yet, but I don't like how it uses a colon (;jsessionid=xwy), which might be valid, not sure. For the moment I am using glassfish, which starts really quick: https://maven-glassfish-plugin.dev.java.net/ musachy I don't think use of a semicolon is too unusual (although I can't comment on it's standards compliance)... I seem to remember Websphere doing that as well (I could be wrong, I don't have an install here to check, but that's what I remember seeing). Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects and Practical JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology for info: apress.com/book/search?searchterm=zammettiact=search Java Web Parts - javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! My look ma, I have a blog too! blog: zammetti.com/blog On 6/14/08, Al Sutton [EMAIL PROTECTED] wrote: Is it a REST thing or a Jetty thing? My view would be that as Jetty is adding the jsessionid Jetty should also recognize it, strip it off, and not pass it to the underlying webapp because it's part of the webapp magic of session to request mapping. Al. Musachy Barroso wrote: I just hit the same problem, I think the REST plugin doesn't handle that case very well. musachy On Fri, Jun 13, 2008 at 2:15 PM, Al Sutton [EMAIL PROTECTED] wrote: OK, Problem solved (switched to using apache and tomcat). Now, as I was saying... can you do better that http://www.lifefeed.info/ ? Al. Al Sutton wrote: OK, small hitch atm, Jetty in it's infinite wisdom is adding a jsessionid to all requests which is screwing over the REST plugin argggh!! Al Sutton wrote: Well, OK, S2.1 (but the title wouldn't sound so catchy). A push is being made for a high quality 2.1 GA release, and in order to do this the codebase needs a jolly good thrashing in every way imaginable, and the best way of doing this is to write S2.1 apps (and don't worry, the codebase loves a good thrashing). So, in the space of 5 working days, what can you produce that uses S2.1? On Monday I started writing a webapp that you can now play with at http://www.lifefeed.info/, so it's possible to write at least something in that amount of time :). So come on, show us what you can do Al. P.S. For those who are interested, in order to cut down on the coding time I used Hibernate, Sitemesh, and the S2.1 REST plugin. Feel like trying a better combination? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] What do you code today?
that they couldn't tell the difference unless we told them (we simply updated the icon on their desktop to point to a URL rather than an executable). All of those were internal-facing applications, some with client-facing applications. A few of the external-facing applications I've done: * An application for viewing of canceled checks online by shareholders. This was again developed in the 90's, but it actually did what we'd all probably now call COMET (you could actually sit and watch a queue waiting for your check to show up in real-time). * Created a portal (before there was such a term!) for our shareholders so they could monitor their holding, get messages from us, etc., all completely definable by them in terms of layout and content. * Created an HTML-based facility for folks to securely download generated investment reports as they saw fit. I frankly don't even remember a whole lot about this except that it had some requirements that couldn't be achieved with kind of basic technologies, it required some pretty fancy coding to make work as specified (it hasn't been live for a couple of years, hence I've cleared out that portion of my brain to make room for more useful knowledge!) Err, actually, I think that's it! Most of my work has been internal-facing. Oh, I actually consulted on an interface for CheckFree at one point too :) I'm leaving out all the Windows-only products I developed since I assume they aren't terribly relevant to anyone on a Struts list :) None of that is more recent than about 1997 anyway. -Ted. Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects and JavaScript, DOM Scripting and Ajax Projects and Practical Ajax Projects With Java Technology for info: apress.com/book/search?searchterm=zammettiact=search Java Web Parts - javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! My only partially serious blog: zammetti.com/blog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Alternative to html frames
Marc Eckart wrote: Hmm, in our case the single applications should not know it they are running in a portal or somewhere else. They should just see their context, nothing else. In my experience, which I admit was a while back and fairly limited, a portlet is specifically written as a portlet, i.e., it knows it's running within a portal and acts accordingly. Your requirements seem to say otherwise, so I'm thinking one strike against a portal approach. Another question to hold the application in simple divs: How does the action handling works if I include the applications in simple divs? If they redirect after an action to a jsp will they stay in the div or fill the whole page? Those types of things would affect the larger page, without modifying the application hosted in the div. I'm thinking that's a strike against a simple div-based approach. Kind of coming back to frames I think :) The question then is whether frames is viable or not... if the apps are all hosted under the same domain, your life is a lot easier. If not, trouble abounds! Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! 2008/2/13, Randy Burgess [EMAIL PROTECTED]: I would imagine that it is portal specific. It is up to the developer with AquaLogic. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 13 Feb 2008 09:45:34 -0500 To: Struts Users Mailing List user@struts.apache.org Subject: Re: OT: Alternative to html frames So that seems to say that it's left to the portlet developers to ensure there are no naming conflicts, am I understanding that right? Frank Randy Burgess wrote: As to the multiple identical portlets on the same web page question, I think most portals have a portlet id for each portlet or some other unique identifier. It is a best practice to append the portlet identifier onto function names, form names in the case of Struts 2 with client side validation, etc. Here we are developing for the BEA AquaLogic portal and we use the portlet id, which is numeric and unique for each portlet. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Tue, 12 Feb 2008 10:36:08 -0500 To: Struts Users Mailing List user@struts.apache.org Subject: Re: OT: Alternative to html frames Antonio Petrelli wrote: Frank, you might love this article :-) http://thedailywtf.com/Articles/I-am-right-and-the-entire-Industry-is-wrong .a spx Hehe :) It's a good example of the typical taking an idea too far. The world seems to be divided into the people that say frames are evil and should never be used (and IIRC, they are removed in HTML 5, so apparently those guys feel that way too) or those that say frames are DA BOMB and should always be used. I'm personally in neither camp. I'm simply someone that has used frames a number of times over the years with great success. They certainly aren't appropriate in every case, that's why I asked what the problems were that Marc was having. Portals is one way to go, sure. The last time I touched portals was a couple of years ago frankly, so maybe you could answer a question for me that I'm curious about... if I have a Javascript variable named firstName in two different portlets, how does the container avoid that name clash? For the past nearly two years (can't believe it's been that long!) I've been leading an effort to develop a single, unified back-office application that combines a number of new and existing applications into a cohesive whole. It's been one of the most successful project to date at my company, and it was only possible because of a frame-based (iFrames in that case) architecture. We have unique teams developing individual modules, and there's never a concern about name conflicts with either Javascript or HTML elements. I'm curious if a portal approach would have worked here too. It's interesting because in a very real sense we pretty much developed our own portal container! We have a common Framework that all the modules make use of, some common bits of functionality that runs across all of them (preferences, dropdown menu, some others). But they are 100% independent by and large (some of the modules are actually whole other applications hosted on other servers). Would a portal have allowed for things like that? If so, do you have any idea how it pulls that off without frames? Most importantly, avoiding those naming conflicts I
Re: OT: Alternative to html frames
So that seems to say that it's left to the portlet developers to ensure there are no naming conflicts, am I understanding that right? Frank Randy Burgess wrote: As to the multiple identical portlets on the same web page question, I think most portals have a portlet id for each portlet or some other unique identifier. It is a best practice to append the portlet identifier onto function names, form names in the case of Struts 2 with client side validation, etc. Here we are developing for the BEA AquaLogic portal and we use the portlet id, which is numeric and unique for each portlet. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Tue, 12 Feb 2008 10:36:08 -0500 To: Struts Users Mailing List user@struts.apache.org Subject: Re: OT: Alternative to html frames Antonio Petrelli wrote: Frank, you might love this article :-) http://thedailywtf.com/Articles/I-am-right-and-the-entire-Industry-is-wrong.a spx Hehe :) It's a good example of the typical taking an idea too far. The world seems to be divided into the people that say frames are evil and should never be used (and IIRC, they are removed in HTML 5, so apparently those guys feel that way too) or those that say frames are DA BOMB and should always be used. I'm personally in neither camp. I'm simply someone that has used frames a number of times over the years with great success. They certainly aren't appropriate in every case, that's why I asked what the problems were that Marc was having. Portals is one way to go, sure. The last time I touched portals was a couple of years ago frankly, so maybe you could answer a question for me that I'm curious about... if I have a Javascript variable named firstName in two different portlets, how does the container avoid that name clash? For the past nearly two years (can't believe it's been that long!) I've been leading an effort to develop a single, unified back-office application that combines a number of new and existing applications into a cohesive whole. It's been one of the most successful project to date at my company, and it was only possible because of a frame-based (iFrames in that case) architecture. We have unique teams developing individual modules, and there's never a concern about name conflicts with either Javascript or HTML elements. I'm curious if a portal approach would have worked here too. It's interesting because in a very real sense we pretty much developed our own portal container! We have a common Framework that all the modules make use of, some common bits of functionality that runs across all of them (preferences, dropdown menu, some others). But they are 100% independent by and large (some of the modules are actually whole other applications hosted on other servers). Would a portal have allowed for things like that? If so, do you have any idea how it pulls that off without frames? Most importantly, avoiding those naming conflicts I mentioned. I don't want to hijack a thread here, but it's already marked OT, and since you've got my curiosity piqued, I'll ask the questions :) Antonio Thanks, Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) 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] This email and any attachments (Message) may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Alternative to html frames
Marc Eckart wrote: The most applications are hosted in the intra net. We have another subnet with some Websphere servers secured by firewalls but they can all be accessed within out domain. So I think I'm back with frames respectively iframes :-) Sounds like it :) Yeah, I'd definitely think iFrames vs. regular frames here, sounds much more appropriate to what you're doing. One hint that might help... the document.domain property of each page can be manipulated to cover subdomains. For instance, if your main app is on mycompany.com, and you have to have app2.mycompany.com hosted in a frame, and you need to do cross-frame scripting between them, you can set document.domain to mycompany.com on both, which then allows the cross-frame scripting to occur. The limitation is it has to be the same base domain, but that allows you to bring subdomains into the picture. It's only when you have totally different domains (mycompany.com and othercompany.com say) that cross-frame scripting is impossible (or, dicey and requiring hackery at best). With that one hint in mind, you're probably good to go :) Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you all for your answers :-) Best Regards, Marc 2008/2/13, Frank W. Zammetti [EMAIL PROTECTED]: Marc Eckart wrote: Hmm, in our case the single applications should not know it they are running in a portal or somewhere else. They should just see their context, nothing else. In my experience, which I admit was a while back and fairly limited, a portlet is specifically written as a portlet, i.e., it knows it's running within a portal and acts accordingly. Your requirements seem to say otherwise, so I'm thinking one strike against a portal approach. Another question to hold the application in simple divs: How does the action handling works if I include the applications in simple divs? If they redirect after an action to a jsp will they stay in the div or fill the whole page? Those types of things would affect the larger page, without modifying the application hosted in the div. I'm thinking that's a strike against a simple div-based approach. Kind of coming back to frames I think :) The question then is whether frames is viable or not... if the apps are all hosted under the same domain, your life is a lot easier. If not, trouble abounds! Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! 2008/2/13, Randy Burgess [EMAIL PROTECTED]: I would imagine that it is portal specific. It is up to the developer with AquaLogic. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Wed, 13 Feb 2008 09:45:34 -0500 To: Struts Users Mailing List user@struts.apache.org Subject: Re: OT: Alternative to html frames So that seems to say that it's left to the portlet developers to ensure there are no naming conflicts, am I understanding that right? Frank Randy Burgess wrote: As to the multiple identical portlets on the same web page question, I think most portals have a portlet id for each portlet or some other unique identifier. It is a best practice to append the portlet identifier onto function names, form names in the case of Struts 2 with client side validation, etc. Here we are developing for the BEA AquaLogic portal and we use the portlet id, which is numeric and unique for each portlet. Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Frank W. Zammetti [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Tue, 12 Feb 2008 10:36:08 -0500 To: Struts Users Mailing List user@struts.apache.org Subject: Re: OT: Alternative to html frames Antonio Petrelli wrote: Frank, you might love this article :-) http://thedailywtf.com/Articles/I-am-right-and-the-entire-Industry-is-wrong .a spx Hehe :) It's a good example of the typical taking an idea too far. The world seems to be divided into the people that say frames are evil and should never be used (and IIRC, they are removed in HTML 5, so apparently those guys feel that way too) or those that say frames are DA BOMB and should always be used. I'm personally in neither camp. I'm simply someone that has used frames a number
Re: OT: Alternative to html frames
I think it all comes down to whether the different application/jsp's are in the same domain. If they are, then iFrames might do the trick nicely. Note that even if they are different subdomains, you can still do cross-frame scripting, it just requires some playing around with the document.domain attribute (this isn't something I've personally had to do, but I've read about it). If it's entirely different domains, then you're pretty close to dead in the water with frames (Brantley hinted at some ways around this in his reply, but it's probably fair to say that all those ways fall in the category of high hackery, so I for one would tend to avoid them). Why your bottom frame gets kicked out when you get your customer details, I'm not sure... I think you must be submitting a form in the bottom frame that has no target, and therefore it replaces what's in that frame. That makes sense, and it's what it should do. What you'd need to do instead is target a different frame, so the results of the submit appears there. It may be your top frame, or it may be a third frame that you need to add and organize so it's in the right place relative to your existing frames. But, I'll also say this: from what you've said, it doesn't really sound like you have truly independent applications to host. If that's the case, then iFrames probably *aren't* the write choice, something more AJAXy with div's almost certainly is. If everything is within the same domain (which doesn't mean the same server necessarily remember), then iFrames vs. divs is pretty close to a wash for all intents and purposes (with the caveats Brantley enumerated still being valid). I'd probably go with divs in that case just for the sake of simplicity and being more politically correct, but in practice the differences wouldn't be *that* great. By the way, anyone that says X, Y or Z is EVIL and should never be used is, in my opinion, very likely not worth listening to. As much as I dislike JSF, and am on record numerous times as saying as much, I've also always said it may well be the right choice in some situations. I've never, as far as I remember, said it was evil and should never be used, and people would be right to simply ignore me if I did. Same goes for iFrames, or anything else. There's certainly some things to consider before choosing iFrames, as Brantley pointed out, but someone that simply dismisses them out of hand as your colleague seem to be doing probably isn't the first person who's opinion you should put much stock in :) I mean, we've all heard the admonishment about not using a screw driver as a hammer because it's not the right tool for the job, and we'd all agree with that I'm sure. But, sometimes a screwdriver is all you have, so a screwdriver it is! And what's more, you might be working in a confined space where a hammer wouldn't fit, but a screwdriver does :) Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Marc Eckart wrote: Hi Frank, thank you and all others for your answers ;-) We have a similar aproach like you described. We have an application which acts as a portal. This application has two frames - one top frame for the navigation and another frame for hosting the embbeded (independet) application. One of this embbeded application is a customer search where you can select a customer, who can be used in another application. We have a customercontext, which exchanges the data of the customer between the applications. So the selected customer is just shown in the customer search and it is necessary to reimplement the displaying of the selected customer in every application where it should appear. So I want to put the displaying of the selected customer in the portal top frame to have it visible for all applications. The Problem is, when I want to display customer details, I have to call a different application/jsp which should display the details. But this whatever kind of display kicks the current application out of the bottom frame. That's when my thinking went to iframe :-) So I now have just one website, no frameset and I can put a ajax filled div tag over the iframe to display the customer details (I haven't tested this yet, so I don't know if it's really working :-) I asked some colleagues, what they think about it and they said iframes are EVIL :-) So thats why I asked to have another oppinions. I'm not sure if portlet container can help me with this issue. Best regards, Marc 2008/2/12, Frank W. Zammetti [EMAIL PROTECTED]: Antonio Petrelli wrote: Frank, you might love this article :-) http://thedailywtf.com/Articles/I-am-right
Re: OT: Alternative to html frames
Antonio Petrelli wrote: Frank, you might love this article :-) http://thedailywtf.com/Articles/I-am-right-and-the-entire-Industry-is-wrong.aspx Hehe :) It's a good example of the typical taking an idea too far. The world seems to be divided into the people that say frames are evil and should never be used (and IIRC, they are removed in HTML 5, so apparently those guys feel that way too) or those that say frames are DA BOMB and should always be used. I'm personally in neither camp. I'm simply someone that has used frames a number of times over the years with great success. They certainly aren't appropriate in every case, that's why I asked what the problems were that Marc was having. Portals is one way to go, sure. The last time I touched portals was a couple of years ago frankly, so maybe you could answer a question for me that I'm curious about... if I have a Javascript variable named firstName in two different portlets, how does the container avoid that name clash? For the past nearly two years (can't believe it's been that long!) I've been leading an effort to develop a single, unified back-office application that combines a number of new and existing applications into a cohesive whole. It's been one of the most successful project to date at my company, and it was only possible because of a frame-based (iFrames in that case) architecture. We have unique teams developing individual modules, and there's never a concern about name conflicts with either Javascript or HTML elements. I'm curious if a portal approach would have worked here too. It's interesting because in a very real sense we pretty much developed our own portal container! We have a common Framework that all the modules make use of, some common bits of functionality that runs across all of them (preferences, dropdown menu, some others). But they are 100% independent by and large (some of the modules are actually whole other applications hosted on other servers). Would a portal have allowed for things like that? If so, do you have any idea how it pulls that off without frames? Most importantly, avoiding those naming conflicts I mentioned. I don't want to hijack a thread here, but it's already marked OT, and since you've got my curiosity piqued, I'll ask the questions :) Antonio Thanks, Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT: Alternative to html frames
div's aren't equivalent to frames in most cases... the most important difference is that of namespacing... when you use frames, there's no worry of Javascript or DOM element name collisions, which can occur with simple div's. Marc, what aren't you happy about with the frame-based design? I've done a lot of that over the years and, once you learn to avoid the pitfalls, it's worked out great. I admit that in recent years I've leaned towards iFrames when frames were necessary at all, and certainly some of the problems associated with regular frames are avoided with iFrames... but what problems are you seeing that you're trying to overcome? That answer will guide your decision-making quite a bit. Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Laurie Harper wrote: Antonio Petrelli wrote: 2008/2/11, Marc Eckart [EMAIL PROTECTED]: But we are not so happy with this frame aproaches in general. But we don't know how to integrate the different (indepentend) applications transparent to the users without frames. A portlet container? Regular divs loaded via AJAX? (e.g. using s:div theme=ajax...) L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: open new window using Struts action
http://wiki.apache.org/struts/OpenWindowFromAction -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! jeppy wrote: Hi I'm using Struts 1.2.9, what i want is, if it's failed on validation then the error message display on the same page, but if the validation success then I want the result display in new window. Question: how can I trigger open new window using Struts (I don't want to open new window using form target or windows open). can anyone help me? thanks Regards, jeppy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] Best practice to transfer control to next page (out of JVM)?
On Tue, January 22, 2008 10:56 am, enthucoder wrote: Can you give some pointers on how do i contruct a HTTP POST Message in my Action and redirect the page to remote resource (non J2EE App)..? You wouldn't, in all probability, want to construct your own HTTP requests... take a look at HTTP Components (formerly Jakarta Commons HTTPClient): http://hc.apache.org/httpclient-3.x/ It should provide everything you need without you having to mess with all the gory details. Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Laurie Harper wrote: enthucoder wrote: Hi, Please bear with me, incase this turns out to be a dumb question. I want to transfer control to a non JSP page after I hit submit. Apart from this I am also sending some data as a HTTPS POST. In case of using response.sendRedirect(), it doesn't take care of the POST data. So, can anybody help me with what's the best practice in sending POST request from a Struts based J2EE application to another page (which is not a J2EE Application) I'm not sure I'm clear on what you want to accomplish. If you want to post a form to a page at a different URL outside your application, just use that URL as the form's action. Your Struts application needn't be involved at all. If the intention is to submit a form and have it processed by *both* your Struts app *and* an external resource, things are a little trickier. In that case, your Struts action would have to construct a new HTTP POST request using the request parameters it received from the browser. Your action would then handle sending the request to the remote resource (and streaming the response back to the browser if required), acting as a kind of pseudo-proxy. Perhaps you could explain what your overall objective is; perhaps this isn't the right approach to take to the problem. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/-S1--Best-practice-to-transfer-control-to-next-page-%28out-of-JVM%29--tp14280321p15021713.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S1] json and Action execute()
Setting an attribute on the request object makes it available to JAVA code, i.e., in a JSP, but ExtJS is Javascript running on the client. I believe, without knowing the specifics of what ExtJS expects, that what you really want to do is write to the response stream the serialization of your JSONObject. In other words, the response coming back from the server is text in the form of JSON (which will be present in the XHR object, which I presume ExtJS is using under the covers to make the request). Alternatively, you can do what you're trying to do in the Action, and then forward to a JSP that reads the attribute and outputs the JSON... this is probably a bit more work and overhead than you really need... writing to the response stream in the Action and then returning null for the forward does the trick. Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, January 22, 2008 4:09 pm, auz wrote: i have a problem with struts action form execute and json. im using ext js as mu ajax lib on client side and i need to retrive some departmentID and name depenting on a combo box, the problem is i dont know how to put JSonObect so that ext can see it here's my code any help is apritiated on jsp page - this is ext js script var departmentStore = new Ext.data.Store({ reader: new Ext.data.JsonReader({ totalProperty: 'total', root:'list' }, [{name: 'name'}]) }) var departmentCombo = new Ext.form.ComboBox({ store:departmentStore, displayField:'name', valueField: 'name', hiddenName : 'city', typeAhead: true, mode: 'local', triggerAction: 'all', width:150, emptyText:'select a city', applyTo:'department', selectOnFocus:true }); studyProgramCombo.on('select', function () { departmentCombo.reset(); departmentCombo.store.proxy= new Ext.data.HttpProxy({disableCaching:false,url: selfURI + 'JSONGetDepartment?studyProgram.json={studyProgram:{studyProgramID:' + studyProgramCombo.getValue() + '}}'}); searchCityCombo.store.load(); }); //the rest of the jsp code is irelevant NOTE selfURI variable is set to http://SERVERADDRESS/PROJECTNAME/ Struts Action execute code JSONArray list = new JSONArray(); JSONObject obj = new JSONObject(); while(result.next()) { obj.put(uid, result.getInt(departmentID)); obj.put(name, result.getString(name)); list.put(obj); } JSONObject rslt = new JSONObject(); rslt.put (total, list.length()); rslt.put(list, list); request.setAttribute(, rslt.toString()); //this name is unknown, i dont know what to put here return null; what did i do wrong/ didnt do? tnx a lot -- View this message in context: http://www.nabble.com/-S1--json-and-Action-execute%28%29-tp15028395p15028395.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2+AJAX]Which ajax libray did you use?
I definitely found YUI to be a pleasant experience as well while writing the chapter on it my second book. It's one of the easier libraries to pick up, even for novice JS programmers, which is something I've heard frequently from many different sources. That's not something you can say about a great many JS libraries out there today. My only complaint, if it can be called that, is that I don't find the widgets to be all that rich, as compared to many other available options. That's in no way to say they are bad, and they're more than sufficient, and even more appropriate, in many situations. But if you're looking to create real cutting-edge, very fancy UIs, YUI *may* not be the best choice. It's interesting that when someone asks what AJAX library to use with S2, most of the replies are really full-fledged RIA libraries. Certainly GWT falls in that category, as would YUI I think. Are you looking truly for AJAX alone, or do you really need all the bells and whistles, widgets, effects, all that sort of stuff? If it's plain AJAX you're after, there are some solid options. Prototype is one of the best, very small, simple, powerful. APT is good if you prefer the taglib and no JavaScript at all approach. DWR is probably my personal favorite right now (err, other than APT! LOL) Just the appropriate module from Mootools or Dojo is good. jQuery is certainly an excellent choice. That's just to name a few. If it's a full RIA library you're after, the answers might be a little different. ExtJS is one of the best (although there seems to be some concern about licensing that I've seen, I'm not fully conversant on it though). Dojo is always a viable choice, and is considerably more so since the 1.0 release hit. I personally have had *great* success with dhtmlx components (which couldn't be considered a full RIA library, but for widgets there's few better IMO). jQuery has a robust ecosystem of widgets from what I've heard (no hands-on experience yet). GWT is interesting if, as someone else said, you're willing to accept the paradigm shift. Probably everyone around here knows my personal feelings about JSF, but that doesn't change the fact that it's always worth considering. It all comes down to what you need. If it's just plain AJAX, it's a different question than if you are looking for widgets and the whole shebang (even if the line is certainly blurring these days). Frank -- Frank W. Zammetti Author of Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, January 17, 2008 7:18 am, Ted Husted wrote: On Jan 17, 2008 7:07 AM, tzhang [EMAIL PROTECTED] wrote: Thanks to Jeromy and Ted , your comments definitely help me a lot. I looked through the YUI website, the widgets are quite rich. I still concern about if I want to use the Struts2 + YUI, I have to know pretty much about the YUI , right? Is YUI easy to learn and use? Since our developers don't know much about javascript. It's not as much a matter of learning YUI as it is a matter of learning the proper way to code in JavaScript. A good start there is to go through the Douglas Crockford The JavaScript Programming Language videos on the YUI theatre site. * http://developer.yahoo.com/yui/theater/ (Really, do this today!) Personally, I find creating interfaces in JavaScript to be much simpler than wresting with server tags and scriplets. If we had in 1998 the JavaScript libraries and tools we have in 2008, server pages and JSF would never have been invented. As for YUI itself, my team was an early adopter of the DataTable (as in the first beta). We ran into issues, but even as novice JavaScript programmers, we never found an issue we couldn't patch by reviewing the code. Of course, having tools like FireBug that let you step through the scripts makes a world of difference. HTH, Ted http://www.StrutsMentor.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: [S2+AJAX]Which ajax libray did you use?
Tony Zhang wrote: For YUI + struts2, do you prefer to use YUI plugin for struts2 or just use YUI directly? I'm probably not the best person to answer that because I'm frankly not using S2 at the moment and have never looked at the YUI plugin. If you're comfortable with Javascript coding and client-side development, my *guess* is there's a little more freedom not using the plugin, but others can certainly shed more light there than I can. Do we need to use DWR to transfter data? DWR allows you to call server-side object from your client-side Javascript in a way that, for the most part, makes it look like it's all executing in the same process space. What that ultimately means is you stop thinking about transferring data entirely and instead think about the same things you think about when you code in pure Java: what methods or what objects do you call, and what object to you get back. It's a fantastically elegant way to go, but it also to a large extent makes what framework you use irrelevant (I'm personally becoming more and more convinced every day that it makes it not just irrelevant but actually counter-productive to use a framework at all). Frank -- Frank W. Zammetti Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) and Practical DWR 2 Projects (2008, Apress, ISBN 1-59059-941-1) 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: James Sanders wants to chat
Frank thinks you're wrong Dave... Frank thinks third-person is cool... Frank doesn't like people telling him what he can and can't do. Frank is angry. Frank. Dave Newton wrote: --- James Sanders [EMAIL PROTECTED] wrote: James Sanders wants to stay in better touch using some of Google's coolest new products. Only sports stars get to refer to themselves in the third person. d. - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: James Sanders wants to chat
Adam K wrote: On 12/10/07, Dave Newton [EMAIL PROTECTED] wrote: --- James Sanders [EMAIL PROTECTED] wrote: James Sanders wants to stay in better touch using some of Google's coolest new products. Only sports stars get to refer to themselves in the third person. Bob Dole is a sports star ? LOL Any time I see third-person stuff I can't help but think of that one episode of Seinfeld and just start laughing to myself (Jimmy is the guy at the gym that starts the whole third-person deal): Jerry: I don't know how you can eat that spicy chicken. George: George likes spicy chicken. Jerry: What's that? George: I like spicy chicken. Jerry: No, no you said GEORGE likes spicy chicken. George: No I didn't! Elaine: Yes you did. You said George likes spicy chicken. Jerry: You're turning into Jimmy! George: (irritated) George is getting upset! George: You wanted to see me, Mr. Steinbrenner? Mr. Steinbrenner: Yes, George, come in, come in. You know, George, Ive been your biggest supporter around here and that's why I was so disappointed to hear that you've been pilfering the equipment. George: George would never do anything like that. Mr. Steinbrenner: No, why would I? I own it. George: Right. Mr. Steinbrenner: So what are you saying? George: Why would George steal from the Yankees? Mr. Steinbrenner: He wouldn't. George: Of course not. Mr. Steinbrenner: Exactly. (George gestures: so there you are.) Mr. Steinbrenner: (mumbles to himself) I really don't know what the heck's going on here. George: Sir? Mr. Steinbrenner: Nothing. George: Well, I say it's about time for George's lunch! Mr. Steinbrenner: Yes, it is. (picks up brown bag) All right let's see what I have today. Darn it, it's ham and cheese again--and she forgot the fancy mustard. I told her I like that fancy mustard, you know you could put that fancy mustard on a shoe and it would taste pretty good to me. Oh, she made up for it with a cupcake though. Hey, look at this, you know I got a new system for eating these things, George. I used to peel off the chocolate. Now I turn it upside down, I eat the cake first and save the frosting for the end, it's almost a dessert dessert. (George slowly backs out of room) ROFL. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Poor Performance Hangs in IE
What kind of debugging/profiling have you attempted? I realize the tooling in IE doesn't stack up too well vs. FF, but basic things like alerts to narrow down where the delays are can still be done effectively. You said it's an XSLT-based app for instance... are the transformations being done client-side? Have you tried using something like HTTPWatch (there's some free alternatives out there if you Google a few seconds) which would tell you if it's transit time somehow, etc. Those types of things can at least narrow the problem down a little. Without knowing what your pages are doing, the description you gave of a page with no widgets definitely doesn't sound right... that's why I'm wondering where the XSLT is processed. Without knowing in more detail how the app is architected, it's tough to make reasonable suggestions, other than start with basic troubleshooting techniques, which is always sound advice. I can tell you we went through a ton of work in our app to get performance up to par. This app is using Struts 1.x, but Dojo, and a ton of AJAX and heavily client-side work... the single biggest performance improvement we saw was moving all static content, including Dojo, onto the web server. In fact, that alone made it acceptable, anything beyond that improvement was cake. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Dave Mills wrote: I just recently tried extracting the contents of org\apache\struts2\static into context_root\struts, though I also tried to eliminate as much of the dojo/ajax content in my app as possible. The whole app is pretty simple, mostly just displaying read-only data to users. The thing that I'm most confused/concerned about is the broken functionality in IE vs FireFox. For example, Account Summary is nothing more than getting a result set from a database, and displaying it. There are literally no forms/widgets on the page at all. In FireFox this page loads in a couple of seconds. In IE7, the screen disappears and then sits there loading/spinning for literally 5 minutes before either loading or getting a time out. -Original Message- From: Mike Jennings [mailto:[EMAIL PROTECTED] Sent: Monday, December 10, 2007 3:04 PM To: Struts Users Mailing List Subject: Re: Poor Performance Hangs in IE If you are using the static functions like dojo, then extract it into your public html directory so that they are not loaded from the jar. Then turn off loading the resources static. Dave Mills wrote: I've got a Struts 2.0.11 app running on Sun Web Server 7.1, which I recently re-wrote from an entirely Servlet/XSLT app. In pre-release testing everything seemed to be working well in terms of performance and functionality. However, when the app was moved into production (which is SSL) the performance has been horrible. In FireFox things generally work, even if they're a little slow, but in IE many pages hang for 5+ minutes. I removed all of the Dojo stuff, and that helped a little. I also tried going through the performance tuning stuff, but I'm unsure how to track down some of these issues. I don't know if this is even likely to be Struts-related, but any help would be great! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Spam/Virus scanning by CanIt Pro For more information see http://www.kgbinternet.com/SpamFilter.htm To control your spam filter, log in at http://filter.kgbinternet.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Excel, Struts and Downloading
Indresh Chadha wrote: I need to download a file from the server using AJAX Struts. Is this possible? No, it's not... well, assuming if by AJAX you mean using XMLHttpRequest, but since AJAX is a technique, arguably using things like hidden frames is still AJAX, and with that you could download a file certainly. But, assuming you mean XMLHttpRequest, or some library that uses it underneath, then no, you can't do this. The reason is that XMLHttpRequest gives you a chunk of text, or an XML DOM object, but in neither case can you write this to disk, or tell the browser to open it with an appropriate handled application. There are some nifty implementations out there using a hidden iFrame that makes it *look* just like what you'd expect an AJAX-based download to look like, but it's not, strictly speaking, a download via AJAX, which isn't (currently) possible). Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Frank W. Zammetti wrote: No, you don't need to implement StrutsFileDownload... What your doing should work fine... Can you throw together a quick, simple application that is nothing but a single Action that writes out ok to the response and returns null? See if that works... if what you describe is accurate, it sure sounds like something prior to your Action is getting the output stream, which probably should not be happening. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Jon Wynacht wrote: Hi Mike, Yup. I did that and no error is thrown now, however I don't get the download anymoreI'm thinking I need to implement StrutsFileDownload instead and that's my link? Thoughts? Jon On May 28, 2007, at 8:21 AM, Mike Baroukh wrote: Hi. Maybe it has worked before, but I think you actually make an error : If you already send a stream back to the client, it's not logic to return mapping.findForward() because nothing else can be send to the browser at this point. You should simply return null ... Mike Jon Wynacht a écrit : Hi, I asked this question of the POI user mailing list but it's probably a question for this list. If you don't know what POI is, check it out here: http://jakarta.apache.org/poi/ I used to run Struts 1.2.9, POI 2.5 and could generate Excel files from a servlet and download them without issue. I recently upgraded to Struts 1.3.5 and POI 3 and it looks like I broke that capability. I'm getting the following error: java.lang.IllegalStateException: getOutputStream() has already been called for this response I've searched through the Net and the archives here for info but nothing really seems to fit for my situation; it's mostly JSP. I'm calling an Action servlet which makes a call to the model and gets some data, creates a new workbook and then does this: snip response.setContentType(application/vnd.ms-excel); response.setHeader(Content-disposition, attachment;filename=\attendees.xls\); response.addHeader(Content-description, Event Attendees); ServletOutputStream stream = response.getOutputStream(); wb.write(stream); stream.close(); ... forward = SUCCESS; ... return mapping.findForward(forward); /snip It's what I did before I upgraded and things worked fine. Now they don't Any ideas? Am I missing something really obvious or was I bending the rules a bit and taking chances with my data in my previous config? Cheers and thanks, Jon Jon Wynacht [EMAIL PROTECTED] http://www.objectevolution.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Mike Baroukh --- Cardiweb - 31 Rue de Mogador Paris IXeme 06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED] http://www.cardiweb.com --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Jon Wynacht [EMAIL PROTECTED] http://www.objectevolution.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
Re: FreeMarker Question
I can't say with 100% certainty because the context of this isn't totally clear, but I'm relatively sure root is the root of the Freemarker data model, which means it's nothing but a plain old Java Map. Without seeing the rest of that class I couldn't tell you how to get a handle to root, but somewhere should be instantiation of some type of Map, and it should be named root. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, November 28, 2007 12:26 pm, MassimoH wrote: How do I do something like this: public class CustomFreemarkerManager extends FreemarkerManager { @Override protected BeansWrapper getObjectWrapper() { BeansWrapper beansWrapperInstance = super.getObjectWrapper(); // !!! This won't compile due to root. What is that object and how do I get a reference to it? !!! root.put(statics, beansWrapperInstance.getStaticModels()); root.put(enums, beansWrapperInstance.getEnumModels()); return beansWrapperInstance; } } -- View this message in context: http://www.nabble.com/FreeMarker-Question-tf4889630.html#a13996035 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] Practical Apache Struts2 Web 2.0 Projects
Congratulations Ian! I know how it feels to finally finish such an undertaking and see the end result. Kudos! I'm sure it's a fantastic book too (wink-wink). Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! (technical reviewer of Practical Apache Struts2 Web 2.0 Projects - LOL) On Tue, November 20, 2007 1:31 pm, Ian Roughley wrote: I'm pleased to announce the release of my newest book, Practical Apache Struts2 Web 2.0 project. And, no, I didn't pick the name :-) Where Starting Struts2 was high level and provided pointers for further exploration, this book dives deep into the framework providing a practical guide and lots of code examples for developing web application using Struts2. For those that are new to the framework, there is information on getting started, the request/response life cycle, and architecture and configuration (XML and zero configuration/annotation). And for those that are familiar with Struts2, more advanced topics such as security (yes, container, custom and Acegi are all provided with example code), workflows/wizards, RESTful web services, and Ajax are covered. For more information, the Apress web site is http://www.apress.com/book/view/9781590599037. I also believe it will be available through most major bookstores. /Ian -- Ian Roughley From Down Around, Inc. Consulting * Training / Mentoring * Agile Process * Open Source web: http://www.fdar.com - email: [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: ajax integration with struts
Lalchandra Rampersaud wrote: I would like to integrate ajax within a struts app, but I have no idea how to go about doing that. Is there a question in there somewhere? Ah, never mind, I was going to leave you with just the wise-a** answer, but I'll be nice :) AJAX isn't something you integrate into an app per se, it's a technique you make use of. What are you trying to accomplish? We can give you some options, because there's many in the AJAX space, once you tell us what it is you'll actually trying to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ajax integration with struts
Lalchandra Rampersaud wrote: I am making a calendar so I just want to update parts of the page. Well, that's indeed exactly what AJAX is for, but that's still not an especially specific answer. You may want to start from the beginning: http://www.omnytex.com/articles/ The article about AJAX with Struts will give you a decent start in understanding the basic concepts. The article about AjaxParts Taglib shows you one possible alternative. Another good reference is this wiki page on the Struts wiki: http://wiki.apache.org/struts/AjaxStruts This has links to yet more resources. If you're using Struts 2, there is some built-in AJAX capabilities you'll want to explore, but I'm frankly not that well-reversed in them myself, but just hop on over to the S2 docs and you should find what you need. Other popular options that would work with S1 or S2 include Dojo (dojotoolkit.org), jQuery (jquery.com) and Prototype (prototypejs.org), just to name a few. Frank -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 07, 2007 2:32 PM To: Struts Users Mailing List Subject: Re: ajax integration with struts Lalchandra Rampersaud wrote: I would like to integrate ajax within a struts app, but I have no idea how to go about doing that. Is there a question in there somewhere? Ah, never mind, I was going to leave you with just the wise-a** answer, but I'll be nice :) AJAX isn't something you integrate into an app per se, it's a technique you make use of. What are you trying to accomplish? We can give you some options, because there's many in the AJAX space, once you tell us what it is you'll actually trying to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ NOD32 2644 (20071107) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com __ Participe en Universidad 2008. 11 al 15 de febrero del 2008. Palacio de las Convenciones, Ciudad de la Habana, Cuba http://www.universidad2008.cu - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Write a thread to check database in web application
On Mon, November 5, 2007 10:40 am, Ashish Kulkarni wrote: Hi I have to write a thread in web application which will check some values in database, and then perform some function depending on the values. There wont be any user input and this thread should be called after like 10 minutes, also i want to have a jsp page from where i can maintain this thread, like stop, change the time it should run etc. Are there any specific J2EE api i can use, or should i just use a time thread, and store the handle to this thread in servlet context so i can access and modify it.. Spawning threads in a servlet container is generally considered Bad Voodoo(tm). If memory serves, it's even outlawed by the servlet spec. That being said, we've all done it, we'll all probably do it again, so mheh with the recommendations :) *That* being said, the key thing is to be extra careful doing it. Make sure the thread code is as bullet-proof as possible, most especially when it comes to resource usage. The reason spawning such threads is a bad idea in the first place is because they are not under control of the container and cannot be managed, nor can the resources it uses. Therefore, you'll need to do that yourself and be sure you play nice within the container. Also, be sure to mark it a daemon thread, otherwise you'll find it can and will hold up shutdown of the container. Bumping its priority as low as possible is probably also a good idea. Or you can do as Chris said and use Quartz, which will deal with most of these concerns for you. I say most because you can still write bad Quartz jobs that bork things as badly as if you didn't use Quartz at all, but it'll help a little bit. Ashish Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Write a thread to check database in web application
On Mon, November 5, 2007 11:17 am, Ashish Kulkarni wrote: Hi I dont need more then one thread, or a timer job i would say, this timer should sleep and then activate like after 10 minutes, check the database, if there is nothing to do go back to sleep. I will look into quartz, is it ok to use Java Timer and TimerTask to do it. Although I can't say I've ever done it that way, I don't see why it would be any worse than a straight Thread approach... it might even be better because the JVM might have a little more control over its management and can possibly cooperate with the container a little better, but I don't know that for sure (I also wouldn't be one bit surprised if Timers in Java are just a thin abstraction around a Thread anyway). I will make sure that the class with does check database function will not go in loop or be there for ever You'll also *probabyly* want to get your DB connection the same way as any app code, which I presume is a JNDI lookup. At least that way you get some of that benefit in term of management, but there is a prime example of making sure that thread code doesn't do anything unsavory... it'd be a real shame to somehow keep that connection from being returned to the pool and then find the thread continues to fine and eat a connection each time :) (I've had this debate with some folks and there's also the thought that NOT using the same conn pool as the container is actually better because then the pool can't be exhausted... then again, at that point you run the risk of chewing up the listener threads in the RDBMS, so six of one, half dozen of another I figure). Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 1.2: calling an action by javascript
On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote: i want to call an action by javascript, when a value in a html:select field changes. I want to fill my html:form with the data provided by the action. Any ideas? I don't know a lot of javascript :-( There's a couple if ways you could do that... one would be to call the submit() method of the form object, which every form in HTML has, then re-render the page with the updated data in the form. That's of course going to refresh the entire page, which I suspect isn't what you want. So, AJAX is probably what you want. Now, how you go about doing that, well, there's a few hundred options :) Because you don't know a lot of Javascript, you might want to consider the AjaxParts Taglib (APT) from Java Web Parts (JWP): http://javawebparts.sourceforge.net Direct to APT: http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html If you go to the download page, the cookbook has some examples that are very much along the lines of what you're asking for. If you go that route, we'll be more than happy on the JWP mailing list, or forums. Otherwise, prototype (http://www.prototypejs.org) is a good, simple option, but you will be writing some Javascript. thanks greetings from Berlin hth, Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 1.2: calling an action by javascript
On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote: i want to call an action by javascript, when a value in a html:select field changes. I want to fill my html:form with the data provided by the action. Any ideas? I don't know a lot of javascript :-( There's a couple if ways you could do that... one would be to call the submit() method of the form object, which every form in HTML has, then re-render the page with the updated data in the form. That's of course going to refresh the entire page, which I suspect isn't what you want. So, AJAX is probably what you want. Now, how you go about doing that, well, there's a few hundred options :) Because you don't know a lot of Javascript, you might want to consider the AjaxParts Taglib (APT) from Java Web Parts (JWP): http://javawebparts.sourceforge.net Direct to APT: http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html If you go to the download page, the cookbook has some examples that are very much along the lines of what you're asking for. If you go that route, we'll be more than happy on the JWP mailing list, or forums. Otherwise, prototype (http://www.prototypejs.org) is a good, simple option, but you will be writing some Javascript. thanks greetings from Berlin hth, Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 1.2: calling an action by javascript
I should also point out the presentation Ted Husted did at The Ajax Experience last week which dealt largely with APT. The slides for that presentation are here: http://ajaxexperience.techtarget.com/images/Presentations/Husted_Ted_RetrofittingStruts.pdf I'm not quite sure how long they will stay posted there though, so get it while it's hot :) Frank On Wed, October 31, 2007 10:48 am, Frank W. Zammetti wrote: On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote: i want to call an action by javascript, when a value in a html:select field changes. I want to fill my html:form with the data provided by the action. Any ideas? I don't know a lot of javascript :-( There's a couple if ways you could do that... one would be to call the submit() method of the form object, which every form in HTML has, then re-render the page with the updated data in the form. That's of course going to refresh the entire page, which I suspect isn't what you want. So, AJAX is probably what you want. Now, how you go about doing that, well, there's a few hundred options :) Because you don't know a lot of Javascript, you might want to consider the AjaxParts Taglib (APT) from Java Web Parts (JWP): http://javawebparts.sourceforge.net Direct to APT: http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html If you go to the download page, the cookbook has some examples that are very much along the lines of what you're asking for. If you go that route, we'll be more than happy on the JWP mailing list, or forums. Otherwise, prototype (http://www.prototypejs.org) is a good, simple option, but you will be writing some Javascript. thanks greetings from Berlin hth, 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 1.2: calling an action by ajax (javawebparts)
Can you tell where that error is coming from? I don't recognize it as an APT error, so I'm guessing Struts, but I don't recall ever seeing that before. You know what... what happens if you remove the ?xml and !DOCTYPE tags? Does it work then? Frank Ingo Villnow wrote: ok, the Text in the index-result is working now, but i want to use the actions and when i use parameters like /employee.do?task=updateajax=getEmployee then there comes an error message The reference to entity ajax must end with the ';' delimiter. Ingo Villnow schrieb: Hello, now i am using the javawebparts.ajaxparts and when i put all the things in a whole jsp-site, than the ajax is working: %@ taglib prefix=ajax uri=javawebparts/ajaxparts/taglib % ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleInsert title here/title /head body form action=# input id=btn type=button value=TESTBUTTON/ajax:event ajaxRef=employee/update attachTo=btn/ /form div id=result-div /div ajax:enable/ /body /html But when i am using it with struts-tiles than it doesn't work :-( - i think that's because the target in the ajax-config is not found. I don't now why. Without tiles, the target will be found. The index-result.txt is in the same directory as the jsp-site. ajaxConfig group ajaxRef=employee element ajaxRef=update event type=onclick requestHandler type=std:SimpleRequest target=index-result.txt parameter / /requestHandler responseHandler type=std:InnerHTML parameterresult-div/parameter /responseHandler /event /element /group /ajaxConfig When i use an action as a target, it doesn't work, too (e.g. target=action.do?parameter=xxxparam2=yyy). I use the DispatchAction, so with the parameter I can delegate or specifiy the method, which will be called in my action... Any ideas? Thank's a lot!! Greetings from Berlin Frank W. Zammetti schrieb: I should also point out the presentation Ted Husted did at The Ajax Experience last week which dealt largely with APT. The slides for that presentation are here: http://ajaxexperience.techtarget.com/images/Presentations/Husted_Ted_RetrofittingStruts.pdf I'm not quite sure how long they will stay posted there though, so get it while it's hot :) Frank On Wed, October 31, 2007 10:48 am, Frank W. Zammetti wrote: On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote: i want to call an action by javascript, when a value in a html:select field changes. I want to fill my html:form with the data provided by the action. Any ideas? I don't know a lot of javascript :-( There's a couple if ways you could do that... one would be to call the submit() method of the form object, which every form in HTML has, then re-render the page with the updated data in the form. That's of course going to refresh the entire page, which I suspect isn't what you want. So, AJAX is probably what you want. Now, how you go about doing that, well, there's a few hundred options :) Because you don't know a lot of Javascript, you might want to consider the AjaxParts Taglib (APT) from Java Web Parts (JWP): http://javawebparts.sourceforge.net Direct to APT: http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html If you go to the download page, the cookbook has some examples that are very much along the lines of what you're asking for. If you go that route, we'll be more than happy on the JWP mailing list, or forums. Otherwise, prototype (http://www.prototypejs.org) is a good, simple option, but you will be writing some Javascript. thanks greetings from Berlin hth, 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.503 / Virus Database: 269.15.14/1100 - Release Date: 10/30/2007 6:26 PM -- -- Frank W. Zammetti Founder and Chief Software Architect
Re: struts 1.2: calling an action by ajax (javawebparts)
I would suggest joining the JWP mailing list and re-posting this question there... the form manipulator handler was written by a member of the JWP team named Herman, and I know he'd be able to help you out quickly. I think though that there is an example of that handler in the JWP sample application that comes with the distribution, if memory serves, you may want to check that out first. If it's no help, moving to the JWP mailing list would probably be a good idea at this point since this isn't so much Struts-related any more. Frank Ingo Villnow wrote: I referred to the manual and there it suggested to use parameter instead, like this: requestHandler type=std:QueryString target=/ajax.do parametervalue=name/parameter /requestHandler then you can use: String value = (String) request.getParameter(value); Now i have another problem :-)) I want to use the std:FormManipulator als ResponseHandler, but I have problems with the correct XML-Response-Format and i don't find any code example for that. I am generating the form by using the struts-tags html:form,html:txt and so on. And with the FormManipulator i think i can manipulate the generated form. The other way maybe is that i generate my form like html type=text value=% . % after the ajax:event called my action and my action puts me a bean into the request. Greetings, Ingo Frank W. Zammetti schrieb: Can you tell where that error is coming from? I don't recognize it as an APT error, so I'm guessing Struts, but I don't recall ever seeing that before. You know what... what happens if you remove the ?xml and !DOCTYPE tags? Does it work then? Frank Ingo Villnow wrote: ok, the Text in the index-result is working now, but i want to use the actions and when i use parameters like /employee.do?task=updateajax=getEmployee then there comes an error message The reference to entity ajax must end with the ';' delimiter. Ingo Villnow schrieb: Hello, now i am using the javawebparts.ajaxparts and when i put all the things in a whole jsp-site, than the ajax is working: %@ taglib prefix=ajax uri=javawebparts/ajaxparts/taglib % ?xml version=1.0 encoding=ISO-8859-1 ? %@ page language=java contentType=text/html; charset=ISO-8859-1 pageEncoding=ISO-8859-1% !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleInsert title here/title /head body form action=# input id=btn type=button value=TESTBUTTON/ajax:event ajaxRef=employee/update attachTo=btn/ /form div id=result-div /div ajax:enable/ /body /html But when i am using it with struts-tiles than it doesn't work :-( - i think that's because the target in the ajax-config is not found. I don't now why. Without tiles, the target will be found. The index-result.txt is in the same directory as the jsp-site. ajaxConfig group ajaxRef=employee element ajaxRef=update event type=onclick requestHandler type=std:SimpleRequest target=index-result.txt parameter / /requestHandler responseHandler type=std:InnerHTML parameterresult-div/parameter /responseHandler /event /element /group /ajaxConfig When i use an action as a target, it doesn't work, too (e.g. target=action.do?parameter=xxxparam2=yyy). I use the DispatchAction, so with the parameter I can delegate or specifiy the method, which will be called in my action... Any ideas? Thank's a lot!! Greetings from Berlin Frank W. Zammetti schrieb: I should also point out the presentation Ted Husted did at The Ajax Experience last week which dealt largely with APT. The slides for that presentation are here: http://ajaxexperience.techtarget.com/images/Presentations/Husted_Ted_RetrofittingStruts.pdf I'm not quite sure how long they will stay posted there though, so get it while it's hot :) Frank On Wed, October 31, 2007 10:48 am, Frank W. Zammetti wrote: On Wed, October 31, 2007 10:19 am, Ingo Villnow wrote: i want to call an action by javascript, when a value in a html:select field changes. I want to fill my html:form with the data provided by the action. Any ideas? I don't know a lot of javascript :-( There's a couple if ways you could do that... one would be to call the submit() method of the form object, which every form in HTML has, then re-render the page with the updated data in the form. That's of course going to refresh the entire page, which I suspect isn't what you want. So, AJAX is probably what you want. Now, how you go about doing that, well, there's a few hundred options :) Because you don't know a lot of Javascript, you might want to consider the AjaxParts Taglib (APT) from Java Web Parts (JWP): http://javawebparts.sourceforge.net Direct to APT
Re: Ajax Call from a html link
Just an FYI, that article is a little outdated... APT's feature set is a bit larger than the article talks about now for one thing, although in glancing over it again, I don't see anything that's not applicable now. Also note that the link to Rick Reumann's article is no longer valid, it is now here: http://www.learntechnology.net/content/ajax/ajax_select_alter.jsp ... Rick also updated that article for APT fairly recently, so it's even better than it was. Lastly, I didn't provide a link to my own book in that article! D'oh! Here's one: http://apress.com/book/search?searchterm=zammettiact=search ... chapters 4 and 6 there are what's of interest, although as the note in the article says, they aren't based on the latest version, so although the underlying concepts are pretty much the same, some of the details are slightly different now. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 12:50 pm, Ted Husted wrote: I believe this exact example is included with the AjaxParts Taglib, which works well with Struts (1 or 2). If anyone is going to be using Ajax and JSP tags together, AjaxParts is a great way to go (and easy to learn!). * http://www.omnytex.com/articles/apt/ HTH, Ted. http://husted.com/ted/blog On 10/10/07, aarthy [EMAIL PROTECTED] wrote: I have a jsp page named tvshow.jsp, wherein I am populating the characters dropdown as and when the TV Show dropdown value changes , by calling the javascript in the onchange() of the select box. have added a html link, and I want to call the same function from my action class and I need to populate the character dropdown by clicking the html link. I am stuck up with this issue.Character dropdown is not populated with the data from tha action class. Need some help on this please! %@ page import=java.util.*% %@ taglib uri=http://struts.apache.org/tags-html; prefix=html % %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % script language=javascript function retrieveURL(url) { if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); req.onreadystatechange = processStateChange; try { req.open(GET, url, true); } catch (e) { alert(e); } req.send(null); } else if (window.ActiveXObject) { // IE req = new ActiveXObject(Microsoft.XMLHTTP); if (req) { req.onreadystatechange = processStateChange; req.open(GET, url, true); req.send(); } } } function processStateChange() { if (req.readyState == 4) { // Complete if (req.status == 200) { // OK response document.getElementById(characters).innerHTML = req.responseText; } else { alert(Problem: + req.statusText); } } } /script form action=ShowCharacters /jsp/tvshow.jsp Click here TV Show: select name=TVShowSelect onChange=retrieveURL('ShowCharacters.do?tvShow=' + this.value); option value=Lissie Maguire Lissie Maguire /option option value=That's so Raven That's so Raven /option option value=Dhoom machale Dhoom machale /option /select br Characters: /form ShowCharacters.jsp [EMAIL PROTECTED] import=java.util.ArrayList% %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean % %@ taglib uri=http://struts.apache.org/tags-html; prefix=html % %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % select name=TVShowSelect % ArrayList ch = (ArrayList)request.getSession().getAttribute(characters); String[] s = new String[ch.size()]; ch.toArray(s); for (int i = 0; i s.length; i++) { String name = s[i]; % option%=name%/option % } % /select Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Ajax Call from a html link
You already have the code, you posted it! :) If you're having some *specific* problem, you'll find many helpful people here, but just saying my code doesn't work, please help won't elicit too many (helpful) replies. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 3:13 pm, aarthy wrote: Can someone provide me with an example code.I need to implement ajax in my struts project, when html link is clicked. ghodgins wrote: Not to detract at all from the great JWP project but you can also do this with AjaxTags. The ajax:select tag is described here: http://ajaxtags.sourceforge.net/usage.html I used ajax:select to call an action that returned XML using the handy AjaxXmlBuilder that came with AjaxTags. Cheers, Grant -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 10, 2007 11:31 AM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: Re: Ajax Call from a html link Just an FYI, that article is a little outdated... APT's feature set is a bit larger than the article talks about now for one thing, although in glancing over it again, I don't see anything that's not applicable now. Also note that the link to Rick Reumann's article is no longer valid, it is now here: http://www.learntechnology.net/content/ajax/ajax_select_alter.jsp ... Rick also updated that article for APT fairly recently, so it's even better than it was. Lastly, I didn't provide a link to my own book in that article! D'oh! Here's one: http://apress.com/book/search?searchterm=zammettiact=search ... chapters 4 and 6 there are what's of interest, although as the note in the article says, they aren't based on the latest version, so although the underlying concepts are pretty much the same, some of the details are slightly different now. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 12:50 pm, Ted Husted wrote: I believe this exact example is included with the AjaxParts Taglib, which works well with Struts (1 or 2). If anyone is going to be using Ajax and JSP tags together, AjaxParts is a great way to go (and easy to learn!). * http://www.omnytex.com/articles/apt/ HTH, Ted. http://husted.com/ted/blog On 10/10/07, aarthy [EMAIL PROTECTED] wrote: I have a jsp page named tvshow.jsp, wherein I am populating the characters dropdown as and when the TV Show dropdown value changes , by calling the javascript in the onchange() of the select box. have added a html link, and I want to call the same function from my action class and I need to populate the character dropdown by clicking the html link. I am stuck up with this issue.Character dropdown is not populated with the data from tha action class. Need some help on this please! %@ page import=java.util.*% %@ taglib uri=http://struts.apache.org/tags-html; prefix=html % %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % script language=javascript function retrieveURL(url) { if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); req.onreadystatechange = processStateChange; try { req.open(GET, url, true); } catch (e) { alert(e); } req.send(null); } else if (window.ActiveXObject) { // IE req = new ActiveXObject(Microsoft.XMLHTTP); if (req) { req.onreadystatechange = processStateChange; req.open(GET, url, true); req.send(); } } } function processStateChange() { if (req.readyState == 4) { // Complete if (req.status == 200) { // OK response document.getElementById(characters).innerHTML = req.responseText; } else { alert(Problem: + req.statusText); } } } /script form action=ShowCharacters /jsp/tvshow.jsp Click here TV Show: select name=TVShowSelect onChange=retrieveURL('ShowCharacters.do?tvShow=' + this.value); option value=Lissie Maguire Lissie Maguire /option option value=That's so Raven That's so Raven /option option
RE: Ajax Call from a html link
Well, what debugging have you attempted? Are you running in Firefox with Firebug for instance and seeing some client-side error? Have you verified that your Action is getting called? Have you examined the returned data to ensure it's correct? -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 3:30 pm, aarthy wrote: In my code /jsp/tvshow.jsp Click here when the html link is clicked, it does not populate the second drop down box with values. I dont know what the problem is? Frank W. Zammetti wrote: You already have the code, you posted it! :) If you're having some *specific* problem, you'll find many helpful people here, but just saying my code doesn't work, please help won't elicit too many (helpful) replies. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 3:13 pm, aarthy wrote: Can someone provide me with an example code.I need to implement ajax in my struts project, when html link is clicked. ghodgins wrote: Not to detract at all from the great JWP project but you can also do this with AjaxTags. The ajax:select tag is described here: http://ajaxtags.sourceforge.net/usage.html I used ajax:select to call an action that returned XML using the handy AjaxXmlBuilder that came with AjaxTags. Cheers, Grant -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 10, 2007 11:31 AM To: Struts Users Mailing List Cc: Struts Users Mailing List Subject: Re: Ajax Call from a html link Just an FYI, that article is a little outdated... APT's feature set is a bit larger than the article talks about now for one thing, although in glancing over it again, I don't see anything that's not applicable now. Also note that the link to Rick Reumann's article is no longer valid, it is now here: http://www.learntechnology.net/content/ajax/ajax_select_alter.jsp ... Rick also updated that article for APT fairly recently, so it's even better than it was. Lastly, I didn't provide a link to my own book in that article! D'oh! Here's one: http://apress.com/book/search?searchterm=zammettiact=search ... chapters 4 and 6 there are what's of interest, although as the note in the article says, they aren't based on the latest version, so although the underlying concepts are pretty much the same, some of the details are slightly different now. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 10, 2007 12:50 pm, Ted Husted wrote: I believe this exact example is included with the AjaxParts Taglib, which works well with Struts (1 or 2). If anyone is going to be using Ajax and JSP tags together, AjaxParts is a great way to go (and easy to learn!). * http://www.omnytex.com/articles/apt/ HTH, Ted. http://husted.com/ted/blog On 10/10/07, aarthy [EMAIL PROTECTED] wrote: I have a jsp page named tvshow.jsp, wherein I am populating the characters dropdown as and when the TV Show dropdown value changes , by calling the javascript in the onchange() of the select box. have added a html link, and I want to call the same function from my action class and I need to populate the character dropdown by clicking the html link. I am stuck up with this issue.Character dropdown is not populated with the data from tha action class. Need some help on this please! %@ page import=java.util.*% %@ taglib uri=http://struts.apache.org/tags-html; prefix=html % %@ taglib uri=http://struts.apache.org/tags-logic; prefix=logic % script language=javascript function retrieveURL(url) { if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); req.onreadystatechange = processStateChange; try { req.open(GET, url, true); } catch (e) { alert(e
Re: [OT] Ajax recommendations for use with Struts1.1
I plan on using extjs for the last chapter of the book I'm currently writing as it impressed me quite a bit as well... I won't be using the AJAX functionality, but as far as widgets go, looks very promising. To Ted's point though, I haven't checked out the source code... YUI absolutely has some of the most well-written Javascript you'll find anywhere... I consider myself quite competent in client-side coding, but there are some libraries out there that I've had to hack that give me a headache trying to follow, but YUI doesn't suffer from that in the least. Clean, well-documented, as Ted said, a pleasure to deal with whether you have to modify it or not (I do wish the widgets were more full-featured and, frankly, cooler-looking, but there's something to be said for simplicity too). Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, October 3, 2007 11:35 am, Rick Reumann wrote: On 10/3/07, Ted Husted [EMAIL PROTECTED] wrote: Just to chime in late ... an Ajax library that does well the sort of things Frank is describing is the Yahoo User Interface (YUI) Library. Reading the source for the YUI library is an absolute pleasure! Thanks Ted, I'll have to check that out. Right now, I was thinking of going with extjs for some things. http://extjs.com/ Pretty neat stuff. Going to check out YUI now. - 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]
[Tangential] Re: [s2] Struts head tag KILLS ( 10s) page load time
If you're not going to use the built-in AJAX support in S2, you may also want to have a look at AjaxParts Taglib (APT): http://javawebparts.sourceforge.net/javadocs/javawebparts/ajaxparts/taglib/package-summary.html ... which is a component of Java Web Parts (JWP): http://javawebparts.sourceforge.net The JWP example app demonstrates APT pretty thoroughly. I know some folks use APT with S1 and like it, and it should work just as well with S2 (assuming you're using JSPs I suppose). I could see making this an S2 plug-in if there was some interest in that, I've had that thought before. Frank Haroon Rafique wrote: On Yesterday at 11:25pm, VR=Van Riper [EMAIL PROTECTED] wrote: VR [..snip..] VR VR The best workaround that I have found is to Just Say NO to the built VR in support for Dojo and instead to use Prototype judiciously. All my VR ajax logic is done that way. I don't use the builtin ajax support in VR s2 at all. This has worked well for the level of ajax support I need VR in my own webapp development these days. YMMV. VR VR -Van VR VR I'll say amen to that and second the advice. I don't use the builtin s2 ajax support either. Instead, I use prototype for Ajax requests and use dexagogo/prototype for client-side validation. Cheers, -- Haroon Rafique [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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tangential] Re: [s2] Struts head tag KILLS ( 10s) page load time
I'll see if I can find some time this weekend... the only thing that's really stopped me in the past when I thought of it is that it's really so darned easy to drop in manually (two added JAR files, one config file and one context param in web.xml), there's almost no benefit to it being a plug-in that I can see (nor am I 100% sure it can be at this point... can I set context params somehow from a plug-in?)... other than having it available in one place with all the other plug-ins, which would be a little more convenient. But I'll go ahead and see if I can do it over the next 2-3 days... I should probably bump the DataVision plug-in to 1.0 anyway, it appears stable enough at this point. Might as well do all the plug-in work together! Frank Musachy Barroso wrote: I could see making this an S2 plug-in if there was some interest in that, I've had that thought before. That would be a pretty good idea :) musachy - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Tangential] Re: [s2] Struts head tag KILLS ( 10s) page load time
I agree, and that's the thought that stopped me from doing this in the past. I do think it would be nice to bring APT to a wider audience, and making it a plug-in would probably give it more exposure and have that effect, but it's not the best reason to do something like this. I may still do it if I can find the time, but it's not a priority in any way. Thanks Musachy! Frank Musachy Barroso wrote: If you don't have plugin anything, there isn't any real benefit to it, but I haven't looked at JWP. musachy On 9/21/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: I'll see if I can find some time this weekend... the only thing that's really stopped me in the past when I thought of it is that it's really so darned easy to drop in manually (two added JAR files, one config file and one context param in web.xml), there's almost no benefit to it being a plug-in that I can see (nor am I 100% sure it can be at this point... can I set context params somehow from a plug-in?)... other than having it available in one place with all the other plug-ins, which would be a little more convenient. But I'll go ahead and see if I can do it over the next 2-3 days... I should probably bump the DataVision plug-in to 1.0 anyway, it appears stable enough at this point. Might as well do all the plug-in work together! Frank Musachy Barroso wrote: I could see making this an S2 plug-in if there was some interest in that, I've had that thought before. That would be a pretty good idea :) musachy - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Spring tutorial
I echo Dave's sentiment, but you need to determine what your data access needs are before deciding one way or another. Many people really like the ORM approach using something like Hibernate. Others like pure JDBC, or at least *close* to pure JDBC, which is an area Spring can help in (it can help with Hibernate too as I understand it, but I have no experience there). Still others like something *roughly* in between like iBatis. If you have an existing database, my experience is that you might be better off going closer to the pure JDBC approach. I've found that using Hibernate (and I presume any ORM tool) with an existing database can *sometimes* lead to frustrations and designs that aren't as good as they otherwise could be. This in no way is saying you *can't* use Hibernate with existing databases, of course you can, but it may not be the best choice. If your starting with no database, I think it probably comes down more to philosophy than anything else. If you'd like to make your database model your domain objects, then something like Hibernate will probably serve you well. If you prefer to hammer out the database schema first and develop the app to consume it, you may want to go the other way. I'm always a little concerned using Hibernate and similar tools because I've never been convinced they perform as well as getting closer to the metal allows you to. I'm not a fan, in *most* cases, of trusting tools to essentially write code for me, which SQL is a form of IMO. Still, I've used Hibernate a few times and had success with it, so it can't be that bad, can it?? :) Still, if I was writing a high-volume transactional system, I think I'd be leaning away from an ORM package, so it comes down to my first sentence: determine what your needs really are first, then look at the alternatives. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! rama krishna yalagandula wrote: --=_Part_42524_19997682.1190414900433 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline Hi, I am new to struts 2.0.9 ... Earlier I worked on oracle Developer Tools .. Now we have to migrate From Oracle to Java Struts I need to connect to database several times so do I need to use Spring Frame Work(as I heared from my supervisor) Thanks in advance Regards Rama... --=_Part_42524_19997682.1190414900433-- -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Struts head tag KILLS ( 10s) page load time
If Dojo is being used for AJAX in this case, that's my guess. I know from experience that Dojo, can issue a TON of requests even if you think your only loading a small portion of it. Assuming this guess is correct, Musachy, does S2 use a custom build of Dojo? If not, that might be worth considering. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! chengas123 wrote: Hi, I am working on a Struts 2 page and page load times are way too high. I tracked it down to the Struts head tag, which I have as follows: s:head theme=ajax / Without the tag, my page issues 3 requests and takes 453ms to load. With the tag, the page issues 54 requests taking 12.24s to load. Is there something I am doing wrong here? Thanks, Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [s2] Struts head tag KILLS ( 10s) page load time
The OP should try that cache=true setting first obviously... I'd be surprised if that didn't get rid of all the requests... we had exactly the same experience in my current project, even though we're not using S2, and we found the custom build solved the problem (in addition to caching static content like JS files on the web server, but that's something else). Frank Don Brown wrote: Musachy, has this been fixed in 2.1? Are the number of requests happening because we are using Dojo's lazy import feature? Don On 9/21/07, Musachy Barroso [EMAIL PROTECTED] wrote: Only on 2.1 Frank, if you set cache=true it will use a custom build that includes the files needed by the S2 widgets. The first download will be big but it will be cached by the browser. To the OP: Are you using ajax? if not, don't set theme=ajax on head. regards musachy On 9/20/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: If Dojo is being used for AJAX in this case, that's my guess. I know from experience that Dojo, can issue a TON of requests even if you think your only loading a small portion of it. Assuming this guess is correct, Musachy, does S2 use a custom build of Dojo? If not, that might be worth considering. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! chengas123 wrote: Hi, I am working on a Struts 2 page and page load times are way too high. I tracked it down to the Struts head tag, which I have as follows: s:head theme=ajax / Without the tag, my page issues 3 requests and takes 453ms to load. With the tag, the page issues 54 requests taking 12.24s to load. Is there something I am doing wrong here? Thanks, Ben - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Hey you! Would you help me to carry the stone? Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Ajax recommendations for use with Struts1.1
Hi Rick, AjaxParts is still a good alternative, especially given your past experience. It's still very much alive, and probably even a bit better than the last time you used it. As Adam said, DWR is another alternative I think very highly of as well (highly enough to be nearing completion of a book about it). We've used Dojo at work with good success, although I've always had a little bit of unease with it (and we're actually trying to move away from it little by little), but that shouldn't dissuade you from checking it out (especially if you just need AJAX out of it, I think you could be OK with it). Prototype is always a good option, very minimal and easy to use. I'd personally look at what you want/have to do... if you still want to stay away from Javascript as much as possible, that's always been an area that AjaxParts excels in (and I think doesn't have too many rivals in that regard frankly). If you have some leeway though, you can have a very compelling architecture with DWR and Spring mixed in. You find that you really don't need any framework at all, and the code you write is very elegant. This is the direction I'm pushing at work, and I'm getting some traction given some early successes with the concept. With the restrictions you have though, AjaxParts might be your best bet, especially if keeping the Javascript you have to write to a minimum is something important to you. It'll still I think require the least amount of effort to work with Struts 1.1 your using, require the least amount of change to anything that may already exist. DWR leads down a different path, and most of the other options, I believe, don't really offer anything all that different from one another. There's always GWT too, although if you have to use Struts I'm not sure what integration options there are (nor am I sure you could use the older JDK version). I'm not aware of any other options that would, were I in your shoes, get me all that excited. Frank Rick Reumann wrote: Hey all, unfortunately I'm going to be stuck on a new project has to use Struts1.1 - not that I'm against Struts it's just that I'd rather use something less archaic like Struts2 - We have to run on an old server( Weblogic8.1), won't upgrade to java5, servletspec2.3/jsp1.2), have to use offshore help, etc, they want to use struts1.1. I'm prefacing it with that because I'm looking for suggestions in dealing with several components that are going to have to rely on using Ajax. I'd like to know some of your recommendations. I've had great experience in the past with AjaxParts ( http://javawebparts.sourceforge.net/) and will probably use them again - but being out of the front-end loop for a long time, I could be missing out on some other ajax libraries that have come out recently. Just a few caveats... 1) Has to run using some older specs (Java1.4, Servlet2.3/JSP1.2 ) 2) I'd rather have easy to use and customize over a 'full featured gigantic suite of components. Thanks for any recommendations. No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.487 / Virus Database: 269.13.22/1015 - Release Date: 9/18/2007 11:53 AM -- -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Ajax recommendations for use with Struts1.1
Roger Ye wrote: Hi Frank, I'm interested in the experience with DWR and Dojo you have got, so why are you trying to move away from Dojo? then move to which? is is DWR? Let me begin by giving the caveat that we started with Dojo 0.3.1, and have never had the time to upgrade, so we're still on that version. We've also had to make quite a few custom mods (not just a custom build, actual Dojo code changes) to it to get it to do everything we needed, which makes upgrading that much harder. For reference, we're using dojo.io.bind, plus some widgets (tab, calendar, button, floating pane and menu). We used to use the button widget too, but swapped that out for performance reasons, believe it or not! We're moving away from Dojo because of one realization: it's better to build with best-of-breed products than to try and grab one do-it-all product. We choose Dojo initially for two reasons. One, it was gaining a lot of steam at the time we made the decision, and two, because of the nature of our development team (they had no RIA development experience and didn't have a ton of Struts experience either), we felt it would be better to have one library that did everything we needed. We decided we wanted to use Struts (1.2.7) because there was at least *some* familiarity on the team with it, so we needed to find some method of AJAX that could co-exist with it, so DWR wasn't the best choice at the time either. And really there was a third reason: there was no dominant Javascript/AJAX library really, but Dojo seemed to be on its way to becoming that (and still may be), so there really wasn't a *whole* lot of choice, given some of our challenges. And since someone is bound to ask, we considered AjaxParts of course, would be crazy if we didn't consider the project I started! We decided against it because the nature of the app we were charged with building would have required a ton of custom handlers to be coded, and when you get to that point, the benefits of APT start to melt away. We had our problems with Dojo along the way ranging from performance to bugs to missing features. But again, to be fair, we're talking about a fairly old version at this point. We overcame all of these, and the app is very highly regarded now, so the choice hasn't actually hurt us in any big way. The drive towards DWR is coming from me specifically because it starts you down a path of an architecture that makes a ton of sense to me: best-of-breed widgets and support libraries on the client, and nothing but POJOs on the server. No framework like Struts to learn, no complicated Javascript to learn (at least for the remoting part of the equation) and very quick turn-around times because writing a POJO is quicker than anything Struts can offer (and the less said about EJBs, even 3.0 beans, the better). Mix in the right widgets and you can get an incredibly rich webapp up and running in almost no time at all. I'm also introducing Spring to a lot of people little by little (and learning it myself little by little), as part of our developing reference architecture, so we get a lot of benefit there too, and it integrates nicely with DWR. We're finding that a lot of the things we thought would be problems, like the desire to have method-level access control like you get with EJBs, is not much more work in this model. There are still some challenges of course (like not having il8n automatically like you can have with Struts), but overall it's working out very well. I've used DWR in a previous project, for me it's quite good, gotta love it, however, in the current project we use Struts 2 and Struts 2 seems to have some connection with Dojo, so I appreciate a lot if you could share your story with Dojo. I can't talk intelligently (as if that ever stops me!) about the AJAX support in S2 because I only have some playground experience with it... I've yet to use S2 in a real project that wasn't contrived for my own benefit... then again, with this simple DWR-based architecture gaining steam, I may never have to. Ironically, S2 does a lot of what we did in our project: abstracts away the details of Dojo. We pretty much built an API around Dojo so that our more junior developers barely knew they were using Dojo. Some of this was taglibs (especially where widgets were involved), other parts of it was a Javascript API that is more business/function-oriented, so for instance, instead of having to worry about how to do an AJAX call with Dojo, you instead call our submitFormTargetTab() method, and that would deal with all the details and put the results in the specified tab on the screen (plus it deals with a lot of other related things that don't have to do with Dojo). Well, that's my .0006 cents on things. Thanks Roger Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED
Re: Ajax using XMLHttpRequest and Struts
Simply forward to a JSP and render your output there, same as any Struts Action. It can be XML, JSON, HTML, some custom format, whatever. I wish I had written that article showing that in the first place since this is a question that gets asked all the time, but I thought this was simpler (one less bounce to follow the ball through), but in retrospect.. :( Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, September 11, 2007 11:46 am, aarthy wrote: Hi, In the below code,how can I avoid the HTML coding in the action class?(http://www.omnytex.com/articles/xhrstruts/xhrstruts.zip) I tried many different codings,but everything failed. public class Example3GetCharactersAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm inForm, HttpServletRequest request, HttpServletResponse response) throws Exception { // Get a list of characters associated with the select TV show String tvShow = (String)request.getParameter(tvShow); if (tvShow == null) { tvShow = ; } ArrayList characters = getCharacters(tvShow); // And yes, I know creating HTML in an Action is generally very bad form, // but I wanted to keep this exampel simple. String html = select name=\CharactersSelect\; int i = 0; for (Iterator it = characters.iterator(); it.hasNext();) { String name = (String)it.next(); i++; html += option value=\ + i + \ + name + /option; } html += /select; // Write the HTML to response response.setContentType(text/html); PrintWriter out = response.getWriter(); out.println(html); out.flush(); return null; // Not forwarding to anywhere, response is fully-cooked } // End execute() // This method returns a list of characters for a given TV show. If no TV // show is selected, i.e., initial page view, am empty ArrayList is returned. private ArrayList getCharacters (String tvShow) { ArrayList al = new ArrayList(); if (tvShow.equalsIgnoreCase(StarTrekTNG)) { al.add(Jean Luc Picard); al.add(William T. Riker); al.add(Data); al.add(Deanna Troi); al.add(Geordi LaForge); } if (tvShow.equalsIgnoreCase(Babylon5)) { al.add(John Sheridan); al.add(Delenn); al.add(Londo Mollari); al.add(Stephen Franklin); al.add(Vir Cotto); } if (tvShow.equalsIgnoreCase(StargateSG1)) { al.add(Samantha Carter); al.add(Jack O'Neil); al.add(Teal'c); al.add(Daniel Jackson); al.add(Baal); } return al; } // End getCharacters() Thanks. -- View this message in context: http://www.nabble.com/Ajax-using-XMLHttpRequest-and-Struts-tf4423481.html#a12617736 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ajax using XMLHttpRequest and Struts
Something is wrong in your JSP... looks like that stack trace was cut off, but your beyond the AJAX parts at this point, you need to find the error in your JSP. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, September 11, 2007 2:25 pm, aarthy wrote: Frank, I tried forwarding it to a jsp page ShowCharacters.jsp select name=TVShowSelect %int i = 0; ArrayList ch = (ArrayList) request.getSession().getAttribute(characters); String[] s = new String[ch.size()]; ch.toArray(s); for (Iterator it = s.length; it.hasNext();) { String name = (String)it.next(); % option%=name%/option /select public ActionForward execute(ActionMapping mapping, ActionForm inForm, HttpServletRequest request, HttpServletResponse response) throws Exception { String tvShow = (String)request.getParameter(tvShow); if (tvShow == null) { tvShow = ; } ArrayList characters = getCharacters(tvShow); request.getSession().setAttribute(characters, characters); response.setContentType(text/html); return mapping.findForward(success); } // E But when I select some value from the first combo box(TVShowSelect),I get the message Problem:Internal Server Error. IN the logs,I get the following error message Servlet.service() for servlet jsp threw exception org.apache.jasper.JasperException: Unable to compile class for JSP: Stacktrace: at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:435) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:298) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:690) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870
Re: calling a javascript function from my java class
Is this Struts1 or Struts2? That will (potentially) change the mechanics a little, but in theory, sure, it's easy to do. Assume Struts1 for a moment... 1. User triggers event on the page that does the delete. This causes a Javascript function to be executed. 2. That function makes an AJAX request, using your favorite library. 3. Action is invoked (AJAX just requests a URL after all, which is what a Struts action mapping is) and does its work. 4. Action forwards to a JSP as is typical. This JSP can be something as simple as this: % if (request.getAttribute(deleted) != null) { % %=request.getAttribute(nodeID)% % } else { % NOT DELETED % } % Assuming the action put the deleted attribute in request if the delete was accomplished, as well as the ID of the ndoe that was deleted, that's all there is to it. 5. The response is returned to the client, and being an AJAX request, some Javascript function that you specified at the time the call was made, the AJAX callback function, is executed. Passed to it will be the response from the server. So, you simply do a quick check to see which string got returned, and if its != NOT DELETED, call whatever delete method likely exists for the tree widget your using (most provide this), passing it the response from the server, which is in fact the ID of the node to delete. No need to rebuild the tree, no need to re-render the page, no need to return an updated set of data, just delete the one node you need to. That's all there is to it. Now, you don't even need the JSP if you don't want to have it, you can write the same response out from the Action, but using a JSP, even for something as trivial as this, tends to be more flexible and easier to toy with. AJAX always works this way, basically, so if your talking Struts2 you may do some things slightly different because there's some built-in AJAX support that might hide some of this from you and make it easier, but basically it's the same underlying flow. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Session A Mwamufiya wrote: The jsp page sends a delete request to the struts action that determines whether or not the object associated with the node can be deleted from the database. The struts action removes the object from the database if all is well, and at this point, I would like to have the struts action notify the jsp that it can remove the node from the tree. Is there a way to set it up so that the jsp page gets a return value from the action and javascript within the jsp page removes the node accordingly? Thanks, Session 3. Generate JavaScript in the Ajax result that removes the node (and re-renders the tree if necessary; I don't know how all that works) and execute it. --- Chris Pratt [EMAIL PROTECTED] wrote: You can use the Rhino JavaScript interpreter to execute JavaScript from Java, but I don't think that's actually what you are looking for. It sounds like you are asking How to I run some JavaScript in the client's browser when something changes on the server? And the short answer is, you can't. At least not directly. Remember, the web uses a Request/Response model where the Browser makes a request and the server returns a response, so there is no simple way for the server to initiate something happening in the browser. Two options I can see are: 1. Have the browser make an AJAX request and the server can return the new DOM tree without the removed node 2. Have the browser resubmit the request and the new page can be built without the removed node. (*Chris*) On 9/6/07, Session A Mwamufiya [EMAIL PROTECTED] wrote: Hi, Does anyone have an example of how to call a javascript function from a java class? I want to call a javascript function that removes a node from a tree after a java class removed it from the database. Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: How to access the ActionForm in a JSP?
You can find the form as a request attribute with the same name you used in your config file, so: MyActionForm form = (MyActionForm)request.getAttribute(myFormName); Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: Newbie question here. Suppose I have action, helloworld.action which I use to grab a bunch of data I wish to display on a JSP page. My question is how do get a reference to that action object in the JSP page? The tutorials on the Struts2 website showed examples using form / tags, but I don't need to use form / tags. I just want to display data. Michael J. Remijan - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of Viruses or other Malware. Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to access the ActionForm in a JSP?
Oh, you know what, my bad... I'm on vacation this week and my brain is shut down even more than some would say it normally is... you asked about Struts2, and I answered for Struts1. Sorry about that, ignore what I said. For S2, let's say you have a String property name on your HelloWorldAction class, you can use: s:property value=name/ ...in your JSP to display it. You'll also need: [EMAIL PROTECTED] prefix=s uri=/struts-tags % ...to make that work. And of course, make sure you have an appropriate getter method on the Action too. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: So if I have helloworld.action defined as: action name=helloworld class=test.struts.HelloWorldAction result/WEB-INF/jsp/helloworld.jsp/result /action Then I can retrieve the object with: MyActionForm form = (MyActionForm)request.getAttribute(helloworld); ?? -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 04, 2007 8:31 AM To: Struts Users Mailing List Subject: Re: How to access the ActionForm in a JSP? You can find the form as a request attribute with the same name you used in your config file, so: MyActionForm form = (MyActionForm)request.getAttribute(myFormName); Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! REMIJAN, MICHAEL J [AG/1000] wrote: Newbie question here. Suppose I have action, helloworld.action which I use to grab a bunch of data I wish to display on a JSP page. My question is how do get a reference to that action object in the JSP page? The tutorials on the Struts2 website showed examples using form / tags, but I don't need to use form / tags. I just want to display data. Michael J. Remijan - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of Viruses or other Malware. Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 9/3/2007 9:31 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - This e-mail message may contain privileged and/or confidential information, and is intended to be received only by persons entitled to receive such information. If you have received this e-mail in error, please notify the sender immediately. Please delete it and all attachments from any servers, hard drives or any other media. Other use of this e-mail by you is strictly prohibited. All e-mails and attachments sent and received are subject to monitoring, reading and archival by Monsanto. The recipient of this e-mail is solely responsible for checking for the presence of Viruses or other Malware. Monsanto accepts no liability for any damage caused by any such code transmitted by or accompanying this e-mail or any attachment. - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Running Dojo on a struts project
It *looks* like your using a Dojo profile that doesn't include the pieces you need, and Dojo is going off and trying to import them and not finding them. Have a look here: http://www.nabble.com/djConfig-params-t2109960.html You should set djConfig.baseScriptUri first, see if that resolves your problem, then think about the profile your using. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Session A Mwamufiya wrote: Who has experience using Dojo? Please help me get it setup. I added the dojo.js file from the 0.9.0 release (I think it's the latest) to my webcontent folder in an eclipse WAP project, but firebug keeps giving me the same error djConfig.baseScriptUri has no properties getBaseScriptUri()dojo.js (line 155) Please help, Thanks, Session To follow up on this; I used firebug to try to figure out what was going on, and this is the error message I get in the console: djConfig.baseScriptUri has no properties getBaseScriptUri()dojo.js (line 155) loadPath(src/lang/__package__.js, dojo.lang, undefined)dojo.js (line 187) loadModule(dojo.lang, undefined, undefined)dojo.js (line 341) require(dojo.lang.*)dojo.js (line 419) [Break on this error] if(djConfig.baseScriptUri.length){ There seems to be an error in the dojo.js file. I'm using version 0.4.3 with ajax. Can someone send me the link to a working version of the file? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Session A Mwamufiya [mailto:[EMAIL PROTECTED] Sent: Monday, September 03, 2007 9:08 AM To: user@struts.apache.org Subject: Running Dojo on a struts project Hi, I'm attempting to follow a Dojo tree widget tutorial, http://willcode4beer.com/ware.jsp?set=dojoTreeWidget, where Dojo is used to define a tree. Unfortunately nothing comes up on the page, even though the page source shows the tree definition. The tree page is set as the result page for a dummy action (which executes), but that's the only connection I have between Dojo and struts. Is there anything in particular I need to do to get Dojo to run within a struts app? Thanks, Session - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sanitize Text
I'd be more inclined towards a filter here, preferably close to the top of the chain... my thought is it's better to deal with things like that as soon as possible because there's less chance of something exploitable down the pipe. We have a cross-site scripting filter in our standard security stack at work for precisely that reason. I realize your not stating security as your concern, but I think the argument would be very much the same... might not be an exploit your too worried about, but an exception thrown that breaks the app for the user isn't much better :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Toni Lyytikäinen wrote: You could just override the string conversion in xwork: http://struts.apache.org/2.x/docs/type-conversion.html define something like this in xwork-conversion.properties java.lang.String=org.example.MyConverter Then create a class MyConverter that extends the XWorkBasicConverter and override the behaviour of the convertValue method in the case of string to string conversion. I'm not sure if this is actually a good way, but it's easy enough and with simple configuration it works everywhere in you webapp. On 8/23/07, Ian Roughley [EMAIL PROTECTED] wrote: This is a good approach. In fact, you might start with the params interceptor - as it is responsible for assigning data to the action, and all that is needed is to sanitize before assignment. /Ian Richard Sayre wrote: I was wondering what the best approach would be for taking form data passed to an Action and removing 'special characters' from the data. I am having issues with users pasting text from word docs etc. We only support ISO-8859-1 as of now and there are some characters that Word will replace such as ' and with character that are outside the 8839-1 character set. I was thinking about an interceptor that would sanitize the request parameters before they are passed to the action. Is this a good approach? Can anyone suggest a better one? It does not matter if it uses Struts or not. Thank you - 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] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.484 / Virus Database: 269.12.2/967 - Release Date: 8/22/2007 6:51 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Oleg Konovalov wrote: No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? You wouldn't get it from SESSION, you'd get it from REQUEST... Unless your intention is to have a session-scoped ActionForm, but then you wouldn't get at the value as you've shown anyway (in fact, even if it's a request-scoped from, that's the wrong way to get the value, since your bypassing Struts to do it). Since you aren't using AJAX, and you want a single form, all you need to do is set things up in a 100% typical Struts fashion... have the HTML form submit to the Action you want it to, and connect an ActionForm, probably request-scoped, to that Action. Make sure your ActionForm includes the properly named getter/setter/field for it. Then, on your HTML form, add a hidden field with the name rowId, and make each button on the form a submit button (you can have more than one), and add an onClick event to it that does this: this.form.rowId.value='${list.rowId}'; That should do it. Then, in your Action you just do: String rowId = form.getRowId(); ...assuming form is the name of the ActionForm parameter. That should be all you need to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick=form.action='action.do?command=notify' * value*=${list.rowId} instead of HTML input type=image... ? Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it. Dave's suggestions are good too, it just comes down to how you really want this to work. TIA, Oleg. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.15/949 - Release Date: 8/12/2007 11:03 AM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Oleg Konovalov wrote: make each button on the form a submit button I can't do it, because button has to have image, so I use input type=image... Will that work ? I believe so... best way to be sure would be to try it :) ... but I don't see why it wouldn't. Also, are you sure thisthis.form.rowId.value='${list.rowId}'; will work together with myform.action='action.do?command=notify' I think, Javascript will get screwed up - will complain. And I will have to make all inside a scriplet, something like: onClick=% form.rowId.value=*c:out* *value=*'${list.rowId}/; form.action='action.do?command=notify' % Is that better ? No, that would be wrong... go ahead and give it a try, you'll get a compile error on the JSP because the expression isn't valid. You may however be right to a degree... you may need to use c:out in place of ${list.rowId} (I think ${list.rowId} is valid JSP 2.0 EL, but that assumes JSP 2.0)... I think that's a valid JSP expression... again, give it a try, this is a syntactical issue that a minute or two of playing will resolve, it's the conceptual part you need to understand first. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On 8/13/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: No, I am not using any AJAX. On Submit it supposed to process that row, go to DB and refresh the whole page, so to come back on the same page. Also, my form is declared as html:form, so onClick I use form.action='action.do?command=notify', I can't get rid of it, but it doesn't want to coexist with any Javascript. I would not like to have multiple forms on one JSP page. So which of your suggestions would you recommend in my case ? And how do I get a value of rowId in Action class (notify action), via request.getSession().getAttribute(rowId) ? You wouldn't get it from SESSION, you'd get it from REQUEST... Unless your intention is to have a session-scoped ActionForm, but then you wouldn't get at the value as you've shown anyway (in fact, even if it's a request-scoped from, that's the wrong way to get the value, since your bypassing Struts to do it). Since you aren't using AJAX, and you want a single form, all you need to do is set things up in a 100% typical Struts fashion... have the HTML form submit to the Action you want it to, and connect an ActionForm, probably request-scoped, to that Action. Make sure your ActionForm includes the properly named getter/setter/field for it. Then, on your HTML form, add a hidden field with the name rowId, and make each button on the form a submit button (you can have more than one), and add an onClick event to it that does this: this.form.rowId.value='${list.rowId}'; That should do it. Then, in your Action you just do: String rowId = form.getRowId(); ...assuming form is the name of the ActionForm parameter. That should be all you need to do. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Thank you, Oleg. On 8/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick= form.action='action.do?command
Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Oleg Konovalov wrote: I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action [notify] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts. Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do: this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it. Maybe I should use html:submit src=pic.gif onclick=form.action='action.do?command=notify' * value*=${list.rowId} instead of HTML input type=image... ? Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it. Dave's suggestions are good too, it just comes down to how you really want this to work. TIA, Oleg. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add Web Service to Struts Web App
No, currently this does not apply for S2... it's in my to-do list to bring this capability to S2, but I have no ETA on that at the moment. I don't know if there are other options that do something similar already for S2, I wouldn't be surprised if there was. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Leonidas Papadakis wrote: Does this apply to Struts2 as well ? If not is there an alternative ? Thanks Leon Frank W. Zammetti wrote: One simple answer might be the StrutsWS project: http://sourceforge.net/projects/strutsws/ In CVS you'll find a version for the 1.3.x branch of Struts. Simply put, it allows you to call your existing Struts Actions as Web Services without any changes to them. This means any validation you have configured should still work, they don't know they are being accessed as services versus part of a Struts app. I have to say the project hasn't been developed lately, but we left it in a stable state, and anyone is free to pick up where we left off if they wanted to. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! semaj.najraham wrote: Hi, I've been googling and looking at the user mailing list if I add web service to a struts based application, but didn't find my answers. Currently I am developing a struts based application with Struts 1.3.8 with Struts validator framework. I've implemented business layer and data layer. In future, I need to integrate my app with other applications such as portal using web service. Therefore, I would like to think ahead on how I can integrate since I've not worked with web service before. By googling and reading some of the articles, I found out that web service can call struts actions. My real concern is the data validation. 1. Can I use Struts validator framework? 2. If not, do I need to do validation at data layer? 3. If I need to do validation at data layer, can I use Commons Validator ? 4. If I use Commons Validator, should I use it in both presentation layer and data layer. Commons Validator was a part of Struts Validator. I'm totally lost! Any help will be greatly appreciated. Thanks, semaj - 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: [OT] Re: Passing value from Struts tag in JSP to Action class
What is rowId? That's not a standard attribute of the input tag, hence the error makes sense I think, assuming it's being interpreted equivalent to this.rowId... also, value doesn't have any context here, I assume you mean to do this.value (which it may be interpreted as anyway), but maybe not... what are you actually trying to do? Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Oleg Konovalov wrote: Dave, What am I doing wrong in that Javascript ? Honestly, I don't see it. Please help ! Thank you, Oleg. On 8/10/07, Dave Newton [EMAIL PROTECTED] wrote: --- Oleg Konovalov [EMAIL PROTECTED] wrote: input type=image onclick=rowId=value; As of now I am getting Javascript error Object doesn't support this property or method, complaining about *rowId=value;* The onclick attribute must have valid JavaScript. d. Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos more. http://mobile.yahoo.com/go?refer=1GNXIC - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.476 / Virus Database: 269.11.13/946 - Release Date: 8/10/2007 3:50 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts1 or struts 2?
Asthana, Rahul wrote: By the way, have any of you done any performance metrics on an ajax based implementation vs a non ajax based one? Early on we did a proof-of-concept that did exactly this... what we found was that the AJAX version was universally perceived as being faster, even when a few cases actually weren't (i.e., client-side processing took longer than the equivalent server-side version). The conclusions we drew were: 1. You have to strive to minimize the amount of Javascript executing as a result of each AJAX call. There is a line that when crossed means the server can actually render the whole page fresh and the browser can display it faster than AJAX+Javascript updates. 2. There is a balance you need to strike between the number of AJAX calls and size of each AJAX response... there is again a line that when crossed means that X number of small AJAX requests takes more time than one non-AJAX transaction. 3. There is definitely tuning that needs to be done in terms of moving static resources off to the web server, making sure your AJAX responses are tight, things like that. The very biggest impact we found, recently actually, was in moving all images, CSS, Javascript and other static content off to the web server... especially when your doing AJAX and your making numerous small requests vs. one or two larger non-AJAX requests, not having to hit the web server makes a huge difference... remember that in most cases, there is a small number of connections available between the web server and app server (we had 5 I believe) even though you may have 100 connections/threads available on the web server (and probably app server). That's where we found the most significant bottleneck... we're talking making an app twice as fast just by moving static content off the app server! 4. Aside from the static content thing, this is the biggest point to emphasize: you need to get your developers thinking a different way then they probably are used to... they need to, for lack of a better way to put it, trust the client more. For instance, we had developers that insisted on putting objects in session, even though myself and other senior developers were telling them it'd be better to keep things in Javascript objects client-side... they would tell you now we were 100% right :) This isn't a criticism of them though, when your used to doing things a certain way, and they basically work well, you don't want to change, especially given what many people have historically thought about Javascript and client-side development. But once you get the mindset changing, you'll see a really huge improvement in performance of your apps because the fundamental design leads to better performance naturally. rgds Rahul Frank -- -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add Web Service to Struts Web App
One simple answer might be the StrutsWS project: http://sourceforge.net/projects/strutsws/ In CVS you'll find a version for the 1.3.x branch of Struts. Simply put, it allows you to call your existing Struts Actions as Web Services without any changes to them. This means any validation you have configured should still work, they don't know they are being accessed as services versus part of a Struts app. I have to say the project hasn't been developed lately, but we left it in a stable state, and anyone is free to pick up where we left off if they wanted to. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! semaj.najraham wrote: Hi, I've been googling and looking at the user mailing list if I add web service to a struts based application, but didn't find my answers. Currently I am developing a struts based application with Struts 1.3.8 with Struts validator framework. I've implemented business layer and data layer. In future, I need to integrate my app with other applications such as portal using web service. Therefore, I would like to think ahead on how I can integrate since I've not worked with web service before. By googling and reading some of the articles, I found out that web service can call struts actions. My real concern is the data validation. 1. Can I use Struts validator framework? 2. If not, do I need to do validation at data layer? 3. If I need to do validation at data layer, can I use Commons Validator ? 4. If I use Commons Validator, should I use it in both presentation layer and data layer. Commons Validator was a part of Struts Validator. I'm totally lost! Any help will be greatly appreciated. Thanks, semaj - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts1 or struts 2?
On Thu, August 9, 2007 8:24 am, Ted Husted wrote: IMHO, if we had today's JavaScript/CSS/HTML environment available to us in 1998, then JSP, ASP, JSF, PHP, and all the rest of it, would not exist. We did all these things to make up for the shortcomings of the client-side environment, and, since then, the key shortcomings have been addressed. Great observation IMO, and it couldn't be more true. I always like to tell the story of a Java users group I was at maybe two years ago now... the speaker was talking about AJAX and he said that the people who know what AJAX is at that point are the same people who are pissed about it because frankly it hasn't been anything new for them for some time! I have one app that was put in production in 1998 ironically, the year you picked here Ted, that you'd look at today and say it was AJAX, an RIA, but it didn't use what we'd call AJAX now (hidden iFrame that got Javascript back which executed upon return and automatically updated and hide and showed a variety of DIVs on the page... in fact, this is the extreme case because absolutely every view the user can ever see in the app is loaded up front and never generated server-side, it's only data being plugged into fields after startup). If I'd have thought for one second that what I was doing was any big deal, unusual in some way, it could have been my name going down in history as having invented AJAX instead of Jesse James Garrett! And the worse part is I know I'm not the only one that can say that! LOL I've had the interesting experience of witnessing an evolution here at work... in 1998, I was the only one building apps in that fashion at this company, everyone else was very much at the other extreme, the whole let the server do everything approach as you described, thin pages, etc. Everyone thought I was nuts (I only got away with it because my projects are always successful, something not everyone here can claim), I got into some really heated dehates with folks over the years about it too. Now, things are very much swinging the other way... apps are being built now in much more RIA ways, it's much more mainstream thinking. I think that evolution is playing itself out across many organizations now, and that's my point: there's a critical mass now, and the mindset is starting to change, and Ted's right, many of the technologies we're saddled with today would never have needed inventing if everyone had listened to me (or the others that were doing what I did in various orgamizations) back in 1998! LOL -Ted. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: struts1 or struts 2?
Not specifically, no... although, both of my books go into this sort of thing, and the first one includes a DWR-based project. I'm also in the midst of a third book which will very definitely cover this topic in detail right lots of practical examples... due out in, roughly, this coming January. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 8, 2007 12:58 pm, Asthana, Rahul wrote: Hi Ted/Frank, Is there a more detailed post/article that you have done regarding this architecture? Thanks Rahul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ted Husted Sent: Wednesday, August 08, 2007 12:27 PM To: Struts Users Mailing List Subject: Re: struts1 or struts 2? On 8/7/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Then again, if I *really* had my druthers, I'd use DWR for everything on the back-end and pick best-of-breed widgets on the UI to construct my own client-side framework... the last project I did more or less did this, although we used S1 and not DWR, but it worked out tremendously well, so in my mind the approach is more than sound, it's close to ideal... standard enough that a decent developer can get up to speed quick, but custom enough to fit the problem domain like a glove. +1 My team did our last project using the same sort of architecture, but since the backend was on .NET, we used Jayrock instead of DWR. Works great, and it also seems like the ideal mix to me. We had to roll our own solution for the server-side validation and type conversion, but we based that work on a chain of command, and it's layered so we can reuse it with multiple front end applications. -Ted. - 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: struts1 or struts 2?
Thanks Paul... The envelope is in the mail! wink-wink/ :) Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 8, 2007 2:03 pm, Paul Benedict wrote: I have JavaScript, DOM Scripting and Ajax Projects -- good book for people who want to get into AJAX. On 8/8/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: Not specifically, no... although, both of my books go into this sort of thing, and the first one includes a DWR-based project. I'm also in the midst of a third book which will very definitely cover this topic in detail right lots of practical examples... due out in, roughly, this coming January. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts1 or struts 2?
Not just poor Italy... my experience has been that this isn't uncommon in the United States either, and anecdotally in other countries as well... in fact, I'm willing to say that S1 usage, and even 1.1 usage, is still the most common Struts usage world-wide. Dunno where it'll be a year from now of course... I work in the finance sector, and things tend to move a bit slower there than other sectors might, but I don't know if that's typical of all sectors or not. If I was starting a new project today and had a choice (but it had to be Struts), I'd go with S2. I find it, generally speaking, to be more logical in how things work... simple things like attributes of tags and config files being named in a meaningful way helps a lot. Then again, if I *really* had my druthers, I'd use DWR for everything on the back-end and pick best-of-breed widgets on the UI to construct my own client-side framework... the last project I did more or less did this, although we used S1 and not DWR, but it worked out tremendously well, so in my mind the approach is more than sound, it's close to ideal... standard enough that a decent developer can get up to speed quick, but custom enough to fit the problem domain like a glove. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Tue, August 7, 2007 2:07 pm, Antonio Petrelli wrote: 2007/8/7, [EMAIL PROTECTED] [EMAIL PROTECTED]: - For the job market, which one is in higher demand? It depends on the nation, I suppose. In Italy, there are lots of requests for Struts 1 (in fact they still call it Jakarta Struts, and Struts 1.1 is still in use, poor Italy :-) ) Antonio - 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: DownloadAction and a normal Forward
The thing is, I'm not entirely sure there's another viable option. I could certainly see extending DownloadAction in some way so that there is kind of a verify() method called first that detects the problem that your checking for (the if(problem) statement)... if a problem is detected, i.e., file doesn't exist or something, then do the forward. That should avoid the NPE (I think), but then your probably overwriting the page on the browser, so maybe that's worse. In any case, that's no quick fix since there's some RD involved. The only thing I can think of is if you can detect you have a problem before the download call... could you maybe do an AJAX call before the download call to see if the file is available and downloadable? If so, then make the actual download request. Or possibly make the download link point to a regular Action that does that check, then forwards to the mapping leading to the DownloadAction? That way the check and the download are in the same request... I'm not sure that would work frankly though and I think you'd have the same problem as I mentioned earlier. Yeah, you may have to live with the NPE... I guess if it's an exceptional situation and isn't going to happen often it may not be a big deal. If it's frequent though, I think I'd do some more creative thinking to avoid it somehow. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, August 2, 2007 4:17 am, Gundersen, Richard wrote: Hi Frank, Paul Thanks again for the tips. The thing is, having a NPE isn't actually a problem for me. I am quite (well, not entirely) happy for the code to throw it since by that time, my RequestDispatcher.forward method has already got my request to the browser by then, and the user is viewing the JSP. The fact that the DownloadAction still thinks it needs to do something with a dummy StreamInfo isn't such a big deal to be honest. It can fail for all I care since it doesn't stop the system from working (I know, it's not the right attitude :-) But, right now I am more concerned about whether using RequestDispatcher.forward is a safe (and/or best) way to redirect the request out of the DownloadAction and back to a real JSP. Appreciate your thoughts. Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Thursday, August 02, 2007 3:16 AM To: Struts Users Mailing List Subject: Re: DownloadAction and a normal Forward Hehe, your going after the *right* answer Paul :) It's clear the caller of getStreamInfo() doesn't like getting null back, that was the case originally... now, the NPE must be getting thrown from elsewhere after Richard returned the dummied StreamInfo object (I would have been surprised if constructing one with two null arguments *didn't* move the NPE elsewhere, but I was hoping!). Frank Paul Benedict wrote: Who is throwing the NPE? I can't tell by your code what's causing it. On 8/1/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: You know, I just reread what your trying to do... have you tried using a global exception handler? I'm not sure you'll be able to catch the exception with one, but if you give it a try and you can, there you go, you can forward as desired from there. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 10:38 am, Gundersen, Richard wrote: Hi Thanks for the reply. Tried it and it still gives me a NullPointer. Maybe that's not such a problem though - since the browser still redirects to the JSP I want. However, I was wondering if it's possible to use a ResourceStreamInfo to redirect to an ActionForward (which ultimately leads to a JSP). Would this be preferable to using RequestDispatcher.forward(request, response)? Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 2:47 PM To: Struts Users Mailing
Re: DownloadAction and a normal Forward
It's not the *right* answer, and I'm not sure it won't cause some other exception anyway (in fact, I'd bet it would), but what if instead of returning null you instead do: return new ByteArrayStreamInfo(null, null); ? Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 9:24 am, Gundersen, Richard wrote: Hi I'm using a DownloadAction to generate a PDF and return it the the browser. If there is a problem generating the PDF however, I want to redirect the user to a specific JSP. What's the best way of doing this? At the moment I am using protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ... ... ... if(problem) servlet.getServletContext().getRequestDispatcher(/admin.do?doAction=alr eadyPrinted).forward(request, response); return null; } else { return new ByteArrayStreamInfo(contentType, myPdfBytes); } } This works, but I always get a NullPointer, because I'm returning null to satisfy the method signature. The exception doesn't cause a problem for the user though, because the forward has already happened by then (and the user is happily viewing the JSP) Is there a better way to do this though - perhaps with ResourceStreamInfo instead? Regards Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority. __ This email has been scanned by the MessageLabs Email Security System. - 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: DownloadAction and a normal Forward
You know, I just reread what your trying to do... have you tried using a global exception handler? I'm not sure you'll be able to catch the exception with one, but if you give it a try and you can, there you go, you can forward as desired from there. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 10:38 am, Gundersen, Richard wrote: Hi Thanks for the reply. Tried it and it still gives me a NullPointer. Maybe that's not such a problem though - since the browser still redirects to the JSP I want. However, I was wondering if it's possible to use a ResourceStreamInfo to redirect to an ActionForward (which ultimately leads to a JSP). Would this be preferable to using RequestDispatcher.forward(request, response)? Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 2:47 PM To: Struts Users Mailing List Cc: user@struts.apache.org Subject: Re: DownloadAction and a normal Forward It's not the *right* answer, and I'm not sure it won't cause some other exception anyway (in fact, I'd bet it would), but what if instead of returning null you instead do: return new ByteArrayStreamInfo(null, null); ? Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 9:24 am, Gundersen, Richard wrote: Hi I'm using a DownloadAction to generate a PDF and return it the the browser. If there is a problem generating the PDF however, I want to redirect the user to a specific JSP. What's the best way of doing this? At the moment I am using protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ... ... ... if(problem) servlet.getServletContext().getRequestDispatcher(/admin.do?doAction=alr eadyPrinted).forward(request, response); return null; } else { return new ByteArrayStreamInfo(contentType, myPdfBytes); } } This works, but I always get a NullPointer, because I'm returning null to satisfy the method signature. The exception doesn't cause a problem for the user though, because the forward has already happened by then (and the user is happily viewing the JSP) Is there a better way to do this though - perhaps with ResourceStreamInfo instead? Regards Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any corruption or alteration of data or importation of any virus as a result of receiving this electronic communication. Replies to this E-mail may be monitored for operational or business reasons. London Scottish Bank PLC is regulated by the Financial Services Authority. __ This email has been scanned by the MessageLabs Email Security System
Re: DownloadAction and a normal Forward
Hehe, your going after the *right* answer Paul :) It's clear the caller of getStreamInfo() doesn't like getting null back, that was the case originally... now, the NPE must be getting thrown from elsewhere after Richard returned the dummied StreamInfo object (I would have been surprised if constructing one with two null arguments *didn't* move the NPE elsewhere, but I was hoping!). Frank Paul Benedict wrote: Who is throwing the NPE? I can't tell by your code what's causing it. On 8/1/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: You know, I just reread what your trying to do... have you tried using a global exception handler? I'm not sure you'll be able to catch the exception with one, but if you give it a try and you can, there you go, you can forward as desired from there. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 10:38 am, Gundersen, Richard wrote: Hi Thanks for the reply. Tried it and it still gives me a NullPointer. Maybe that's not such a problem though - since the browser still redirects to the JSP I want. However, I was wondering if it's possible to use a ResourceStreamInfo to redirect to an ActionForward (which ultimately leads to a JSP). Would this be preferable to using RequestDispatcher.forward(request, response)? Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 01, 2007 2:47 PM To: Struts Users Mailing List Cc: user@struts.apache.org Subject: Re: DownloadAction and a normal Forward It's not the *right* answer, and I'm not sure it won't cause some other exception anyway (in fact, I'd bet it would), but what if instead of returning null you instead do: return new ByteArrayStreamInfo(null, null); ? Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, August 1, 2007 9:24 am, Gundersen, Richard wrote: Hi I'm using a DownloadAction to generate a PDF and return it the the browser. If there is a problem generating the PDF however, I want to redirect the user to a specific JSP. What's the best way of doing this? At the moment I am using protected StreamInfo getStreamInfo(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ... ... ... if(problem) servlet.getServletContext().getRequestDispatcher(/admin.do?doAction=alr eadyPrinted).forward(request, response); return null; } else { return new ByteArrayStreamInfo(contentType, myPdfBytes); } } This works, but I always get a NullPointer, because I'm returning null to satisfy the method signature. The exception doesn't cause a problem for the user though, because the forward has already happened by then (and the user is happily viewing the JSP) Is there a better way to do this though - perhaps with ResourceStreamInfo instead? Regards Richard Gundersen Java Developer Email: [EMAIL PROTECTED] Phone: 01618302398 Fax: 01618342536 London Scottish Bank plc 24 Mount Street Manchester M2 3LS *** Disclaimer *** This electronic communication is confidential and for the exclusive use of the addressee. It may contain private and confidential information. The information, attachments and opinions contained in this E-mail are those of its author only and do not necessarily represent those of London Scottish Bank PLC or any other members of the London Scottish Group. If you are not the intended addressee, you are prohibited from any disclosure, distribution or further copying or use of this communication or the information in it or taking any action in reliance on it. If you have received this communication in error please notify the Information Security Manager at [EMAIL PROTECTED] as soon as possible and delete the message from all places in your computer where it is stored. We utilise virus scanning software but we cannot guarantee the security of electronic communications and you are advised to check any attachments for viruses. We do not accept liability for any loss resulting from any
Re: CSS / JavaScript menu libraries for Struts 2 Showcase application
The single best set of web UI components I've found to date is here: http://scbr.com/docs/products.shtml It includes a menu, tabbar (the single best implementation ever IMO), treeview, grid, toolbar, and others. The dhtmlx* components are well-documented, easy to use, lightweight, feature-rich and stable... they are also free (I believe all of them) if they are part of a GPL'd code base, so there's the question: is the GPL compatible with the ASL? My Bar exam score card has not arrived yet, so I'm not (yet) qualified to answer :) Frank (that was a joke, I haven't taken the Bar exam) James Holmes wrote: I'm looking into updating the Struts 2 Showcase application with a new menuing system so that it is easier to use. Anyone have any recommendations on existing CSS / JavaScript libraries? The library will need to be open source and have a license that is compatible with Struts 2. I'd like to hear what type of menu people would like to see as well. Should it be a drop down style? Tabs? It would probably be nice if the menu has a built-in mechanism for breadcrumbs or at least support working with them in some way. All feedback is helpful. Thanks, James - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CSS / JavaScript menu libraries for Struts 2 Showcase application
Well, I guess that's that then... dhtmlx components are currently under GPL2. Shame, they're really excellent implementations. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Dave Newton wrote: --- Frank W. Zammetti [EMAIL PROTECTED] wrote: so there's the question: is the GPL compatible with the ASL? Which versions? GPL v3 is definitely *not* compatible w/ (AFAICT, anyway) any ASL; I'm not familiar with v3 yet. My *impression* is that v3 is not ASLv2 compatible, but... better minds than myself still seem to talk about it, so who knows :/ IADNAL. d. Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - 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: Is Struts still a better choice over JSF as on today ?
On Mon, July 30, 2007 9:39 am, Ted Husted wrote: On 7/29/07, souravm [EMAIL PROTECTED] wrote: However, I'm still not very sure whether the design approach of Swing/VB is a right fit for a scenario where the underlying technology is http. They are good for a thick client scenario where most of the event handlings happen in client machine (except the events which has to communicate with server). So though design/development wise the component framework may help a lot (after the initial learning curve), efficiency wise how the things will perform (and of course lost of it will depend on the vendors implementation of JSF specification) is a big question to me. Ted is spot-on with his comments, and I'm in the same situation: most of my development is Intranet-based, the network is rarely the bottleneck (although it's more interesting when your previously internal application is now accessed remotely by clients, which happens often enough in my line of work). I wanted to mention though with regard to what you said about event handling and bandwidth... you mentioned you had some VB experience, so think about that experience and answer this question: when some user event occurs, what winds up happening a large percentage of the time in a typical app? Let's say the user clicks a button... what does the code behind that button do? Does it just do some simple UI thing like enable another button? Or is it more times than not hitting a database and doing some processing? This is an important question because, at least in my experience, it's more times than not some database call and some processing. In that case, there's not as much difference between that and a well-designed webapp, *especially* if your using AJAX (and remember JSF offers AJAX capabilities too, so it's not either-or). The simple UI events can be handled entirely client-side in a webapp too, making that difference not very great either. As far as bandwidth goes, I've done a decent amount of analysis comparing an AJAX-based application to a typical webapp and have found that the overall bandwidth usage is actually less with an AJAX app most of the time. Now, where you can definitely run into issues is in too many connections to the server, and the delay in tearing down and creating those connections each time. However, as with most things, better design work can alleviate these issues to a large extent. I'm not of the opinion that we should push business logic onto the client, but there *is* a lot of processing that people typically do on the server that you can do on the client and still maintain a good design, and that helps. The interesting thing I've found over the last year is that mindset is more important than technology (not exactly a revelation, but it was reinforced)... with the application I described earlier, I lead a team of developers who didn't have any experience with AJAX, and it took probably 6 months to get them thinking differently... they were used to doing non-AJAX webapps, so just one example, they decided for one portion to stash a bunch of stuff in session. All along I was telling them it wasn't a good idea, better to keep that stuff client-side (yes, I could have pushed things and had it done my way, but that's not the way you respect your team IMO)... now, they got it working using session, but they've come back around and admitted it would have been a lot easier to not use session. But that's just a mindset thing: if you don't trust the client (to some extent), and you aren't used to thinking client-side, you make those types of decisions. I doubt there's any difference there between JSF, Struts or anything else. There's nothing inherently wrong with that mindset by the way, it's just that in this day and age of richer clients, it can lead to decisions that, while not technically wrong, aren't optimal either. Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Ajax performance optimisation
I have a very complex app using Dojo that just went live a few weeks ago (although *not* using S2), and this past week we got a 70+% performance improvement out of it. We did three things Dojo-related. First, we used a custom build (previously we just let Dojo import whatever it needed on the fly). I know this is a primary suggestion the Dojo team makes, so I assume you've done that already. Second, all the Dojo resources, all the .js, .css and image files, were moved onto the web server. Third, we set expires headers for all these resources to one hour on Apache. None of that is rocket science, but it made an absolutely amazing difference. We're under SSL as well, and our performance right now is on par with what a developer sees running it locally without SSL. It's absolutely stunning. We actually moved *all* our static resources out to the web server (we use other libraries like ActiveWidgets, WiseBlocks and have a ton of .js that makes up the app itself). We also made some other architectural changes, so the improvement we saw isn't strictly what we did with Dojo. But, myself and another senior guy spent all week measuring and benchmarking and testing and I can say for sure that the biggest improvement was in fact the Dojo changes. hth, Frank Nuwan Chandrasoma wrote: Hi, we also had the similar problem, we had a s1.x application with dojo and we did all the performance enhancements that was recommended by dojo, but we could not achive what we want and our application was running in https mode. it add more performance problem to the application. Thanks, Nuwan Adam Hardy wrote: Jason Wyatt on 27/07/07 08:55, wrote: I've been trying to speed up the Ajax performance of our application, based on the notes at http://cwiki.apache.org/WW/performance-tuning.html I'm a bit unsure where I should extract the static content to, such as the css and javascript files included by the Ajax theme (shown below): link rel=stylesheet href=/iacd/struts/xhtml/styles.css type=text/css/ script type=text/javascript src=/iacd/struts/dojo/dojo.js/script script type=text/javascript src=/iacd/struts/simple/dojoRequire.js/script script type=text/javascript src=/iacd/struts/ajax/dojoRequire.js/script script type=text/javascript src=/iacd/struts/CommonFunctions.js/script For example, the styles.css file above is stored in the struts2-core-2.0.8.jar under the path /template/xhtml. But if I extract this file to the webroot/template/xhtml, it seems that the link in the code above won't work, so I should instead extract it to webroot/struts/xhtml. Is this understanding correct? Basically I'm wondering how the mapping works between the template folder in the jar file and the struts folders mentioned in the Ajax theme's code. Looks like a servlet filter declared in the web.xml would pick up anything with /struts/* and handle it from there but I don't see it mentioned in a casual check of the wiki so it could be some other mechanism. I spent about a week trying to get dojo to perform better the way we were using it, and for the performance we required then, we worked out we couldn't afford any more than a dozen dojo widgets on a page, even with all the dojo performance enhancements recommended by dojo. - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Ajax performance optimisation
Nuwan Chandrasoma wrote: Hi Frank, First of all thanks for these tips.., we did the custom dojo build For anyone reading, this is an especially important tip if your app is being access on a WAN or public Internet. Our app is a backoffice app, but we have a lot of people coming in over VPN to use it, and that's where we saw a large hit by not using the custom build option because Dojo is very chatty in terms of loading its resources otherwise. ... and parseWidget tag setting also. Also a big hitter. We had widget parsing turned off already, but before we did some months back you could definitely see the hit you take for that. Remember that Dojo gives you the ability to parse the entire DOM tree, or just specific portions of it, so if your using markup-based creation of widgets, I definitely suggest you look at targeting the widget parsing as much as possible. ...but we havent done the 2nd and 3rd tips you have given here., i have a small doubt when it comes to moving static resource to the web server. will there be any problem when it comes to having http and https content together? i don't have much experience when it comes to web servers like apache Interesting question, and I'm not sure... I'd suspect IE especially might be a problem because it's famous for the do you wish to access this unsecured content from a secure location? dialog, which I think you can't get rid of no matter what you do. I'm not sure here, might be worth some time to experiment and see what happens. Thanks, Nuwan Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Ajax performance optimisation
Martin Gainty wrote: Hi Frank- My apologies for jumping in the middle of a thread No need to apologize, I did the same thing! LOL -could you elaborate on what you used for a 'custom build'? Yes... Dojo supports the ability to create a custom build, where you get a dojo.js file out that contains only the code you need. The Dojo wiki details this, but it's little more than creating a profile.js file, which tells the build process what to include, and then running an Ant script. I have to say that it took me a while to get it to work, I had various problems along the way, but it ultimately works pretty much as described in their documentation. My custom build by the way includes the io functionality, and the menu, button, calendar, tab and floatpane widgets, plus whatever packages (fx, core, etc.) these things require. -which webserver are you implementing? Apache, in front of WebSphere... I'm afraid I can't go into much more detail than that as we're in a hosted environment, so I'm not in charge of the configurations. -where you able to collect metrics for scenarios other than expire headers of 1 hour..perhaps 2 hours? No, we debated various times but settled on one hour because that seemed a reasonable period of time to account for JS changes (our own app JS really)... we figured images weren't terribly important if something changed, we could deal with a bit of ugliness for an hour :) but JS changes would obviously break stuff. Kudos for attaining astounding 70% performance increase!!! Thanks :) The early days of last week were really rough, trying to figure out where we were truly losing time, but the last two days were very rewarding indeed. Thanks, M-- Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [S2] Ajax performance optimisation
In our case, it's not the initial load that was killing us... well, it *was* a little too long (and we have a very nice Please Wait with spinning gears and such during that period)... the problem is the underlying requirements for the application. Let me try and give a brief background (although you've been around here long enough and seen my posts to know I can't say *anything* briefly!) The app is a back-office replacement for a number of different apps... things like CRM, account creation, workflow, imaging system, etc. Each of these is sort of a separate module in the app. Each module further has a left and right-hand sides, the left-hand side has a variable number of tabs on it, each loaded individually, and the right-hand side typically has an image viewing applet in it, although sometimes has other things like search results, more data entry forms, etc. The one requirement that's really been tough is that each of these modules the user needs to be able to flip between at any time with no real delay (at least no delay after the first time they load the module). So, a typical use case might be creating a new account in the new account module, and then being able to flip to the image view module to see the image of the scanned documentation for the new account application. The way we did this, the only way we could to really meet the requirements I think, is that we have a bunch of common JS that loads up-front, which basically represents the overarching client-side framework. Then, each module is in an iFrame, but within each there's a ton of stuff that has to get loaded, some of it duplicate portions of the framework (although that's been minimized of course), and including Dojo in each one. For the most part, once a module is loaded it doesn't fully get loaded again, we just flip one iFrame visible while the others are hidden, that sort of thing. But there *are* a few instances where a module has to get reloaded. Now, here's the part that really spurned the need to improve performance... we have an existing VB-based imaging application that we're not ready to move off of completely... this imaging app has the full suite of hooks into the workflow, the long and short of it is that from the VB app, a user clicks a button when they select a work item from a queue, which launches our web app. So, the initial load of the web app is maybe 5-7 seconds, not a big deal. Then to load the module that automatically gets started in that case takes about 8-10 seconds. Then it has to load an image in an applet, which is another few seconds. All in all it's roughly 20 seconds from fat-client to webapp loaded. But, before the mods this past week, it was more like 45-50 seconds, sometimes more (I think we actually managed to get it closer to 10-15 seconds overall on Friday, getting us to around that 70% improvement I mentioned, give or take a bit). You actually see that please wait display when the module is loading too, and from fat-client to webapp it's actually showing the whole time. Before the mods, you can see why Dojo was a problem: it wasn't just loading once, it was loading multiple times! And because of the fundamental architecture of the app, there wasn't much choice in the matter (I've toyed with just loading it in the parent frame, but that doesn't seem possible since the iFrames need a lot of it, and you start getting into tons of scoping issues). I should also point out that one of the other changes I made that had a big impact was not using Dojo buttons any longer... I basically built a new button widget and wrapped it in a taglib. The problem there was that each of those tabs I mentioned gets loaded via AJAX, and then any script blocks in it is executed. When we disabled the Dojo widget parsing, we lost the ability to use markup to generate Dojo buttons, so I created a very thin taglib wrapper that spit out a script block to programmatically generate the Dojo button. This, it turns out, executes a lot faster than the widget parsing (I should also mention we're using Dojo 0.3.1 because it would be a major hassle to upgrade now)... the problem, which I'd bet you can guess, is that if you have a tab with numerous buttons, which we did in some cases, executing all that Javascript and manipulating the DOM (creating the Dojo buttons) wound up being as slow as using widget parsing, maybe even slower. So now, the button widget and taglib I created doesn't spit out Javascript, the buttons are a lot simpler, and don't need to be created programmatically. This gained us 3-5 seconds alone. Ok, see, I'm genetically incapable of giving a short answer to anything :) To answer your question, the initial load *is* long enough to warrant a please wait message, and we have one, and actually have from the start :) Frank Adam Hardy wrote: Frank W. Zammetti on 28/07/07 16:10, wrote: Martin Gainty wrote: -where you able
Re: [OT] Re: Is Struts still a better choice over JSF as on today ?
Not nearly as good would be my guess :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Thu, July 26, 2007 2:19 pm, Antonio Petrelli wrote: 2007/7/26, Frank W. Zammetti [EMAIL PROTECTED]: (this was a case of the generated code having to be mucked with to get it right, and it turned into a big, heaping plate of spaghetti in the process). I always wonder what kind of spaghetti have you got outside of Italy :-D Antonio - 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: Is Struts still a better choice over JSF as on today ?
On Thu, July 26, 2007 1:23 pm, souravm wrote: For me so far I don't see any reason why people should go for JSF except for moving ahead with a standard. As such I don't even see much use of event handling at UI layer - I always like to keep UI layer simple. But remember that something can be a standard and still not be successful... I wouldn't say that EJBs were unsuccessful, but it's certainly true that people were looking for alternatives almost from the beginning. Witness how quickly Spring gained popularity for instance (note that I'm talking pre-EJB3, which seems to have gotten a ton better). As for event handling on the UI, I do have to disagree there. I think when you start doing a lot of RIA work, event handling is a big consideration. It's one of the reasons I eased up on my JSF criticisms some months ago... while I still think there's better alternatives, it does offer some value in that area, and I think it's an important area. Now knowing that you have already seen some projects where JSF was used here are my couple of Qs - a) What made them to go for JSF ? I've seen three projects that went with JSF, none of which I was involved in day-to-day development on... with one I know the decision was simply as you said, because JSF is a standard, and someone thought that was enough of a reason to go with it :) I can tell you that while that project ultimately delivered, it had a ton of pain along the way, more so than if it had gone with something better known, that was the conclusion at the end. I wasn't intimately involved with that project so I don't know all the details, but I do know that some developers I trust said JSF was a headache for them the whole time, even when the learning curve was overcome (that's not necessarily a criticism of JSF mind you, it may well be that it just wasn't the right choice for that particular case). The other two projects went with JSF because the idea of a component-based framework is attractive to many (myself included for the most part). They generally went alright, no huge complaints or anything. I was again not involved in day-to-day development of those, but I didn't hear any big complaints. Interestingly, one of them is now being rewritten using AJAX under Struts 1.2.7 and using a handful of component libraries (YUI, Dojo and APT). The reason for the rewrite: the JSF version had become a pain to maintain (this was a case of the generated code having to be mucked with to get it right, and it turned into a big, heaping plate of spaghetti in the process). This again isn't necessarily a criticism of JSF because it may well be that it just wasn't developed well in the first place, but these are the facts of the case, draw what conclusions from it you may :) The one conclusion I draw from this last experience is that if you use RAD tools and are fortunate enough to never have to mess with the code, JSF is probably no worse than anything else, and probably has some nice benefits. The first time you have to touch the code though, you may be heading down a road you don't want to travel. Me, I don't trust *any* tool to generate code *that* much! b) What type of RAD tool was used (if at all) ? One of them used no RAD tools at all (interestingly, it was the one that seemed to go the smoothest and isn't be rewritten), the other two used Java Studio Creator. I can't give you any meaningful feedback on that tool though... I've played with it a little, didn't think anything particularly good or bad about it from that admittedly limited experience. I'm very much a text editor kind of guy, so my opinions are frankly tainted by experience hand-coding JSF (which, to be honest, hasn't been all *that* bad really, but I've never done a truly substantial JSF application personally, I've only watched others do so). Regards, Sourav Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Struts still a better choice over JSF as on today ?
souravm wrote: Regarding going for JSF due to componentization, I'm again not sure what additional componentizations JSF does compared to struts. JSF is inherently a component-based framework, meaning you aren't really thinking in terms of pages, your thinking in terms of components of a view. Struts doesn't really offer this, although S2 gets closer to it in many ways (and yes, there's some JSF support in S2 is you want it, although I'm not too familiar with it myself). Apart from the fact that JSF does not need a layer like Action Classes, all other components (validator, managed bean, html tag libs etc.) are already there in Struts. May be I'm missing something here. I think your looking at the pieces and comparing them rather than looking at the overarching paradigm of one framework vs. the other. The distinction has been diminished a bit with S2, but it's still there. A component-based approach means your looking at individual elements that make up a a particular view and thinking in terms of the interactions the user can have with each. You don't think in terms of state transitions, you think in terms of events. With Struts, it's about state transitions. The user submits a form and transitions to a new application state entirely. I'm throwing AJAX out of this for the moment of course :) Also, I'm yet to appreciate the real value add event handling mechanism of JSF can bring in a web application scenario. It's the ease, in theory, that it provides, and the fact that your inherently thinking along those lines, rather than shoe-horning it in. That's the value-add IML (in theory!) Especially given the fact that all those events (associated with a single http request) would be fired only in a sequential way at server side. I'm not quite sure what you mean by that... I really cannot think a usage scenario of multiple event handler feature of JSF. Even in case of RIAs, I believe what is more required feature is dynamic loading of part of a html page (which is currently the space where AJAX is becoming popular). So any further explanation/example on how you have found this feature of JSF to be useful for RIAs would be helpful for me to understand your point. It's not just about partial page loads, although that's clearly a big part of it. As I was describing before, it's more about the approach to developing the application. Are you familiar at all with Visual Basic? If so, let me try and make this analogy... working with JSF is more akin to developing in VB than in Struts because your creating a given view that is a collection of components, and then determining what events each component can trigger, and coding for them. When you write a VB app, you aren't typically thinking in terms of this form leads to that form which leads to another form (unless your talking a wizard flow, but that's a specialized case). With Struts, it's always about a transition from one view to another, from one form to another in VB, triggered by some user input (again, putting AJAX aside for the moment). The VB paradigm, is frankly more logical to most developers. It's more like Swing too if you think about it. Now *with* AJAX in the mix, and with client-side component libraries coming fast and furious, a lot of what made JSF potentially attractive has, again IMO, been significantly diminished. People have realized that you don't need the full JSF stack, so to speak, and you can do components without JSF too, so maybe it's not as valuable. Now, JSF still provides value there because it gives you a standardized component model, something that is sorely lacking in client-side component libraries these days (i.e., Dojo widgets and YUI widgets and APT widgets aren't generally compatible, and certainly aren't designed to some common pattern). That's kind of what's happened in Struts land too... there's been a bit of a melding of the component paradigm and the non-component paradigm, largely with AJAX as the catalyst. Regards, Sourav Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Is Struts still a better choice over JSF as on today ?
souravm wrote: Will you consider Struts to be a better choice today compared to JSF ? In *most* cases, for me, yes I would, but that's just my opinion, and I'm about to invalidate it at the end of this :) Especially, given the fact that JSF has better controller flexibility, event handling capability and ease of development using a RAD tool ? I don't think any of those facts are givens in any way, shape or form. You could convince me event handling is better, maybe, but not the other two. Controller flexibility is AT BEST a wash in my opinion (which is what you asked for), especially when your talking about S2. The interceptor stacks and result types, I believe, gives you just about all the flexibility you could ask for, and it's far from rocket science. Even with S1 you now have a chain-based request processor, and that gives you a ton of flexibility it you choose to use it. As for ease of development with a RAD tool, you may well be right there, but to me, a big part of development is maintenance over time, and any time you have to rely on tooling to create an application, even in part, your asking for trouble down the road. Besides, I've heard stories of people who have used those RAD tools you speak of, only to find that they spend just as much time mucking around with the code they generate to get it to do exactly what they want/need as they would have spent just hand-coding is all in Struts. In the end, they saved little or no time, and possibly even wound up costing themselves some in the worst cases. At the end of the day though, my belief still stands: look at your requirements and choose the right tool for the job. I used to be pretty strongly anti-JSF, but I've calmed down considerably... at this point I'm simply indifferent to it. I've had a couple of instances where JSF was seriously considered as a platform for a project, and I would have had little trouble going with it and working with it, there just wound up being some factors that made other choices be judged as better for the given situation. You should always do that, it's not just a matter of this or that is better than this or that in absolute terms, you can't make a general statement like that in my opinion. Don't use JSF because it's the standard, don't use Struts because it's the most popular still after all this time, use one or the other (or something else entirely!) because it suits your needs better than the other for a given project, simple as that. Regards, Sourav Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Rendering an image into s:div from ajax
In general with AJAX this isn't possible... there's no way at present to insert binary data, be it an image, PDF, whatever, into the page, and have the browser render it. What you would have to do is return HTML instead, which includes an img tag pointing to the image on the server, which in this case would be your chart, written out somewhere with some ID. For instance, you might write it to a database, using some unique identifier for the user as a key, and then your img tag points to an Action, with the ID as a query string, that retrieves the image from the database based on the ID. So it would go something like: User clicks generate chart button -- Server generates chart, writes to DB --- Return HTML like img src=getChart.action?id=1234/ -- HTML inserted into page, browser requests getChart.action to get image, which is an Action, not an image -- Action retrieves image from DB and returns it -- Chart displayed Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Fri, July 13, 2007 9:54 am, travers wrote: Hi is it possible to specify href in s:div to render content as an image ? I have a struts2 action returning a JfreeChart chart as png. Without ajax, image src=/chart/ViewChart.action/ shows the chart correctly, but the following renders it as text (well actually the binary stuff inside the png) s:url id=ajaxCallUrl value=/chart/ViewChart.action/ s:div theme=ajax href=%{ajaxCallUrl} loadingText=Loading Chart... /s:div -- View this message in context: http://www.nabble.com/Rendering-an-image-into-%3Cs%3Adiv-from-ajax-tf4074632.html#a11580059 Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
Dunno if this might help, but: http://www.omnytex.com/struts_benchmarking.zip In it you'll find two applications, one for S1 (1.3.8) and one for S2 (2.0.8)... they are both (I think!) pretty much equivalent, and about as simplistic as you can get. Also included is a JMeter test plan to run against them (just disable one or the other thread group, wouldn't want to test them both at the same time!). Just ran a quick-and-dirty comparison of the two using the test plan... I ran 100 users with no ramp-up... local Tomcat instance (6.0.13)... the one difference is that the S1 version was compiled with JDK 1.4.2, and the S2 version with 1.6.0, so there's at least one potentially big variance right up front... here's what I saw: S1 results: 4256 samples, 913 average, 108.6/sec throughput, 16.01 KB/sec S2 results: 4165 samples, 1974 average, 50.0/sec throughput, 7.38 KB/sec I'm not claiming this to be the perfect test, nor do I believe there's not some flaws in there (benchmarking is always a tough thing to get quite right, especially trying to do a comparison like this)... but, unless someone can point out some obvious mistakes I made, the numbers don't lie: S2 *looks*, *on the surface* at least, to be inherently twice as slow as S1. I'm not trying to make any sensational claims here, and again, I may have totally blown it in the first place (I did throw this together in about 30 minutes after all), but if we can use this as a basis going forward, maybe build it up as a more expansive, realistic and solid benchmarking suite, then it's all good in the end. Anyway, it's there, if anyone's interested. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Ing. Andrea Vettori wrote: Il giorno 12/lug/07, alle ore 16:31, Guillaume Carré ha scritto: 2007/7/12, Ing. Andrea Vettori [EMAIL PROTECTED]: Compared to nothing... they are pure numbers. They are simply just good enought (to me). If we don't have this in mind we should use assember for everything :) what I meant was: maybe it could be a good idea to redevelop your screens with, say struts 1 for example, and compare the results I can't do that... simply don't have the time... :) In the high load test, after 10 seconds you have about 90 users (the other 10 should have finished). Having a response time of 2,5 seconds for a db search and result display under such load seems very good to me. Don't you ? it depends :-) 2.5s doesn't say much to me, I would need to know how much time is consumed in your DB requests, how much time is consumed in your service layer, etc etc. Is it 90 users really active at the same time, meaning using 90 threads on the server?if it is, do you have at least 90 connections in your pool? or did you put think times in your tests? No think time... I have 250 threads but I have a limit of 50 connections on my pool. I'll try to raise the number of maximum connection to see if the MP3 list test gets better. However I think that struts alone is performing well for my app; don't know if it's because i'm using only few OGNL expressions on my jsp pages. -- Ing. Andrea Vettori Consulente per l'Information Technology - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --No virus found in this incoming message. Checked by AVG Free Edition.Version: 7.5.476 / Virus Database: 269.10.4/897 - Release Date: 7/11/2007 9:57 PM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
The build scripts and full source are of course included, so by all means feel free to recompile and rerun... I'm getting into something else at the moment otherwise I'd do it right now because I'd be very interested in seeing if the results converge a bit (I wouldn't expect them to diverge, that's for sure!). Frank James Holmes wrote: My only point was that the S1 and S2 apps should be compiled using the same version of Java. I didn't mean to imply any version that S2 should support. I guess in a perfect world the test should be compiled with 1.5 since that is what S2 supports. James On Thu Jul 12 15:34 , Ted Husted sent: Are we targeting 1.6 now, or is the S2 target platform still 1.5? -T. On 7/12/07, James Holmes [EMAIL PROTECTED] wrote: Perfect! This is an excellent start. I think both should be compiled with 1.6.0. That will immediately remove that element of difference between the two. James - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
Well, here's exactly why I hate benchmarking: it's never consistent! :) This time, everything compiled with JDK 1.6 (it's what I have installed along side 1.4.2) and all used 5000 samples (updated test plan to always do 5000 samples)... S1: 685 average, 142.3/sec throughput, 20.89 KB/sec So, an improvement there, maybe because of the JDK, maybe not. S2 w/OGNL 2.6: 1054 average, 87.3/sec throughput, 12.87 KB/sec That's better than the last run, but for no apparent reason! S2 W/OGNL 2.7: 1073 average, 85.8/sec throughput, 12.65 KB/sec Wuh?!? Ok, I think we can most likely dismiss the difference as within a statistical margin of difference, which means either (a) these tests are just flat-out flawed somehow, (b) the OGNL bump, at least as far as just a straight drop-in, makes no real difference, or (c) OGNL isn't being used to enough of an extent in this test to notice a difference (I'm frankly betting on that one). FYI, I've created JIRA ticket WW-2040... that way if others want to extend the apps, they can attach an updated version to the ticket so everyone can share. Frank cilquirm wrote: Frank, would you care to give the same tests a shot with ognl 2.7 and javassist in the mix. Although none of this is purely scientific, at least evaluations on that regard give us some level of subjective information. The ognl 2.7 and javassist jar are available via the tapestry-4.2-libs download : http://tapestry.apache.org/download.html Frank W. Zammetti wrote: Dunno if this might help, but: http://www.omnytex.com/struts_benchmarking.zip In it you'll find two applications, one for S1 (1.3.8) and one for S2 (2.0.8)... they are both (I think!) pretty much equivalent, and about as simplistic as you can get. Also included is a JMeter test plan to run against them (just disable one or the other thread group, wouldn't want to test them both at the same time!). Just ran a quick-and-dirty comparison of the two using the test plan... I ran 100 users with no ramp-up... local Tomcat instance (6.0.13)... the one difference is that the S1 version was compiled with JDK 1.4.2, and the S2 version with 1.6.0, so there's at least one potentially big variance right up front... here's what I saw: S1 results: 4256 samples, 913 average, 108.6/sec throughput, 16.01 KB/sec S2 results: 4165 samples, 1974 average, 50.0/sec throughput, 7.38 KB/sec I'm not claiming this to be the perfect test, nor do I believe there's not some flaws in there (benchmarking is always a tough thing to get quite right, especially trying to do a comparison like this)... but, unless someone can point out some obvious mistakes I made, the numbers don't lie: S2 *looks*, *on the surface* at least, to be inherently twice as slow as S1. I'm not trying to make any sensational claims here, and again, I may have totally blown it in the first place (I did throw this together in about 30 minutes after all), but if we can use this as a basis going forward, maybe build it up as a more expansive, realistic and solid benchmarking suite, then it's all good in the end. Anyway, it's there, if anyone's interested. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Ing. Andrea Vettori wrote: Il giorno 12/lug/07, alle ore 16:31, Guillaume Carré ha scritto: 2007/7/12, Ing. Andrea Vettori [EMAIL PROTECTED]: Compared to nothing... they are pure numbers. They are simply just good enought (to me). If we don't have this in mind we should use assember for everything :) what I meant was: maybe it could be a good idea to redevelop your screens with, say struts 1 for example, and compare the results I can't do that... simply don't have the time... :) In the high load test, after 10 seconds you have about 90 users (the other 10 should have finished). Having a response time of 2,5 seconds for a db search and result display under such load seems very good to me. Don't you ? it depends :-) 2.5s doesn't say much to me, I would need to know how much time is consumed in your DB requests, how much time is consumed in your service layer, etc etc. Is it 90 users really active at the same time, meaning using 90 threads on the server?if it is, do you have at least 90 connections in your pool? or did you put think times in your tests? No think time... I have 250 threads but I have a limit of 50 connections on my pool. I'll try to raise the number of maximum connection to see if the MP3 list test gets better. However I think that struts alone is performing well for my app; don't know if it's because i'm using only few OGNL expressions
Re: Struts 2 performance
Ted Husted wrote: On 7/12/07, Frank W. Zammetti [EMAIL PROTECTED] wrote: (b) the OGNL bump, at least as far asjust a straight drop-in, makes no real difference I don't think we really expected the drop-in to make a difference without making other adjustment to take advantage of the enhancements. Yeah, that's the understanding I had from all the comments, just thought it was worth saying in case anyone did have that expectation. -T. Frank - 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/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 2 performance
I'm still betting OGNL isn't hit in any significant way in this test anyhow... in fact, is it used at all? I'm not even certain... I assume this line does: s:property value=greeting / But maybe I'm wrong? Like I said, even if it is, if *that* made any sort of real difference in the numbers, I'd be flat-out shocked. Frank James Holmes wrote: Frank, There should not be a noticable difference with OGNL yet. The performance improvements in OGNL 2.7 require expressions to be compiled before being executed. The current S2 code does not do this yet so it cannot realize the performance gains yet. Sent via BlackBerry. -Original Message- From: Frank W. Zammetti [EMAIL PROTECTED] Date: Thu, 12 Jul 2007 17:10:17 To:Struts Users Mailing List user@struts.apache.org Subject: Re: Struts 2 performance Well, here's exactly why I hate benchmarking: it's never consistent! :) This time, everything compiled with JDK 1.6 (it's what I have installed along side 1.4.2) and all used 5000 samples (updated test plan to always do 5000 samples)... S1: 685 average, 142.3/sec throughput, 20.89 KB/sec So, an improvement there, maybe because of the JDK, maybe not. S2 w/OGNL 2.6: 1054 average, 87.3/sec throughput, 12.87 KB/sec That's better than the last run, but for no apparent reason! S2 W/OGNL 2.7: 1073 average, 85.8/sec throughput, 12.65 KB/sec Wuh?!? Ok, I think we can most likely dismiss the difference as within a statistical margin of difference, which means either (a) these tests are just flat-out flawed somehow, (b) the OGNL bump, at least as far as just a straight drop-in, makes no real difference, or (c) OGNL isn't being used to enough of an extent in this test to notice a difference (I'm frankly betting on that one). FYI, I've created JIRA ticket WW-2040... that way if others want to extend the apps, they can attach an updated version to the ticket so everyone can share. Frank cilquirm wrote: Frank, would you care to give the same tests a shot with ognl 2.7 and javassist in the mix. Although none of this is purely scientific, at least evaluations on that regard give us some level of subjective information. The ognl 2.7 and javassist jar are available via the tapestry-4.2-libs download : http://tapestry.apache.org/download.html Frank W. Zammetti wrote: Dunno if this might help, but: http://www.omnytex.com/struts_benchmarking.zip In it you'll find two applications, one for S1 (1.3.8) and one for S2 (2.0.8)... they are both (I think!) pretty much equivalent, and about as simplistic as you can get. Also included is a JMeter test plan to run against them (just disable one or the other thread group, wouldn't want to test them both at the same time!). Just ran a quick-and-dirty comparison of the two using the test plan... I ran 100 users with no ramp-up... local Tomcat instance (6.0.13)... the one difference is that the S1 version was compiled with JDK 1.4.2, and the S2 version with 1.6.0, so there's at least one potentially big variance right up front... here's what I saw: S1 results: 4256 samples, 913 average, 108.6/sec throughput, 16.01 KB/sec S2 results: 4165 samples, 1974 average, 50.0/sec throughput, 7.38 KB/sec I'm not claiming this to be the perfect test, nor do I believe there's not some flaws in there (benchmarking is always a tough thing to get quite right, especially trying to do a comparison like this)... but, unless someone can point out some obvious mistakes I made, the numbers don't lie: S2 *looks*, *on the surface* at least, to be inherently twice as slow as S1. I'm not trying to make any sensational claims here, and again, I may have totally blown it in the first place (I did throw this together in about 30 minutes after all), but if we can use this as a basis going forward, maybe build it up as a more expansive, realistic and solid benchmarking suite, then it's all good in the end. Anyway, it's there, if anyone's interested. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! Ing. Andrea Vettori wrote: Il giorno 12/lug/07, alle ore 16:31, Guillaume Carré ha scritto: 2007/7/12, Ing. Andrea Vettori [EMAIL PROTECTED]: Compared to nothing... they are pure numbers. They are simply just good enought (to me). If we don't have this in mind we should use assember for everything :) what I meant was: maybe it could be a good idea to redevelop your screens with, say struts 1 for example, and compare the results I can't do that... simply don't have the time... :) In the high load test, after 10 seconds you have about 90 users
Re: Struts 2 performance
climbingrose wrote: The other thing I want to comment on is the use of Dojo as Ajax theme. I don't have much experience with Dojo apart from a few hours playing around with it. However, even with the latest version (0.9), Dojo just seems to be to heavy weight for most purposes. I mean if you only want a bloody calendar in your webapp, you don't want to load up a 100kb of javascript. This has been my experience with Dojo as well, to the point where we're now considering ripping Dojo out of a very highly complex project bit by bit (too much pain in doing it all at once). Nothing has been decided yet because we still believe Dojo has a lot to offer that makes it not a clear-cut decision, but your description is, in my experience, fairly accurate. Plus, it might be my experience only, Dojo seems to have the tendency to hang my browser everytime I open a Dojo-based app. This, however, doesn't jive with my experience. As I mentioned, I have one app using Dojo that is extremely complex, and I don't recall ever seeing it lock up the browser. We *have* had issues with memory consumption, but I can't say for certain yet whether it's Dojo (suspect it is at this point), and it's possible we're doing something wrong to cause it and not Dojo intrinsically having a problem. If your seeing lockups, it might be helpful to know that this isn't typical, based on my experience with it. In any case, my understanding is that the Ajax theme is being extracted out into a plugin specifically so that other libraries can be used in place of Dojo. While I think Dojo will still get a great deal of usage and attention, I think giving that flexibility will be a welcome move. Frank -- -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suggestions for login scheme using struts 1.x
We have web servers in front of the app servers, and this isn't an evolution of old apps, I'm talking newly developed apps. There's nothing unusual about that setup at all, it's pretty typical in an enterprise setting. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, June 13, 2007 1:17 am, robinbajaj wrote: thanks for your input. I will evaluate it tomorrow morning. By the way, what do you think of the idea of having a web-server in front of an app-server for login purposes. Isn't that unnecessary. I am sure our current architecture is because the way things evolved for this 5-6 year old webapp. But I think I can also consider just taking out the webserver and letting weblogic app server handle the initial login and use some security filter (may be acegi or regular custom written filters) to make sure the user is still entitled to access any specific resources. We can still have the webserver for the static content, but login piece should get moved entirely to the app-server. what do you think ??? thanks again for any helpful pointers in advance, robin Frank W. Zammetti wrote: All of our security is LDAP-based, but we simply use the built-in mechanisms that Websphere provides... you can easily tell it, in conjunction with plain old J2EE security, to validate users against LDAP. This works very similar to the steps you outline. Now, on top of that we've build our own security framework to handle the things that J2EE security and/or Websphere doesn't, things like cross-site scripting, password policy adherence, extended timeout capabilities, and so forth. The other nice thing about it is that we essentially get single sign-on for free... the LPTA token that is used can be used across applications, so long as Websphere is configured properly (has to do with being in the same cell, or making cells aware of each others' tokens, details I'm frankly not as familiar with). Note that this is different than the session cookie your familiar with... it's a token created by Websphere when a user has been authenticated. In your shoes, I think my gut reaction would be to explore using J2EE security with whatever container your going to use, see how far you can get with just that. I suspect you can get most of the way... then see if you can fill the gaps with simple filters and such... obviously you don't want to take that exercise too far though or your just inventing things that already exist somewhere, but if its not a huge amount it might be worth it (and you may find you don't need to do anything at all beyond the standard stuff). HTH, Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! robinbajaj wrote: Hi All, I am working on a production web application written in Struts 1.2.x . Recently we undertook an effort to redesign our login architecture. Currently our architecture is that 1) user is presented with a login page served by IIS server (ASP pages) 2) user's provided username/password is validated against LDAP server, and a token is returned. That token is stored in the database as well. 3) That security token is put in the session scope and then the control is passed on the weblogic server, where the security token from the session is compared with the one stored in the database to verify its the same user who logged in at step (1). 4) the struts web flows are selected and user selects and runs through the appropriate web flows. I am working on redesigning this login scheme. The IIS is only there since the login front-end was originally designed in ASP and either way its a good practice to have a web server to serve the static pages and an app server for dynamic content. (we don't mind replacing IIS with Apache tomcat etc..if we have to..) I am looking for any suggestions that any experienced web developers have implemented to implement a login scheme (*using LDAP repositories). I recently evaluated Spring's ACEGI framework and found it to be pretty promising. I am not sure, if there's anything else that I should/can consider. Moreover, my question for this forum is whether the above architecture is a good one or is there some scope
Re: suggestions for login scheme using struts 1.x
Typically, the web server is what receives the request... it then determines what type of resouce is being served, and if its something that the app server needs to handle (a servlet for instance), it passes the request along. So in a very real sense it's in front of the app server. Now, take something like Tomcat for instance... it essentially has a web server built in. I've never seen one, but if someone drew a Tomcat architecture diagram, I'd expect to see the web server component in front of the servlet container component, acting something like a proxy (having said that, someone will inevitably tell me I'm wrong!). Probably the primary benefit to this is that you offload work from the app server and let the web server serve resources that it generally can more efficiently. Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, June 13, 2007 11:36 am, robinbajaj wrote: thanks for your input Frank. When I mentioned about taking out the webserver, I only meant not to have it do the login. It can still serve the static content. But I suggested merging the login piece and the actual web-app, and running them both on the weblogic app server. what I don't understand is then why do I hear people (including you) mention that their webserver is in front of their appserver. What kind of functionality does a webserver provide by being in front of the app server. I mean, having it for serving the static content does not put it architecturally in front of the app server. Please help me understand, robin Frank W. Zammetti wrote: We have web servers in front of the app servers, and this isn't an evolution of old apps, I'm talking newly developed apps. There's nothing unusual about that setup at all, it's pretty typical in an enterprise setting. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of Practical Ajax Projects With Java Technology (2006, Apress, ISBN 1-59059-695-1) and JavaScript, DOM Scripting and Ajax Projects (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! On Wed, June 13, 2007 1:17 am, robinbajaj wrote: thanks for your input. I will evaluate it tomorrow morning. By the way, what do you think of the idea of having a web-server in front of an app-server for login purposes. Isn't that unnecessary. I am sure our current architecture is because the way things evolved for this 5-6 year old webapp. But I think I can also consider just taking out the webserver and letting weblogic app server handle the initial login and use some security filter (may be acegi or regular custom written filters) to make sure the user is still entitled to access any specific resources. We can still have the webserver for the static content, but login piece should get moved entirely to the app-server. what do you think ??? thanks again for any helpful pointers in advance, robin Frank W. Zammetti wrote: All of our security is LDAP-based, but we simply use the built-in mechanisms that Websphere provides... you can easily tell it, in conjunction with plain old J2EE security, to validate users against LDAP. This works very similar to the steps you outline. Now, on top of that we've build our own security framework to handle the things that J2EE security and/or Websphere doesn't, things like cross-site scripting, password policy adherence, extended timeout capabilities, and so forth. The other nice thing about it is that we essentially get single sign-on for free... the LPTA token that is used can be used across applications, so long as Websphere is configured properly (has to do with being in the same cell, or making cells aware of each others' tokens, details I'm frankly not as familiar with). Note that this is different than the session cookie your familiar with... it's a token created by Websphere when a user has been authenticated. In your shoes, I think my gut reaction would be to explore using J2EE security with whatever container your going to use, see how far you can get with just that. I suspect you can get most of the way... then see if you can fill the gaps with simple filters and such... obviously you don't want to take that exercise too far though or your just inventing things that already exist somewhere, but if its not a huge amount it might be worth it (and you may find you don't need to do anything at all beyond the standard