Re: Automatically detecting struts-config changes and reload app.
Hey Antony: Check out the struts admin functionality: Make sure you have the admin mappings in your struts-config.xml, then point your browser to /yourContext/admin/reload.do and you'll see the magic..:) Regards, Geeta Antony Paul wrote: Is it possible to automatically detect changes in struts-config.xml and reload the application ?. I know that Log4J(or Tomcat) detects changes to log4j.properties and reload the application. Antony Paul - 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 cookbook
Danilo: Is there a chapter or two which you could make available on-line for a preview..? :) Geeta Danilo Gurovich wrote: Actually, a struts cookbook is just in the finishing stages. George Franciscus and I have been hard at work at it for the last year, and it's in final review.
Re: Mapping Forward to new form
Ciaran: Just create a new formbean and put it in the request before you forward..:) Geeta Ciaran Hanley wrote: I would like to map to a new blank form, how do I do this? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to implement such an action?
Alex: ok, let me state the problem as i understand it: ActionA -- page1.jsp --ActionB if (success in ActionB) forward to success.jsp else forward to ActionA. Your question is how to get the if failure part working. If my understanding of your problem is wrong, please write back and tell us where I'm wrong. However, if this *is* the problem, here's how you can implement a solution using hidden vars: In page1.jsp, use a hidden var: html:hidden property=theAction value=ActionA / In ActionB.execute, if failure do the following: String theAction = formBean.getTheAction(); ActionForward failureForward = new ActionForward(); failureForward.setName(failure); failureForward.setPath(theAction); log.debug(Redirecting to + failureForward.getName() +: + failureForward.getPath()); return failureForward; Hth, Geeta chiu alex wrote: Maybe there is a solution,which is much like using hidden jsp variable as you said in previous mail. Regards, Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to implement such an action?
Alex: Sorry i have been too busy to keep up with you.. but glad to hear you have solved your problem.. Seems you have graduated from newbie-land..:) Good luck! Geea chiu alex wrote: Geeta: Ok, through reading the struts taglib source code, I find can use RequestUtils.lookup(pageContext, name, property, scope); to get the form bean variable inside the tag class. So I think this problem is almost solved. many thanks, Alex From: chiu alex [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: how to implement such an action? Date: Fri, 19 Mar 2004 01:19:53 +0800 Geeta: Yes,that's right,thanks. just a little difference here, ActionA can has the formbean of page1.jsp and ActionB cannot(because it cannot be tied with many jsps, and actually it need to be tied with a new success.jsp).So my soltion is put the ActionA in ActionB's request parameter instead of getting it from formbean,like this statement in page1.jsp: META HTTP-EQUIV=refresh CONTENT=30;URL=/../ActionB.do?preurl=/../ActionA.do I have written a custom tag to replace it like this: app:redirect page=/ActionB.do preurl=ActionA.do/ so I just have one question, how to nicely replace the string after preurl= with the hidden var value. how about just like this: html:hidden property=theAction value=ActionA / app:redirect page=/ActionB.do propery=theAction/ Can it work? and how can the tag class recognize the formbean's variable? maybe this is the key point here. Regards, Alex From: Geeta Ramani [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: how to implement such an action? Date: Thu, 18 Mar 2004 08:20:50 -0500 Alex: ok, let me state the problem as i understand it: ActionA -- page1.jsp --ActionB if (success in ActionB) forward to success.jsp else forward to ActionA. Your question is how to get the if failure part working. If my understanding of your problem is wrong, please write back and tell us where I'm wrong. However, if this *is* the problem, here's how you can implement a solution usinghtml:hidden property=theAction value=ActionA / hidden vars: In page1.jsp, use a hidden var: In ActionB.execute, if failure do the following: String theAction = formBean.getTheAction(); ActionForward failureForward = new ActionForward(); failureForward.setName(failure); failureForward.setPath(theAction); log.debug(Redirecting to + failureForward.getName() +: + failureForward.getPath()); return failureForward; Hth, Geeta chiu alex wrote: Maybe there is a solution,which is much like using hidden jsp variable as you said in previous mail. Regards, Alex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/ - 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 implement such an action?
Alex: Your initial page is just a jsp, right? So why would you not use your action mapping to say something like if success then forward to newpage.jsp and if not forward to samePage.jsp..? This will work unless you are using this refresh action in many pages..? In which case, you will have to remember the page - and that can be done - but if the simpler solution works, that may be best, especially since you say you are a newbie..:) Please ignore this note if you have already received emails about your question: our mail server has been *really* slow recently and I can see no replies to your question yet.. Regards, Geeta chiu alex wrote: Hello,everyone, I want to implement such an action which is actually activated by within the meta:refresh tag. (that means it will be called every 30 seconds). What the action need to do is to make some judgements. If it get true result, it forward to another page, or else it stays at previous page and do nothing, so user will see no change. Obviously, action need to remember that page, but I do not know how to put it. I am just a newbie in struts. So could you kindly give me some clue to it. Thanks! Alex _ Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/ - 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 book give-away
Hi Srikanth: I tried to download the sample chapter via the link on http://www.objectsource.com/ but seem to run into trouble..? I got the following error message on the status bar of my browser: An error has occurred while trying to use this document. I am using Mozilla 5 and Acrobat 4.. Wondering if anybody else is facing this problem .. and/or if you'd mind sending me the document (offline)? Thanks in advance! Geeta Srikanth Shenoy wrote: I am the author of Struts Survival Guide - yet another entrant in the Struts book shelf. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts book give-away
Clarification: I did manage to download the pdf, but cannot seem to open i in Acobat 4.0: the file apparantly is corrupted.. Geeta Geeta Ramani wrote: Hi Srikanth: I tried to download the sample chapter via the link on http://www.objectsource.com/ but seem to run into trouble..? I got the following error message on the status bar of my browser: An error has occurred while trying to use this document. I am using Mozilla 5 and Acrobat 4.. Wondering if anybody else is facing this problem .. and/or if you'd mind sending me the document (offline)? Thanks in advance! Geeta Srikanth Shenoy wrote: I am the author of Struts Survival Guide - yet another entrant in the Struts book shelf. - 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 book give-away
Old versions of software - the story of my life.. (:( However, the download page does say it should work with acrobat 4 and 5.. ? Thanks for your response! Geeta Bryce Fischer wrote: Clarification: I did manage to download the pdf, but cannot seem to open i in Acobat 4.0: the file apparantly is corrupted.. Geeta I downloaded and opened fine. You are using a very old version of Acrobat. My version is 6.0, so maybe it only supports a newer version? -- Bryce Fischer [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts book give-away
Srikanth: Thanks for your promt reply. Seems like I'll have to wait till I get home and use some decent software then..;) Geeta P.S. You may want to correct the notation about acrobat 4 on the web site then..:) Srikanth Shenoy wrote: Hi Geeta, The PDF was created using Adobe PDF 5 standard and using the encryption to disable printing. All Adobe PDF 5 files open in Adobe 4, except the encrypted ones. There lies the problem... You have to use Acrobat Readers 5 and above -Srikanth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to implement such an action?
Alex: Here's an easy way to implement this: Have a hidden variable in each of your jsps which reflects the name of the jsp you are on and use that in your action class to prepare the forward (do you see what i'm saying..? I can elaborate if you'd like..) . You could also use something like request.getRequestURL() (I think this is right..look in the API to be sure..) if you don't want to use hidden variables.. Hope this helps, Geeta chiu alex wrote: Geeta: Yes, that's the point.This refresh action need to exist in many pages. looks like it is easy to implement if it can just do a back operation in that action class when false return. But actually as I know the action doesnot provide such operation. So do you have some idea about this? Regards, Alex From: Geeta Ramani [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: how to implement such an action? Date: Wed, 17 Mar 2004 07:16:00 -0500 Alex: Your initial page is just a jsp, right? So why would you not use your action mapping to say something like if success then forward to newpage.jsp and if not forward to samePage.jsp..? This will work unless you are using this refresh action in many pages..? In which case, you will have to remember the page - and that can be done - but if the simpler solution works, that may be best, especially since you say you are a newbie..:) Please ignore this note if you have already received emails about your question: our mail server has been *really* slow recently and I can see no replies to your question yet.. Regards, Geeta chiu alex wrote: Hello,everyone, I want to implement such an action which is actually activated by within the meta:refresh tag. (that means it will be called every 30 seconds). What the action need to do is to make some judgements. If it get true result, it forward to another page, or else it stays at previous page and do nothing, so user will see no change. Obviously, action need to remember that page, but I do not know how to put it. I am just a newbie in struts. So could you kindly give me some clue to it. Thanks! Alex _ Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/ - 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] _ Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn - 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]
[OT] Re: Struts book give-away
ok, that's 3 strikes.. I'm out..:O Srikanth Shenoy wrote: That applies for the complete ebook :) Since the purchased ebook is not encrypted to constrain the printing, it will open up in Acrobat 4 reader too. Only the sample chapter wont.. ;( -Srikanth Geeta Ramani [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... Old versions of software - the story of my life.. (:( However, the download page does say it should work with acrobat 4 and 5.. ? Thanks for your response! Geeta Bryce Fischer wrote: Clarification: I did manage to download the pdf, but cannot seem to open i in Acobat 4.0: the file apparantly is corrupted.. Geeta I downloaded and opened fine. You are using a very old version of Acrobat. My version is 6.0, so maybe it only supports a newer version? -- Bryce Fischer [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: Handling multiple submits from a single form
Sajith: This very question was asked and answered recently (just within the past couple of weeks, I think??).. Maybe you can search the archives..? Here's the url for the archives: http://www.mail-archive.com/[EMAIL PROTECTED]/ Write back to the list if you cannot find what i am referring to and I'l see if I can find a more specific link for you.. Regards, Geeta [EMAIL PROTECTED] wrote: I have multiple actions possible from a single JSP page. How can I handle it using struts? I have single form with multiple buttons and I am using the html tag library. How can I handle it without using _javascript_? Description: application/unknown-content-type
Re: Context relative URL
Hi JP: I believe you can use html:rewrite for this. As in: onmouseover=this.src='html:rewrite page=/images/inicio-over.gif /' etc. Hope this helps, Geeta Joao Batistella wrote: Hello! How can I have this generated with all the images with myapp before the source of the image? Like this: img src=/myapp/images/inicio.gif border=0 onmouseover=this.src='/myapp/images/inicio-over.gif' onmouseout=this.src='/myapp/images/inicio.gif' onmousedown=this.src='/myapp/images/inicio-down.gif' Thanks, JP - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic javascript forms
How about usng more Javascript and using onFocus() (or is it onChange()?) to populate hidden fields which can be picked up by your form bean..? (Not a solution I like but then i hate most all Javascript..) regards, Geeta mike barretta wrote: thanks in advance for any help... i have a form where i let the user choose how many text input fields they want and then via javascript, the inputs are displayed. ex: user has a select box to make a choice of 1-10. after selection is made, the onChange event will fire and write however many text inputs on the screen using the innerHTML property. my problem is that since javascript changes the screen at runtime, i can't use html:input to capture the text from the form because it isn't being interpreted by struts. if the javascript uses the standard input type=text tags, it seems like my actionform doesn't get populated with the data. so, anyway to do this without having to submit the form after the user selects how many inputs they want? - 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 use bean:define for this
Dean: First, you need this countries Collection available in kind of an application-wide context, right? I mean there is no reason to attach this as a session variable since I imagine it would not change from user to user... Also such variables are best initialised/populated in a class (the model) rather than in a jsp, since jsps should just be used mainly for the view.. So i guess I don't see why you are thinking of bean:define tags for instantiating this Collection...? Am i misunderstanding your problem..? Regards, Geeta Dean A. Hoover wrote: I am still on a steep learning curve for struts/tiles and to a degree, trying to remember certain things about JSP. Anyway, struts has this construct I want to use for building an HTML select tagset from a java collection. Here's the jsp snippet: html:select property=contactInfoWidgetsSubFormCountryCode html:options collection=countries property=value labelProperty=label/ /html:select The reference to countries is a java.util.Collection that is put into the session. I have a class I wrote CountryOptions that contains one static method: public static Collection getOptions() that creates what it needs to. Now what I need to figure out is the best way to instantiate the countries variable in the session. I think it might be by using the bean:define tag, but I am not sure. Has anyone done this before? Thanks. Dean - 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 use bean:define for this
Dean: Oh, Ok, I think i see what your issue is now (shouldn't have hit that earlier send so fast..!) Ok, in the action before you forward to the jsp, populate your countries variable. Then set your session variable (in your Action class), say, session.setAttribute(countries, countries); (though i still wonder about making this a session var.. anyway..). In your jsp then you can simply say: bean:define id=allCountries name=countries scope=session type=java.util.Collection / You should then be able to access the allCountries Collection further down in your jsp.. Hope this helps, Geeta that creates what it needs to. Now what I need to figure out is the best way to instantiate the countries variable in the session. I think it might be by using the bean:define tag, but I am not sure. Has anyone done this before? Thanks. Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to use bean:define for this
Dean: Yes, I do see your problem and since (as i inderstand it) Struts tags work via reflection, it needs an instance of the class before you can use bean:define kind of things.. So my guess is you will have to bite the bullet and just use plain Java (remember the good ole days??..;)): %java.util.Collection allCountries = myClass.myStaticMethod.getCountries; % and then go ahead and use allCountries as usual later in your jsp.. I believe you can use it within struts tags with no problem.. Regards, Geeta Dean A. Hoover wrote: that's what I am trying to avoid... I am already doing it in an Action. I want the collection to be instantiating in JSP where it is used. The reason I am putting it in session is that the data comes out of a database but is quite static. Are you suggesting application scope or page? As I said in my previous message, I already have a class with a static method that will return a populated collection. Dean - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Object Design Question
Avinash: ...Adding to what Jacob says below: if you are writing your own, this is a good link to study: http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html Regards, Geeta Hookom, Jacob wrote: It's always on a case by case basis. When and how much do you need at a given time? Hibernate/JDO/OJB/etc can handle these things for you via a config to specify lazy relationships. When you are talking about web application with read data (data purely pushed to the view like a list of persons with addresses), then the best way IMHO is to write a special view object and query for this case. List View Objects Select By Id Grab Business Object By Id - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: porting to struts
Rajat: Markus is quite right.. however, for what it's worth, you may like to know we pretty much did exactly what you are suggesting: Relaese 2 of one of our bigger web applications was an extension (funcionality-wise) of Release 1. Relaese 1 was completely written with servlets/jsps and we chose to use Struts for Release 2. Also, as you mention below, access to the connection pool logic was written early on (therefore with a servlet). Relaese 2 thus was a combination of the old and the new and we have not seen any problems at all. In fact Release 3 is now ready (in a couple of weeks) to be moved into production - this has more Struts stuff - and testing has produced no issues at all which were related to the fcat of Struts and non-Struts code living togther. As far a we can see, it is a happy co-existance.. Which of course makes sense, since Struts is after all a glorified servlet, albeit a great one..:) Hope this helps and good luck with your new Struts venture! Geeta Markus wrote: On 10 Mar 2004, at 12:02, Rajat Pandit wrote: Hello All, we have a product which was built on an inhouse developed controller, and we are currently planning to port the application on struts. This application was built on the MVC architecture with a central controller as the application entry point. for phase I we have to make additional modules for this product and then later integrate these modules in the new ported application. my questions are as follows. a. can i build the new modules around ActionServlet so that the current controller can pass the control to the struts controller when required. You can use servlets and the struts action servlet together yes b. will i be able to access the objects stored in the request, application or session objects by the current controller frm my action class? Yes. c. will the ActionController be able to load the database connections/connection pooling (we are using oracle) Yes.. Don't make any difference which db you use. d. will there be any performance issues? The struts action servlet is an easy way of not getting to bogged down with threads and such like, as the action servlet is one servlet instance. do let me know your views. i need to make a report today and send it over. thanks a lot in advance for ur time. Just bolt struts on to your existing stuff and will work fine (assuming you existing stuff works at the moment). One suggestion, why not just try it out? best regards rajat - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Hi Rajat, I don't know if it is a good idea to answer all your questions with a straight yes without knowing your implementation. It could be possible to port your application to struts but you have to be careful. Kind regards, Markus - 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: porting to struts
Correction: Geeta Ramani wrote: Rajat: living togther. As far a we can see, it is a happy co-existance.. Which of course makes sense, since Struts is after all a glorified servlet, albeit a great one..:) ..I meant of course Struts is built around a (controller) servlet .. not Struts *is a servlet! geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Regarding Error in Validator - Urgent Help
Hi Ramachandran: Here's a suggestion: look at line number 63 of the servlet (in your work directory) generated by your first.jsp. See what the code there is and that may give you an idea of what's going wrong.. (seems like a null pointer somewhere, so try to see what may be null in that line of code ..) Regards, Geeta Ramachandran wrote: Root cause: java.lang.ExceptionInInitializerError at _0002ffirst_0002ejspfirst_jsp_0._jspService(_0002ffirst_0002ejspfirst_jsp_0. java:63) Caused by: java.lang.NullPointerException at org.apache.struts.util.MessageResources.getMessageResources(MessageResources .java:577) at org.apache.struts.taglib.html.HtmlTag.(HtmlTag.java:96) ... 16 more - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with Map-backed ActionForm and Key value
Hey Brian: Have you tried evaluating the keyValue ahead of time? As in: %String myKey = ..blah-blah.. using userId;% and then: html:text property=%=myKey% readonly=true size=2 / Give it a shot if you haven't.. Good luck! Geeta Brian Boyle wrote: Hey, I am using a map-backed ActionForm and so in my JSP code I have a html:text tag that looks like this: html:text property=value(%=value.getUserId()%) readonly=true size=2 / The reason I have a scriplet in there is because I have a dynamic form and the value of the key changes all the time. I want the value of the key to be the id of the user logged in. However, this is giving me problems because the value of the key is being taken literally as %=value.getUserId()% rather than the value of the userId. The scriplet %= value.getUserId % is correct because I have tested it with System.out.println(value.getUserId). So it looks like I cannot put my scriplet in there. Has anyone experienced this before? Or does anyone know why it won't et me do this? Any way to get around this? I'd appreciate any help. I've been stuck on it for two days now. Cheers, B _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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: Problem with Map-backed ActionForm and Key value
Hi Brian: Here's what i suggested (I am wondering if i misunderstand your problem maybe..?): *First* completely evaluate your key value outside your html:text tag. Then say: html:text property=%=keyVal%..etc. / Notice how your property does not have to access the hashmap inside the tag.. So can you do that in your situation? Geeta Brian Boyle wrote: Hi!, Thanks for the quick response. I have already tried declaring myId as String myId = value.getCandId();. I then put myId as an argument in html:text title=myinput property=value(%=myId%) readonly=true size=2 / but the key value is still being taken literally as %=myId%. I don't know why it should be doing this because shouldn't you just be able to pass in an argument as long as it is of type String? Brian From: Geeta Ramani [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Problem with Map-backed ActionForm and Key value Date: Sun, 07 Mar 2004 12:30:43 -0500 MIME-Version: 1.0 Received: from mail.apache.org ([208.185.179.12]) by mc2-f12.hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Sun, 7 Mar 2004 09:29:04 -0800 Received: (qmail 47563 invoked by uid 500); 7 Mar 2004 17:28:46 - Received: (qmail 47546 invoked from network); 7 Mar 2004 17:28:46 - Received: from unknown (HELO mail-gw.cmpco.com) (12.15.147.121) by daedalus.apache.org with SMTP; 7 Mar 2004 17:28:46 - Received: from mail-gw.cmpco.com (localhost.cmpco.com [127.0.0.1]) by mail-gw.cmpco.com (8.11.6/8.7) with ESMTP id i27HSlD24766 for [EMAIL PROTECTED]; Sun, 7 Mar 2004 12:28:47 -0500 Received: (from [EMAIL PROTECTED])by mail-gw.cmpco.com (8.11.6/8.11.6) id i27HSkM24711for [EMAIL PROTECTED]; Sun, 7 Mar 2004 12:28:46 -0500 Received: from mercury.cmpco.com(10.20.2.227) by mail-gw.cmpco.com via smap (V2.1)id sma024625; Sun Mar 7 12:28:25 2004 Received: from cmpco.com ([10.108.200.51]) by mercury.cmpco.com (Netscape Messaging Server 3.6) with ESMTP id AAA51A6 for [EMAIL PROTECTED]; Sun, 7 Mar 2004 12:28:24 -0500 X-Message-Info: JGTYoYF78jFLwRd6tLmi+VrTUMobpNqX Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk List-Unsubscribe: mailto:[EMAIL PROTECTED] List-Subscribe: mailto:[EMAIL PROTECTED] List-Help: mailto:[EMAIL PROTECTED] List-Post: mailto:[EMAIL PROTECTED] List-Id: Struts Users Mailing List struts-user.jakarta.apache.org Delivered-To: mailing list [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] Organization: Central Maine Power Company X-Mailer: Mozilla 4.75 [en]C-CCK-MCD (WinNT; U) X-Accept-Language: en References: [EMAIL PROTECTED] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 07 Mar 2004 17:29:04.0609 (UTC) FILETIME=[B01E9D10:01C40469] Hey Brian: Have you tried evaluating the keyValue ahead of time? As in: %String myKey = ..blah-blah.. using userId;% and then: html:text property=%=myKey% readonly=true size=2 / Give it a shot if you haven't.. Good luck! Geeta Brian Boyle wrote: Hey, I am using a map-backed ActionForm and so in my JSP code I have a html:text tag that looks like this: html:text property=value(%=value.getUserId()%) readonly=true size=2 / The reason I have a scriplet in there is because I have a dynamic form and the value of the key changes all the time. I want the value of the key to be the id of the user logged in. However, this is giving me problems because the value of the key is being taken literally as %=value.getUserId()% rather than the value of the userId. The scriplet %= value.getUserId % is correct because I have tested it with System.out.println(value.getUserId). So it looks like I cannot put my scriplet in there. Has anyone experienced this before? Or does anyone know why it won't et me do this? Any way to get around this? I'd appreciate any help. I've been stuck on it for two days now. Cheers, B _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail - 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] _ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: Extending Request Processor to append request parameter
Brad: Here's one very simple way of achieving your objective, but I am quite certain other people will have better ones, but since this is kind of a cute problem, I want to offer this as well..:) First write a simple util method (I always have a Util class in my apps where I gather stuff which seems to belong nowhere else..). Anyways, write a method with signature as follows: private static String makeUnique(String) which essentially takes a String (which will be a path) and will append a ?random=aRandomNumber (or random=aRandomNumber) to the end of the input string and returns it. In Util, also write a public method as follows: public static ActionForward makeUnique(ActionForward actionForward) { return new ActionForward(makeUnique(actionForward.getPath())); } In your Action classes, where you usually have something like: return mapping.findForward(success) you instead could have: return (Util.makeUnique(success)); I think this is an ok solution and will work.. But like I said, I think the gurus in this list will have better ideas (perhaps more in keeping with OO principles) ..:) Regards, Geeta Brad Balmer wrote: I've been looking into this for a while and can't figure out how to do this easily. I would like to append a unique number to each request in an attempt to defeat caching (setting all the normal META tags as well as the 'nocache' in the controller doesn't seem to ALWAYS work). Therefore I wanted to append a Parameter to each request and add a unique number so that the server would not look in the cache. (Having the user change their browser caching mechanism isn't an option). I see where I can SEE the different request parameters, but where can I append a new parameter? I would like to do this in a central location. Any ideas? Has anybody else come up with a good way of doing this? 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: Extending Request Processor to append request parameter
Oops, typo.. In your Action classes, where you usually have something like: return mapping.findForward(success) you instead could have: return (Util.makeUnique(success)); I meant: return (Util.makeUnique(mapping.findForward(success))); Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Extending Request Processor to append request parameter
Brad: I looked at the API and noticed the RequestProcessor is a 1.1 feature.. Your solution seems nice and clear! I only have one question for you though: How do you connect the subclass of RequestProcessor that you wrote with the struts ActionServlet..? Do you have to subclass the ACtionServlet too and then join the dots there? How do you do that? There is a processor method in ActionServlet which returns the processor..but I don't see a setProcessor method..? thanks for posting your solution: I learnt something new today..:) Geeta Brad Balmer wrote: Well, I searched through the archives with no luck on 'ParameterActionForward' or similar. I ended up trying to ovveride the ActionForward class but couldn't get it to work well. Then I noticed in the RequestProcessor there is a doForward() that can be ovveridden. I wrote the following and it seems to work. Is there a better way/place to do this than the RequestProcessor? This seems like a prettly locical/central place to do this. protected void doForward( String path, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doForward(addUniqueParameterToURL(path), request, response); } private String addUniqueParameterToURL(String url) { if(url == null) { return url; } String newURL = url + ((url.indexOf(?) == -1) ? ? : ) + uid + = + Long.toString(System.currentTimeMillis()); return newURL; } Curtis Taylor wrote: Hi Brad, Someone on this list (sorry; can't remember who) subclassed ActionForward to do exactly this. Search the archives for ParameterActionForward. If you can't find it, email me off-list I'll send you the Java file (I have it stashed away somewhere. Curtis -- c dot tee at verizon dot net Brad Balmer wrote: I've been looking into this for a while and can't figure out how to do this easily. I would like to append a unique number to each request in an attempt to defeat caching (setting all the normal META tags as well as the 'nocache' in the controller doesn't seem to ALWAYS work). Therefore I wanted to append a Parameter to each request and add a unique number so that the server would not look in the cache. (Having the user change their browser caching mechanism isn't an option). I see where I can SEE the different request parameters, but where can I append a new parameter? I would like to do this in a central location. Any ideas? Has anybody else come up with a good way of doing this? 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] - 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: 1 request 2 forms
I have never done this but i don't see why not. When you press your submit button on your jsp, an Action is called, right? You can do whatever you want in that execute method would be my guess. So if you feel like saving one form in session scope and another in in request attribute before you forward to your new page, i don't see why you shouldn't be able to.. Do you envision a problem? Geeta Daniel Henrique Alves Lima wrote: Hi. Can i use the struts mechanism to fill 2 *different* action forms from 1 http request ? I've a button in a .jsp page. When the user to press this button, i need to save a session scoped form before forward to a new page (the new page uses another form). Is is possible ? 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: 1 request 2 forms
Sorry, that wasn't how I understood your question.. and i'm not sure I *do* understand your question now either.. would you explain your problem and what you are trying to do once again..? Daniel Henrique Alves Lima wrote: Yes, i got a error. I've just added a org.apache.struts.actions.ForwardAction (to struts initializes and populates the session scoped form - named A) between the .jsp file (which contains the button) and a previous existent action (the one which receives a new request scoped form - named B). Now, the attributes of B form are empty (i'm getting null values)... Any idea ? Geeta Ramani wrote: I have never done this but i don't see why not. When you press your submit button on your jsp, an Action is called, right? You can do whatever you want in that execute method would be my guess. So if you feel like saving one form in session scope and another in in request attribute before you forward to your new page, i don't see why you shouldn't be able to.. Do you envision a problem? Geeta - 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: Extending Request Processor to append request parameter
*Sweet*!! Thank you, Craig and Niall (got your name right this time, huh?)... Struts gets to be any more fun, the department of homeland security is gonna declare it an act of terrorism.. Geeta Niall Pemberton wrote: Geeta You don't need to subclass ActionServlet - you can set the RequestProcessor class in the controller element in the struts-config.xml controller processorClass=mypackage.MyRequestProcessor/ Full details for the configuring the controller are in the user guide: http://jakarta.apache.org/struts/userGuide/configuration.html Niall - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Saturday, March 06, 2004 10:15 PM Subject: Re: Extending Request Processor to append request parameter Brad: I looked at the API and noticed the RequestProcessor is a 1.1 feature.. Your solution seems nice and clear! I only have one question for you though: How do you connect the subclass of RequestProcessor that you wrote with the struts ActionServlet..? Do you have to subclass the ACtionServlet too and then join the dots there? How do you do that? There is a processor method in ActionServlet which returns the processor..but I don't see a setProcessor method..? thanks for posting your solution: I learnt something new today..:) Geeta Brad Balmer wrote: Well, I searched through the archives with no luck on 'ParameterActionForward' or similar. I ended up trying to ovveride the ActionForward class but couldn't get it to work well. Then I noticed in the RequestProcessor there is a doForward() that can be ovveridden. I wrote the following and it seems to work. Is there a better way/place to do this than the RequestProcessor? This seems like a prettly locical/central place to do this. protected void doForward( String path, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doForward(addUniqueParameterToURL(path), request, response); } private String addUniqueParameterToURL(String url) { if(url == null) { return url; } String newURL = url + ((url.indexOf(?) == -1) ? ? : ) + uid + = + Long.toString(System.currentTimeMillis()); return newURL; } Curtis Taylor wrote: Hi Brad, Someone on this list (sorry; can't remember who) subclassed ActionForward to do exactly this. Search the archives for ParameterActionForward. If you can't find it, email me off-list I'll send you the Java file (I have it stashed away somewhere. Curtis -- c dot tee at verizon dot net Brad Balmer wrote: I've been looking into this for a while and can't figure out how to do this easily. I would like to append a unique number to each request in an attempt to defeat caching (setting all the normal META tags as well as the 'nocache' in the controller doesn't seem to ALWAYS work). Therefore I wanted to append a Parameter to each request and add a unique number so that the server would not look in the cache. (Having the user change their browser caching mechanism isn't an option). I see where I can SEE the different request parameters, but where can I append a new parameter? I would like to do this in a central location. Any ideas? Has anybody else come up with a good way of doing this? 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] - 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]
{OT} Was: Returning fully-stocked Actions/JSPs from other Actions
Michael McGrady wrote: We had a round of discussions on this in the near past. Right Mark? Mark has gone back to crack after that discussion. LOL Well, actually, Mark took Neill's advice and became a cgi programmer.. (So crack is now in his job description.) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reset all form bean elements in one shot
Anant: So a brand new form bean won't do the job..? Geeta [EMAIL PROTECTED] wrote: Hi, I wanted to know if there is any way in which we can reset all the elements of the form bean without giving individual resets all the time for e.g I have 4 elements in my form bean. say A,B,C,D I am interested in resetting all the four without giving resetAllElements() { A = null B = null C = null D = null } Note: My form bean has session scope(I need it) Regards Anant Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reset all form bean elements in one shot
session.removeAttribute(myForm); myForm = new MyFormBean(); Regards, Geeta [EMAIL PROTECTED] wrote: How to remove the form bean element from the session if that's the case -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Saturday, March 06, 2004 2:14 AM To: Struts Users Mailing List Subject: Re: Reset all form bean elements in one shot Anant: So a brand new form bean won't do the job..? Geeta [EMAIL PROTECTED] wrote: Hi, I wanted to know if there is any way in which we can reset all the elements of the form bean without giving individual resets all the time for e.g I have 4 elements in my form bean. say A,B,C,D I am interested in resetting all the four without giving resetAllElements() { A = null B = null C = null D = null } Note: My form bean has session scope(I need it) Regards Anant Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. - 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: Reset all form bean elements in one shot
Anant: [EMAIL PROTECTED] wrote: Thanks I never thought it would be as simple as this... :-) Why didn't I think of this before..:-( If each of us had a penny for every time we thought this, we'd be all set for early retirement in the bahamas..:) Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem with focus in form
Shobana: Maybe you can post the relavant code so someone could spot a problem..? Regards, Geeta Shobhana.S, ASDC Chennai wrote: hi1 i've got different filed names..i've set the focus for the text field only..but i get an additional focus for a button..y so? shobhana - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModificationException
Sergei: But you're getting there..:) Take the declaration of ArrayList *out* of: public class MyAction extends Action { protected ArrayList list = new ArrayList(); ---Take this out: BAD!! and move it inside the methods to make them local..: public ActionForward execute(...) ... { ArrayList list = new ArrayList(); --GOOD!! myMethod(list); ---GOOD!! and: protected void myMethod(ArrayList list) { --GOOD!! ArrayList list = new ArrayList();--Take this out: BAD!! Regards, Geeta Niall Pemberton wrote: This is no good either. Action classes are not thread safe. Why not read the user manual. Theres a section 4.4.1 Action Class Design Guidelines http://jakarta.apache.org/struts/userGuide/building_controller.html#action_classes - Original Message - From: Sergei P. Volin [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 9:32 AM Subject: Re: ConcurrentModificationException Greetings, That is the question! Today morning I've found the reason of my troubles. It was my negligence in how I assigned a value to the iterated list that I placed in the object which I then stored in a session for JSP's iterator. I declared the list in my action as a global variable, assigned a value to it in the protected void method which is called by the action execute method like this: public class MyAction extends Action { protected ArrayList list = new ArrayList(); ... public ActionForward execute(...) ... { list = new ArrayList(); myMethod(...); obj.setList(list) session.setAttribute(buinessObj, obj); ... return mapping.findForward(forward); } protected void myMethod(...) { ... while (rs.next()) { ... list.add(el); ... } } } Now this piece of code looks like: public class MyAction extends Action { protected ArrayList list = new ArrayList(); ... public ActionForward execute(...) ... { list = new ArrayList(); myMethod(...); obj.setList(list) session.setAttribute(buinessObj, obj); ... return mapping.findForward(forward); } protected void myMethod(...) { ArrayList list = new ArrayList();// new ... while (rs.next()) { ... list.add(el); ... } this.list =list;// new } } It looks that with this code I rid off all my troubles now - no ConcurrentModificationException, no doubling of list size. I made a dozen of tests - no exceptions and the results were correct. Mr. Craig R. McClanahan! Am I right now with my code? Please, reply. Thanks a lot, Sergei Volin. - Original Message - From: Craig R. McClanahan [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED]; Sergei P. Volin [EMAIL PROTECTED] Cc: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 1:08 AM Subject: Re: ConcurrentModificationException | | Quoting Sergei P. Volin [EMAIL PROTECTED]: | | | I know this and I do not add/remove elements to/from list at all. Just as I | said - only reading elements from list. | Are jsps (Tomcat) thread safe? I'm really worry about that. | | | Using instance variables to store request-specific state information, in a JSP | or servlet (or in a Struts Action class), is *not* thread safe, because there | is only one instance of the corresponding class, shared by simultaneous | requests. Using local variables, though, should be fine. | | Craig McClanahan | | | - | 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: DynaActionForm IllegalArgumentException
Anirudh: I'm assuming your have written getter/setter methods for this newproperty, right? Double-check the case: it should be getMNum() (and setMNum(String)).. If all else fails, clean out your work directory and try again.. Regards, Geeta Anirudh Jayanth wrote: [ERROR] RequestUtils - -Error creating form bean of class org.apache.struts.acti on.DynaActionForm java.lang.IllegalArgumentException: Invalid property name 'mNum'java.lang.IllegalArgumentException: Invalid property name 'mNum' Thanx Anirudh - 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: JSF RI Final is out!
Andrew Hill wrote: Well its great to know the word is spreading... ...soon JSF will conquer all! muahahahaha ...I need some sleep :-( But definitely..! Good night..:) Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DynaActionForm IllegalArgumentException
Oops! My mistake entirely: sorry..(:( Ok, try rebuilding the app entirely (clean all first), then clean out the work directory and try again. Seems like something wierd is happening.. Geeta Anirudh Jayanth wrote: Hey Geeta, I am using a DynaActionFrom This doesn't require getter and setter methods. What could possibly be the problem here? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ConcurrentModificationException
Yoohoo, Sergei, time to celebrate then, since you are on your way..:) But drop the r from my name, will ya..?! ;) (Sorry, it isn't Friday yet, is it..;).. Ok, maybe I need some sleep too..) Geeta Sergei P. Volin wrote: Thank you very much, Greeta! I'm just doing that :)) I'm moving out all instance stuff out of the class declaration into local methods and transfer them into methods through arguments. Thanks to all you guys for your kind advices, I'm on the road now. My old painfull problem is resolved! I started programming in Struts about 2 years ago but didn't pay my attention on design guidelines when coding Action classes. Too shame to me :(( - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 4:22 PM Subject: Re: ConcurrentModificationException | | Sergei: | | But you're getting there..:) Take the declaration of ArrayList *out* of: | | public class MyAction extends Action { | protected ArrayList list = new ArrayList(); ---Take this out: BAD!! | | and move it inside the methods to make them local..: | | public ActionForward execute(...) ... { | ArrayList list = new ArrayList(); --GOOD!! | myMethod(list); ---GOOD!! | | and: | | protected void myMethod(ArrayList list) { --GOOD!! | ArrayList list = new ArrayList();--Take this out: BAD!! | | Regards, | Geeta | | Niall Pemberton wrote: | | This is no good either. Action classes are not thread safe. | | Why not read the user manual. Theres a section 4.4.1 Action Class Design | Guidelines | | http://jakarta.apache.org/struts/userGuide/building_controller.html#action_classes | | - Original Message - | From: Sergei P. Volin [EMAIL PROTECTED] | To: Struts Users Mailing List [EMAIL PROTECTED] | Sent: Thursday, March 04, 2004 9:32 AM | Subject: Re: ConcurrentModificationException | | | Greetings, | | That is the question! Today morning I've found the reason of my troubles. | It | was my negligence in how I assigned a value to the iterated list that I | placed in the object which I then stored in a session for JSP's iterator. | I | declared the list in my action as a global variable, assigned a value to | it | in the protected void method which is called by the action execute method | like this: | | public class MyAction extends Action { | protected ArrayList list = new ArrayList(); | ... | public ActionForward execute(...) ... { | list = new ArrayList(); | myMethod(...); | obj.setList(list) | session.setAttribute(buinessObj, obj); | ... | return mapping.findForward(forward); | } | protected void myMethod(...) { | ... | while (rs.next()) { | ... | list.add(el); | ... | } | } | } | | Now this piece of code looks like: | | public class MyAction extends Action { | protected ArrayList list = new ArrayList(); | ... | public ActionForward execute(...) ... { | list = new ArrayList(); | myMethod(...); | obj.setList(list) | session.setAttribute(buinessObj, obj); | ... | return mapping.findForward(forward); | } | protected void myMethod(...) { | ArrayList list = new ArrayList();// new | ... | while (rs.next()) { | ... | list.add(el); | ... | } | this.list =list;// new | } | } | | It looks that with this code I rid off all my troubles now - no | ConcurrentModificationException, no doubling of list size. I made a dozen | of | tests - no exceptions and the results were correct. | | Mr. Craig R. McClanahan! Am I right now with my code? Please, reply. | Thanks a lot, | | Sergei Volin. | | | - Original Message - | From: Craig R. McClanahan [EMAIL PROTECTED] | To: Struts Users Mailing List [EMAIL PROTECTED]; Sergei | P. | Volin [EMAIL PROTECTED] | Cc: Struts Users Mailing List [EMAIL PROTECTED] | Sent: Thursday, March 04, 2004 1:08 AM | Subject: Re: ConcurrentModificationException | | | | | | Quoting Sergei P. Volin [EMAIL PROTECTED]: | | | | | | I know this and I do not add/remove elements to/from list at all. Just | as I | | said - only reading elements from list. | | Are jsps (Tomcat) thread safe? I'm really worry about that. | | | | | | Using instance variables to store request-specific state information, in | a | JSP | | or servlet (or in a Struts Action class), is *not* thread safe, because | there | | is only one instance of the corresponding class, shared by simultaneous
Re: DynaActionForm IllegalArgumentException
Ok, time for desperate tactics: try changing the name to something else.. say mywierdNum .. Anirudh Jayanth wrote: Nope.created a whole new app. Tried just about anything. Its giving the same exception and for the same property aswell. It sure seems weird.. Cant help wondering if I am doing something fundamentally wrong though Any suggestions? Anirudh Jayanth SysArris Software 120A, Elephant Rock Road, 3rd Block, Jayanagar, Bangalore - 560011 Tel: 6655165 / 052 [ ext - 244 ] [EMAIL PROTECTED] -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Thursday, March 04, 2004 8:12 PM To: Struts Users Mailing List Subject: Re: DynaActionForm IllegalArgumentException Oops! My mistake entirely: sorry..(:( Ok, try rebuilding the app entirely (clean all first), then clean out the work directory and try again. Seems like something wierd is happening.. Geeta Anirudh Jayanth wrote: Hey Geeta, I am using a DynaActionFrom This doesn't require getter and setter methods. What could possibly be the problem here? - 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: Passing a vector to a JSP from an Action
..as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort - 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: Passing a vector to a JSP from an Action
I think you want request.setAttribute(String, Vector) and (Vector)request.getAttribute(String) (not get/set*Parameter*..). Btw, don't want to start this off once more, but memory usage is not the only (or even main?) issue against using session variables.. It's more a question of what makes sense. But you can just look up that thread for all the gory details..;) Regards, Geeta bort wrote: A request parameter would probably be a better solution, you're right. I looked up the thread you were speaking of, and see that it went in the direction of memory usage by the JVM when loaded up with session variables. Fortunately, that isn't a concern for us as we've loaded up the web server with RAM. Back to my original question... I guess I can just pull the Vector from the request object and iterate through it then? ex. Vector myvector = (Vector)request.getParameter(vectorname); TIA bort Geeta Ramani [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ..as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort - 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: Passing a vector to a JSP from an Action
Cool: i just knew I could get you going...;) Mark Lowe wrote: On my way to see my crack dealer right this minute :o) In the request its where is belongs, like pretty much all read only data. Anyone would think that I was arguing in favor of always storing in session.. On 4 Mar 2004, at 17:06, Geeta Ramani wrote: .as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort - 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: Best way to handle big search results..
Jerry: Jacob's note (see below) already says this would be a problem, but he has also mentioned a way to solve your problem; check if that works for you. Store the records in a session variable (that's right, session, instead of request makes sense here!!) and display just 20 or so records at a time. You will have to see if this is feasible.. it will depend on how strong-big your server is, etc..:) Regards, Geeta Jerry Jalenak wrote: In my application I often return large amounts of data - for instance, a single user may have access to as many as 8500 accounts; each account may have several hundred detail records associated with it. I've solved my initial problem of being able to return thousands of records (for instance, I can return almost 48,000 detail records in a little under 5 seconds), but the problem I have now is that it takes FOREVER for the jsp to render. I mean, I've waited over an hour for this thing to complete. Does anyone have any tips on improving / optimizing the performance of a compiled JSP? I'm using Tomcat 5.0.18 Stable with J2SDK 1.4.1_02 Thanks! Jerry Jalenak Development Manager, Web Publishing LabOne, Inc. 10101 Renner Blvd. Lenexa, KS 66219 (913) 577-1496 [EMAIL PROTECTED] -Original Message- From: Hookom, Jacob [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 1:39 PM To: Struts Users Mailing List Subject: RE: Best way to handle big search results.. We have to work with search results that are sometimes 1000+ items in size. In addition, much of the information we have is not keyed so we cannot say give results between id 2000 and id 20020. Some things I found to help with search results where we did do in memory sorting/paging were: 1. Create view-specific lightweight objects to be pulled from the DB 2. Memory allowed, it's faster to pull them all at once than lazy load 4. The real cause of some of our performance problems were the JSP's/HTML in rendering a huge list to the client vs. only showing 20 at once. To handle this, I created a SearchResultListAdaptor that could sit in the session and handle paging (if anyone wants to argue session scope with me, bring it on--). The SearchResultListAdaptor then contained the behavior of sort order/paging, etc. Sorting was done via bean property using a BeanUtilsComparator. So my SearchResultListAdaptor could then work with an list of beans. Best Regards, Jacob -Original Message- From: Arne Brutschy [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 12:57 PM To: Struts Users Mailing List Subject: Best way to handle big search results.. Hi, I'm looking for the best way to handle big search results. Setting: the user can search for other users in the ldap directory. This might return a long list of results (~40.000 entrys). Sadly, OpenLDAP doesn't support server-side sorting, so I have to sort the results myself. I want to display 20 items per page, and the user can browse through these results. What is the best way to handle these result object? Sorting once and storing/caching it in the session or searching and sorting every time the user requests a new page of results? Any thoughts/experiences? Regards, Arne Brutschy - 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] This transmission (and any information attached to it) may be confidential and is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient or the person responsible for delivering the transmission to the intended recipient, be advised that you have received this transmission in error and that any use, dissemination, forwarding, printing, or copying of this information is strictly prohibited. If you have received this transmission in error, please immediately notify LabOne at the following email address: [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: Passing a vector to a JSP from an Action
Just like Mark said below: logic:iterate id=item name=myvector bean:write name=item property=myproperty / /logic:iterate item above is an item in your vector myvector with a getter for the property called myproperty.. Is there something in particular you are having a problem with..? Geeta bort wrote: I feel like an idiot asking this, but... within the logic:iterate /logic:iterate tags how am I supposed to pull out the objects I have stored in my Vector? bort Mark Lowe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Vector myvector = .. request.setAttrubute(myvector, myvector); ... c:forEach var=item items=${myvector} c:out value=${item.myproperty} / c:forEach or logic:iterate id=item name=myvector bean:write name=item property=myproperty / /logic:iterate The thread in question was more about nested beans and forms, i don't think anyone would suggest putting readonly stuff in the session. On 4 Mar 2004, at 17:14, bort wrote: A request parameter would probably be a better solution, you're right. I looked up the thread you were speaking of, and see that it went in the direction of memory usage by the JVM when loaded up with session variables. Fortunately, that isn't a concern for us as we've loaded up the web server with RAM. Back to my original question... I guess I can just pull the Vector from the request object and iterate through it then? ex. Vector myvector = (Vector)request.getParameter(vectorname); TIA bort Geeta Ramani [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ..as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort - 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: Passing a vector to a JSP from an Action
*Ouch*!! Niall Pemberton wrote: Geeta, it was a good try - but you have to get him to call you a cgi programmer to get the full points ;-) Niall - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 4:30 PM Subject: Re: Passing a vector to a JSP from an Action Cool: i just knew I could get you going...;) Mark Lowe wrote: On my way to see my crack dealer right this minute :o) In the request its where is belongs, like pretty much all read only data. Anyone would think that I was arguing in favor of always storing in session.. On 4 Mar 2004, at 17:06, Geeta Ramani wrote: .as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] was: Re: Passing a vector to a JSP from an Action
Mark, m'boy, repeat after me: breathe in,... breathe out.. breathe in... breathe out that's 3 sets of 12. Didn't work? Ok, I guess it's that crack dealer's lucky day.. Geeta P.S... just kidding: I actually do (and did) agree with you..!! :) Mark Lowe wrote: Yeah. But see the thread and what i was up against, like no large scale app has ever been released using httpsession somewhere. I think the chap with the 48,000 results scrolling issue and the next man with the html optimization suggestions have beaten me to my dealer :o) I'm gonna have take a couple of valium and go n lye down.. On 4 Mar 2004, at 18:21, Niall Pemberton wrote: Geeta, it was a good try - but you have to get him to call you a cgi programmer to get the full points ;-) Niall - Original Message - From: Geeta Ramani [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, March 04, 2004 4:30 PM Subject: Re: Passing a vector to a JSP from an Action Cool: i just knew I could get you going...;) Mark Lowe wrote: On my way to see my crack dealer right this minute :o) In the request its where is belongs, like pretty much all read only data. Anyone would think that I was arguing in favor of always storing in session.. On 4 Mar 2004, at 17:06, Geeta Ramani wrote: .as a request attribute..? Look through the archives for a fun and spirited discussion on request vs. session vars held just over a week or so ago.. Geeta P.S. Mark, don't flip out..;) bort wrote: Hi all I have an Action class that loads up a Vector with information from a database. What I would like to do is pass this Vector to the forwarding JSP and create a table listing of the data. I'm thinking of just adding the Vector to the session in the Action class and then retrieving and iterating through it in the JSP. Is there a better way to do this? bort --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: success mapping to other module...
Daniel: Seems like you have too many .dos in your success mapping..? You perhaps may want to do something like this: action attribute=GeralUsuarioCadIBean input=/geral/geralUsuarioCad.jsp name=GeralUsuarioCadIBean path=/cadaltUsuario type=com.topit.geral.action.UsuarioIncluirAction validate=false forward name=success path=/goToModule / --Change this /action and define your goToModule in struts-config.xml in the usual way: action path=/goToModule ..etc... /action If you want request params added on to the path you may either choose to instead use request attributes in your UsuarioIncluirAction OR in the UsuarioIncluirAction, retrieve the ActionForward object using (I'm going from memory here, so you have to check the correct method names): ActionForward af = mapping.findForward(success); //this will give you the goToModule bit). af.setPath(af.getPath() + ..add the request params here..); and then return (in your UsuarioIncluirAction) the newly created (modified) ActionMapping.. hope this is clear enough..? (This method actually does work..:)) Regards, Geeta Daniel wrote: How can I make the succes forward to go to other module like this: action attribute=GeralUsuarioCadIBean input=/geral/geralUsuarioCad.jsp name=GeralUsuarioCadIBean path=/cadaltUsuario type=com.topit.geral.action.UsuarioIncluirAction validate=false forward name=success path=goToModule.do?prefix=/modulo_1page=/abreusuarioinc.do / /action It's doesn't work, I don't know if it possible, I created one action forward and set the success forward for this action forward and doesn't work too, the error at the internet explorer is : The request resource (Servlet action is not available) is not available. abraços Daniel S. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Text area in struts
Hi there: I think if you simply wrote everything in a single line like so: textarea name=info rows=12 cols=50 tabindex=0bean:write name=book property=ISBN //textarea you should be ok! Regards, Geeta I have the followin code producing textarea but it is off set by one or two tabbs.wondering why and how i can fix it thanks! sam. textarea name=info rows=12 cols=50 tabindex=0 bean:write name=book property=ISBN / /textarea - Do you Yahoo!? Yahoo! Search - Find what you're looking for faster. - 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: Form name from JSP page
Hi Stu: This is not really an answer to your question, but just a thought: Why are you reluctant to hardcode the name of the form in? My feeling is jsps are kind of lightweight elements so making them more generalised is not really that important..? I look at jsps as easily modified/modifiable and kind of self-contained.. unless you envision putting your javascript in some common place accessible to lots of jsps, maybe..? My $0.02..:) Regards, Geeta [EMAIL PROTECTED] wrote: Hi, My JSP page has some javascript that need to references the html:form by name but how elegently get the form name and input field name to achieve the following without harcoding? Document.forms['my_form'].elements['my_element_1'] Thanks Stu - 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: Best way to handle big search results..
Jacob Ame: Hookom, Jacob wrote: 1. Create view-specific lightweight objects to be pulled from the DB 2. Memory allowed, it's faster to pull them all at once than lazy load 4. The real cause of some of our performance problems were the JSP's/HTML in Excatly what we found too.. and our results were only in the hundreds rather than in the thousands! Many rows of data coupled with tables were a real killer.. To handle this, I created a SearchResultListAdaptor that could sit in the session and handle paging (if anyone wants to argue session scope with me, bring it on--). In fact this is one place where a session variable comes in most handy..:) The SearchResultListAdaptor then contained the behavior of sort order/paging, etc. Sorting was done via bean property using a BeanUtilsComparator. Almost exactly what we did too..:) So my SearchResultListAdaptor could then work with an list of beans. Best Regards, Jacob Regards, Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (Fwd) row counts in logic:iterate...
Rinke: Your ctr seems to be an *Integer* object and you are using it as an int. So simply say: ctr.intValue() + 1 and you should be ok. Geeta [EMAIL PROTECTED] wrote: Then why do i get this error? operator + cannot be applied to java.lang.Integer, int [javac] out.print( ctr + 1 ); Rinke - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts Workflow
Mike, search this list's archives. This was discussed a few days ago.. Regards, Geeta Mike Duffy wrote: Does anyone have any great ideas on creating customizable workflows in Struts? __ Do you Yahoo!? Get better spam protection with Yahoo! Mail. http://antispam.yahoo.com/tools - 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: jsp:include page=some action Really need help
Also, have you looked at the source of the jsp (which is not rendered)? Sometimes there are helpful error messages there which for whatever reason don't show up on the browser. Niall Pemberton wrote: Haven't done what you're trying - but isn't the problem that at the end of the action execute() the RequestProcessor will forward to whereever you tell it, which is probably why everything stops after that. What happens if you return 'null' from your execute() method instead of an ActionForward - or are you already doing that? Niall - Original Message - From: Tommy Holm - TELMORE [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 25, 2004 1:07 PM Subject: jsp:include page=some action Really need help Hi everyone. I have already asked this once but didn't get any answer, I have tried everything that I could think of but no luck, so if any of you have an idea what to do, I would really be happy for any help. I have a problem, I have a jsp page which should include the result of an action call. The action should prepare the bean associated with the action and render which then in the end should be included in the master jsp.(The include is a menu, which the action should prepare). The problem is that after the include, the rest of the JSP page is not rendered. It does somehow make sense but is there anyway around this or a common strategy to achieve this. Any help is greatly appreciated. Cheers Kind regards Tommy Cheers /Tommy - 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: Implementing A Search Dialog - Struts
Sean: sean jones wrote: Wendy Smoak Wendy.Smoak at asu.edu writes: SessionListner - hmmm, I really could use that technology, can you explain how and or provid a simple example. Short answer: Your class should implement HttpSessionBindingListener and override this method: public void valueUnbound(HttpSessionBindingEvent event) Long answer: Below's the code for ChartDeleter.java which i got from the open source package JFreeChart. Hth, Geeta /* === * JFreeChart : a free chart library for the Java(tm) platform * === * * (C) Copyright 2000-2004, by Object Refinery Limited and Contributors. * * Project Info: http://www.jfree.org/jfreechart/index.html * * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation; * either version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along with this * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * [Java is a trademark or registered trademark of Sun Microsystems, Inc. * in the United States and other countries.] * * - * ChartDeleter.java * - * (C) Copyright 2002-2004, by Richard Atkinson and Contributors. * * Original Author: Richard Atkinson ([EMAIL PROTECTED]); * Contributor(s): -; * * $Id: ChartDeleter.java,v 1.4 2004/01/05 17:11:52 mungady Exp $ * * Changes * --- * 19-Aug-2002 : Version 1; * 17-Oct-2002 : Fixed errors reported by Checkstyle (DG); * */ package org.jfree.chart.servlet; import java.io.File; import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpSessionBindingEvent; import javax.servlet.http.HttpSessionBindingListener; /** * Used for deleting charts from the temporary directory when the users session * expires. * * @author Richard Atkinson */ public class ChartDeleter implements HttpSessionBindingListener { /** The chart names. */ private List chartNames = new java.util.ArrayList(); /** * Blank constructor. */ public ChartDeleter() { } /** * Add a chart to be deleted when the session expires * * @param filename the name of the chart in the temporary directory to be deleted. */ public void addChart(String filename) { chartNames.add(filename); } /** * Checks to see if a chart is in the list of charts to be deleted * * @param filename the name of the chart in the temporary directory. * * @return a boolean value indicating whether the chart is present in the list. */ public boolean isChartAvailable(String filename) { return (this.chartNames.contains(filename)); } /** * Binding this object to the session has no additional effects. * * @param event the session bind event. */ public void valueBound(HttpSessionBindingEvent event) { return; } /** * When this object is unbound from the session (including upon session * expiry) the files that have been added to the ArrayList are iterated * and deleted. * * @param event the session unbind event. */ public void valueUnbound(HttpSessionBindingEvent event) { Iterator iter = this.chartNames.listIterator(); while (iter.hasNext()) { String filename = (String) iter.next(); File file = new File(System.getProperty(java.io.tmpdir), filename); if (file.exists()) { file.delete(); } } return; } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionForward and onLoad()
Hi Leticia: You're right, I don't understand your question completely (must be because I'm no guru..;)).. But may be you can use this thought anyways: you can use a session variable when you paint your jsp. What i mean is you can test for the existence of this session variable and if it does not exist, add the onLoad stuff in, if it does exist, don't. So if when you submit the form (the first time), you simply set that session variable, you should be home.. (this will work assuming i understood enough o your problem in the first place!!) Good luck! Geeta Leticia Golubov wrote: Hello Gurus, I'm in a bit of a predicament, and my lack of expertise in Javascript and Struts isn't helping... :( I have a jsp page which I need to retrieve some values at onLoad time, i.e.: body onload=javascript:getValues(); all getValues() does is submit the form on this page which sets a bunch of bean values for me to retrieve further down this page... The problem is, on the Action for this form, I need to redisplay the same page... As you can imagine I find myself in a never ending onload loop using this setup of mine... Assuming anyone can understand my description of this situation, my question is: how can I get a page to execute the onload first time but not to do it second time around? Basically, I would like the onload for that window to be called from the parent window, but I've no idea how to do it... I've tried doing below from the parent window: window.open(editUrl, scope, width=380px,height=300px).onload(document.forms[0].submit()); but that didn't work, i'd imagine that submitted the current window, not the one about to be opened. thanks in advance Leticia - 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: Encode/Encrypt url parameters?
David: It's been a real long day and my brain's fuzzing over.. but I'm assuming you know all about java.net.URLDecoder and java.net.URLEncoder..? geeta David Erickson wrote: Hi I was wondering if there are any easy to use Java classes or otherwise that could be used to encrypt or encode url parameters? Basically what I want to do is this: Action (encodes the url parameters, puts them into the request object) - forwards to jsp containing a link that grabs those parameters from the request - click link takes you to an Action that decodes and uses them. The parameters are to files on our site.. its no big deal because they are in the web-inf directory and unaccessable from the web but I'd rather hide them from the surfers anyway. Is there any good way to do this? Thanks, David - 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: html:logic tag doesn't recognize Struts dataBean property'svalue
Jumping in here.. yes, I think you need to trim() before you check. Also, if that too doesn't work, can you check for something positive (like if ShopOrderExist is equals to false rather than ShopOrderExist is not equals to not exists..?). Another thought, try to get this to work just using oridinary jsp tags and java code (% java code here %) and see oif things work. Than you can narrow the problem down to tag issues.. Good luck! Geeta Au-Yeung, Stella H wrote: Niall: I did what you suggested and print out the value of the property shopOrderExist. It is equal to notExist as expected. But somehow the Update link is still displayed instead of the Create link. Do you think I have to do something to the value of shopOrderExist such as .trim() or convert to true before letting it be compared in the logic:equal tag? logic:iterate id=sequenceList collection=%=ShopWorkOrderSearchFormBean.getPage()% type=com.cat.fdd.dataBean.shopWorkOrder.ShopWorkOrderSearchBean tr td class=listCellbean:write name=sequenceList property=sequence/ /td td class=listCellbean:write name=sequenceList property=shopOrderExist//td ADDED td class=listCellnobr !-- If the ShopOrderExist attribue is not equal to notExist, display Create link ,otherwise Update link-- logic:equal name=sequenceList property=shopOrderExist value=notExist a href=app/fdd/shopWorkOrder/CreateShopWorkOrderRequest.exec img src=images/icoAdd.gif border=0/a /logic:equal logic:notEqual name=sequenceList property=shopOrderExist value=notExist a href=app/fdd/shopWorkOrder/UpdateShopWorkOrderRequest.exec img src=images/icoEdit.gif border=0/a /logic:notEqual /td /tr /logic:iterate -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Monday, February 23, 2004 11:16 AM To: Struts Users Mailing List Subject: Re: html:logic tag doesn't recognize Struts dataBean property's value I doubt the problem is logic:equal. Your jsp looks OK - why not try outputting the shopOrderExist property in your table (along with yhe other stuff) - something along the lines of: td class=listCellbean:write name=sequenceList property=shopOrderExist//td That way, you can see the value the logic:equal/notEqual is testing against. Niall - Original Message - From: Au-Yeung, Stella H [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 23, 2004 3:34 PM Subject: html:logic tag doesn't recognize Struts dataBean property's value Hi: In my struts-based application I am using a html:logic tag in my JSP page to print two links depends on the value of a struts-based databean's property. Bacially on this JSP page, a list of records wil be displayed. Next to each record, either a Create link or an Update link should be displayed depends upon the property 'shopOrderExist. If this property has the value notExist, it should display the Create link. If it is not equal to notExist, it should display the Update link. For some reason, the Update link is always displayed even though shopOrderExist has a value of notExist. So the logic:equal tag is not comparing things correctly. Am I doing it wrong? (note, the property shopOrderExist is of type String and in Debug I see that its value is notExist) Here's my code: logic:iterate id=sequenceList collection=%=ShopWorkOrderSearchFormBean.getPage()% type=com.cat.fdd.dataBean.shopWorkOrder.ShopWorkOrderSearchBean tr td class=listCellbean:write name=sequenceList property=sequence/ /td !-- If the ShopOrderExist attribue is not equal to notExist, display Create link ,otherwise Update link-- logic:equal name=sequenceList property=shopOrderExist value=notExist a href=app/fdd/shopWorkOrder/CreateShopWorkOrderRequest.exec img src=images/icoAdd.gif border=0/a /logic:equal logic:notEqual name=sequenceList property=shopOrderExist value=notExist a href=app/fdd/shopWorkOrder/UpdateShopWorkOrderRequest.exec img src=images/icoEdit.gif border=0/a /logic:notEqual /td /tr Thanks in advance! Stella - 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: Must have action=..... in html:form tag?
Stella: Any time you incorporate Javascript into your app, you have to wonder if things will work now/ever/always in this/that/other browser. So avoiding everything except the most basic javascript may be a good idea. What you want to do can be done more cleanly (just in my opinion though) in the following way: Write an interface say MyRequestHandler with just one method: public String handleRequest(MyForm); write classes like UpdateShopWorkOrderRequestHandler and CreateShopWorkOrderRequestHandler which implement MyRequestHandler: all the work gets done here: You have access to the form bean (via the argument) and in the end you will return a string (which will be used to create your ActionForward). Write a suingleton class MyRequestHandlerFactory: all it does is have a hashmap mapping actionCommand strings to appropraite instances of the RequestHandler: For example: you may have an entry in the hashmap as: myHandlerMap.put(updateShopWorkOrder, new UpdateShopWorkOrderRequestHandler()); myHandlerMap.put(createShopWorkOrder, new CreateShopWorkOrderRequestHandler()); Write a constructor which will construct your hashmap, and write a getInstance method in the usual way: public static MyrequestHandlerFactory getInstance() as well as a public MyRequestHandler getRequestHandler (String actionCommand) which just consults the hashamp and returns the appropriate handler. Finally, write a superAction so: public class MySuperAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String actionCommand = request.getParameter(actionCommand); MyRequestHandler requestHandler = MyRequestHandlerFactory.getInstance().getRequestHandler(actionCommand); String forwardString = requestHandler.handleRequest((MyForm) form); if (mapping.findForward(forwardString) == null) log.debug(path is null!); //this si probably an error condition! else log.debug(Path is : + mapping.findForward(forwardString).getPath()); //bingo! return mapping.findForward(forwardString); } I think this method works quite well and has the advantage of simplicity too.. Hope this helps.. Good luck and let me know if you'd like any more elaboration..:) Geeta Au-Yeung, Stella H wrote: Paul and Hubert: If I do the following, just choose one of the paths to be the html:form action=..., you mean the form action can still be dynamically overwritten by what is actually picked in the submitForm() action? I thought I tried that and didn't work. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: redirect problem
Hi Koen: Try adding the foll. lines at the top of your (resultant) jsp: % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setIntHeader(Expires, 0); % This *may* do the trick.. (I *hate* browser cache problems..(:(..) Regards, Geeta koen boutsen wrote: Hi I use a menu in my application. When a user clicks on a menu item, the browser returns to a cached file, and does not do the action that is behind the menu item. I thought I could solve this by making the forwards in the strutsconfig 'redirect = true'. This way, cliking a menu item does go to the action, but in the browser, it always goes back to the page with the previous content. When I refresh the page, the correct content appears (without any action on the server.) I use Websphere as application server and netscape en IE as browser. Can anyone explain me what really happens and how I can resolve this. Any help is very appreciated Koen Boutsen Find what you are looking for with the Lycos Yellow Pages http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10 - 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: redirect problem
Hi Koen: Just realised, my earlie solution may result in the annoying alert (in IE) about whether or not you want to refresh the page. So how about fooling the browser into thinking this is a new page? Attach a random number to the end of the url of your forwarded jsp (like myPage.jsp?id=somelargerandomnumber). You will have to make this change to the forward in your action, btw.. I remember reading this technique somewhere and thinking it a clever solution - except I didn't try it out ..! Good luck - hope something works for you: life is too short to spend it solving browser-caching issues..:) Geeta Geeta Ramani wrote: Hi Koen: Try adding the foll. lines at the top of your (resultant) jsp: % response.setHeader(Cache-Control, no-cache); response.setHeader(Pragma, no-cache); response.setIntHeader(Expires, 0); % This *may* do the trick.. (I *hate* browser cache problems..(:(..) Regards, Geeta koen boutsen wrote: Hi I use a menu in my application. When a user clicks on a menu item, the browser returns to a cached file, and does not do the action that is behind the menu item. I thought I could solve this by making the forwards in the strutsconfig 'redirect = true'. This way, cliking a menu item does go to the action, but in the browser, it always goes back to the page with the previous content. When I refresh the page, the correct content appears (without any action on the server.) I use Websphere as application server and netscape en IE as browser. Can anyone explain me what really happens and how I can resolve this. Any help is very appreciated Koen Boutsen Find what you are looking for with the Lycos Yellow Pages http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10 - 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 make readonly in Select Box
Hi Ramachandran: So maybe you could force the issue by using Javascript: write an onChange method to ensure the selection is always what you want it to be..? (I assume by a read-only drop-down you mean you want what you have selected to not be deselected by the user..?) Geeta Slattery, Tim - BLS wrote: I want to make readyonly in Select Box. If i gave readonly=true. There is no property called readonly..What i have to do for that one HTML Select groups don't have a readonly property, that's why the Struts tag doesn't have it. -- Tim Slattery [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: Form Submission
Hi Avinash: I have not followed your description very carefully - my eyes started glazing over about mid-way..;) - but here's a thought (and I'm only going by what i remember of your original question, so forgive me if I misspeak..): If you do not have access to the request object, do you at least have access to the session? In which case how about putting the user in a session variable (maybe right after logon) and then you should be able to get his/her userId etc etc wherever you want it from..? I know there has been **extensive** discussion in this list re. the pros and cons of using session variables and if you are of the all-session-vars-are-bad school of thought, this won't do you any good. But personally, this seems to be a situation where a session variable would come in handy.. If however this idea wn't work in your situation, you may want to discuss with your clients their absolute requirement about wanting a link vs. a button (I believe you indicated earlier that the latter case will pose no prblems for you..?) Good luck! Geeta [EMAIL PROTECTED] wrote: Hi Geeta/Paul/Mark/Wendy What Geeta has suggested is basically the same thing but Paul is using JSTL for that. But such is the restriction of my application that I can not use request object to get the values from form directly by calling request.getParameter(...); I will explain this why. The framework that we are working with right now gives some add on features over struts. Basically taken from StrutsEJB framework. We are using Map Based DTOs to transfer data from view layer to model layer and other way round. We are also using the feature of Command Files. I will explain it what it is for people unaware of StrutsEJB framework. In Struts we are supposed to mention the Action Class in the struts-config.xml. And from the Action class we generally call some java programs (say command files) to access the model layer basically to avoid keeping business logic in Action Classes. But in my framework we just need to mention the Command file name in struts-config.xml instead of Action classes. There is only one action class that is DefaultAction class which handles all the requests and diverts the program control to the command file. I will give here one typical entry in my struts-config.xml for your reference. action path=/CreateUser type=framework.common.web.DefaultAction name=UserForm scope=request input = /CreateUser.jsp parameter=app.cmd.CreateUserCmd forward name=Success path = /UserSucc.jsp / /action in the above action tag the attribute parameter is the name of the command file where i would like my control to go after the form gets submitted. Now the problem is in the Command File CreateUserCmd where i would keep my business logic -- i dont have the request object. so i cant do a request.getParameter(.); here. the way i get values from forms is like this. if I have this code in JSP html:text property=dto(txtUsname) styleClass=listItem size=14 / I will have to write the following code in my command file to get the value of User Name String UserName = (String)paramDTO.get(txtUsName); As Mark/Wendy were asking me why i cant use JavaScript is because whenever i use something like this in JavaScript I get javascript error at runtime document.UserForm.dto(txtUsName).value = val; document.UserForm.submit(); This is obvious because whenever javascript parses something like dto(txtUsName) it takes it as a function call. I hope I could explain the problem properly. Regards Avinash Tiwari Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Geeta Ramani Struts Users Mailing List [EMAIL PROTECTED] To [EMAIL PROTECTED] 02/17/2004 09:57 PM cc Please respond to Subject Re: Form Submission Struts Users Mailing List [EMAIL PROTECTED] Avinash: How about trying something like this: %String myLink = /EmplyeeDetailAction.do?employeeId= + employeeId; % html:link page=%=myLinkEmployee Detail Page/html:link Regards, Geeta [EMAIL PROTECTED] wrote: I want to use a hyperlink instead - for example On a typical employee list page clicking the employee id of an employee takes you to the employee detail page. In this scenario employee id can not be displayed over a button - it has to be a hyperlink.. Use of javascript is restricted. So i cant call a javascript function to set the action atribute and then call the submit function. Avinash Tiwari Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Mark Lowe [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] 02/17/2004 08:57 PM cc Please respond to Struts Users
Re: Moving App to Struts - Best Practices
Michael: Michael Steiger wrote: Max Cooper wrote: Max, thanks for your help. If I just want to display values I do not need a html:form and html:text tags. What should I use instead? You can either use the html:form anyways (and just not show any submit button) or you can use: bean:write name=yourFormName property=abbreviation / Am I missing your point..? Regards, Geeta
Re: Form Submission
Mark: Not sure what you meant by your remark about javascript, but I believe javascript was ruled out earky on (not an option or something). The reason I thought saving the user as a session was ok is that I do not believe they are evil (:) either, and further, I can just see this sort of problem recurring throughout his application. Since the user is something that will not change, i felt it's ok to save this as a session variable. (and this I sometimes use as a way to judge whether or not I should save something as a session variable, thus removing the headaches of remembering to reset/remove them).. That said, I have to reiterate that I did not read/understand Avinash's note carefully enough, as you seem to have, so your note may well make more sense than mine..:) Hope this will sustain you without the crack..;) Geeta Mark Lowe wrote: I said no such thing about javascript. I'm in the httpsession != evil school and I'd say this isn't an occasion where you'd use it as you don't need anything to persist beyond the request (accept this default action thing whatever thats about). The single action class as a type of command dispatcher sounds ingenious. But it has to be using a form property or request parameter otherwise the id in the link wouldn't do what you want. I can see how this has helped make life less complex :o) I assume it extracts a map iterates through is and then selects the relevant 'command' based on the map's contents. You cant submit a form with a link without using javascript. You can use an image as a button, but thats another subject. I have no more suggestions than those I've already made, else I'll start getting urges to go out and score come crack in an attempt to save my teeth from all the brick-chewing. On 18 Feb 2004, at 14:15, Geeta Ramani wrote: Hi Avinash: I have not followed your description very carefully - my eyes started glazing over about mid-way..;) - but here's a thought (and I'm only going by what i remember of your original question, so forgive me if I misspeak..): If you do not have access to the request object, do you at least have access to the session? In which case how about putting the user in a session variable (maybe right after logon) and then you should be able to get his/her userId etc etc wherever you want it from..? I know there has been **extensive** discussion in this list re. the pros and cons of using session variables and if you are of the all-session-vars-are-bad school of thought, this won't do you any good. But personally, this seems to be a situation where a session variable would come in handy.. If however this idea wn't work in your situation, you may want to discuss with your clients their absolute requirement about wanting a link vs. a button (I believe you indicated earlier that the latter case will pose no prblems for you..?) Good luck! Geeta [EMAIL PROTECTED] wrote: Hi Geeta/Paul/Mark/Wendy What Geeta has suggested is basically the same thing but Paul is using JSTL for that. But such is the restriction of my application that I can not use request object to get the values from form directly by calling request.getParameter(...); I will explain this why. The framework that we are working with right now gives some add on features over struts. Basically taken from StrutsEJB framework. We are using Map Based DTOs to transfer data from view layer to model layer and other way round. We are also using the feature of Command Files. I will explain it what it is for people unaware of StrutsEJB framework. In Struts we are supposed to mention the Action Class in the struts-config.xml. And from the Action class we generally call some java programs (say command files) to access the model layer basically to avoid keeping business logic in Action Classes. But in my framework we just need to mention the Command file name in struts-config.xml instead of Action classes. There is only one action class that is DefaultAction class which handles all the requests and diverts the program control to the command file. I will give here one typical entry in my struts-config.xml for your reference. action path=/CreateUser type=framework.common.web.DefaultAction name=UserForm scope=request input = /CreateUser.jsp parameter=app.cmd.CreateUserCmd forward name=Success path = /UserSucc.jsp / /action in the above action tag the attribute parameter is the name of the command file where i would like my control to go after the form gets submitted. Now the problem is in the Command File CreateUserCmd where i would keep my business logic -- i dont have the request object. so i cant do a request.getParameter(.); here. the way i get values from forms is like this. if I have this code in JSP html:text property=dto(txtUsname) styleClass=listItem size=14 / I
Re: How to look up a global forward to get its path attribute
I know the following works if you have access to a mapping object (as within perform/execute): mapping.findForward(login).getPath(); So maybe you can simply create a new instance of an actionMapping and so forth..? Regards, Geeta OFlaherty, Colm wrote: I have the following entry in my struts-config.xml file: global-forwards forward name=login path=/public_login.do/ ... /global-forwards In a Tag Library, I have a String login, and I want to get the string /public_login.do (ie, I want to look up the global forward to see the path it refers to). What is the best way to do this?? Thanks.. ** This message is sent in confidence for the addressee only. The contents are not allowed to be disclosed to anyone other than the addressee. Unauthorised recipients must preserve this confidentiality and should please advise the sender immediately of any error in transmission. ** - 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: html link tag
Hi! Replace html:link page=/do/myactionAdd An Employee/html:link by html:link page=/myaction.doAdd An Employee/html:link and it should work.. Regards, Geeta struts fox wrote: I just did an example strust project in JBuilder, and it works. I have a jsp with a form that issues an action that forwards to itself and it works. Now I wanted to just do a html link to call the action from a new generic jsp page and it doesn't work. html:link page=/do/myactionAdd An Employee/html:link but it says error resource not available. From what I read a form or link can call an action, and this action, called myaction, being a servlet should just be able to be called. So what do I have wrong with my syntax? Below is the struts config and the form that does work. action-mappings action name=empForm path=/myaction scope=session type=strutstest1.Myaction forward name=forward path=/myjsp.jsp redirect=true / /action /action-mappings Below is the form code that does work: html:form action=/myaction.do method=POST html:text property=name/ html:submit property=submit value=Submit/br /html:form - Do you Yahoo!? Yahoo! Mail SpamGuard - Read only the mail you want.
Re: Form Submission
+1 ..:) Geeta Michael McGrady wrote: Heh, guys, there is no morality play here. LOL The question is just whether or not the use of the session as a repository makes sense, given the host of problems that arise in that respect, and given that there are way cool solutions that need to be built without those problems. Saving a USER in a session makes all the sense in the world. Users necessarily are SESSION related. That is NOT like saving a FORM, which is merely PAGE related. The user is just the sort of thing you should save in session. Is anyone saying you should not save a user in session? Since the user, unlike a page, or unlike whatever equivalent your use to a page, is necessarily involved in session scope, that typically would not only be proper, but best. Michael At 07:52 AM 2/18/2004, you wrote: Mark: Not sure what you meant by your remark about javascript, but I believe javascript was ruled out earky on (not an option or something). The reason I thought saving the user as a session was ok is that I do not believe they are evil (:) either, and further, I can just see this sort of problem recurring throughout his application. Since the user is something that will not change, i felt it's ok to save this as a session variable. (and this I sometimes use as a way to judge whether or not I should save something as a session variable, thus removing the headaches of remembering to reset/remove them).. That said, I have to reiterate that I did not read/understand Avinash's note carefully enough, as you seem to have, so your note may well make more sense than mine..:) Hope this will sustain you without the crack..;) Geeta Mark Lowe wrote: I said no such thing about javascript. I'm in the httpsession != evil school and I'd say this isn't an occasion where you'd use it as you don't need anything to persist beyond the request (accept this default action thing whatever thats about). The single action class as a type of command dispatcher sounds ingenious. But it has to be using a form property or request parameter otherwise the id in the link wouldn't do what you want. I can see how this has helped make life less complex :o) I assume it extracts a map iterates through is and then selects the relevant 'command' based on the map's contents. You cant submit a form with a link without using javascript. You can use an image as a button, but thats another subject. I have no more suggestions than those I've already made, else I'll start getting urges to go out and score come crack in an attempt to save my teeth from all the brick-chewing. On 18 Feb 2004, at 14:15, Geeta Ramani wrote: Hi Avinash: I have not followed your description very carefully - my eyes started glazing over about mid-way..;) - but here's a thought (and I'm only going by what i remember of your original question, so forgive me if I misspeak..): If you do not have access to the request object, do you at least have access to the session? In which case how about putting the user in a session variable (maybe right after logon) and then you should be able to get his/her userId etc etc wherever you want it from..? I know there has been **extensive** discussion in this list re. the pros and cons of using session variables and if you are of the all-session-vars-are-bad school of thought, this won't do you any good. But personally, this seems to be a situation where a session variable would come in handy.. If however this idea wn't work in your situation, you may want to discuss with your clients their absolute requirement about wanting a link vs. a button (I believe you indicated earlier that the latter case will pose no prblems for you..?) Good luck! Geeta [EMAIL PROTECTED] wrote: Hi Geeta/Paul/Mark/Wendy What Geeta has suggested is basically the same thing but Paul is using JSTL for that. But such is the restriction of my application that I can not use request object to get the values from form directly by calling request.getParameter(...); I will explain this why. The framework that we are working with right now gives some add on features over struts. Basically taken from StrutsEJB framework. We are using Map Based DTOs to transfer data from view layer to model layer and other way round. We are also using the feature of Command Files. I will explain it what it is for people unaware of StrutsEJB framework. In Struts we are supposed to mention the Action Class in the struts-config.xml. And from the Action class we generally call some java programs (say command files) to access the model layer basically to avoid keeping business logic in Action Classes. But in my framework we just need to mention the Command file name
Re: Form Submission
Avinash: How about trying something like this: %String myLink = /EmplyeeDetailAction.do?employeeId= + employeeId; % html:link page=%=myLinkEmployee Detail Page/html:link Regards, Geeta [EMAIL PROTECTED] wrote: I want to use a hyperlink instead - for example On a typical employee list page clicking the employee id of an employee takes you to the employee detail page. In this scenario employee id can not be displayed over a button - it has to be a hyperlink.. Use of javascript is restricted. So i cant call a javascript function to set the action atribute and then call the submit function. Avinash Tiwari Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Mark Lowe [EMAIL PROTECTED] To Struts Users Mailing List [EMAIL PROTECTED] 02/17/2004 08:57 PM cc Please respond to Struts Users Mailing List Subject Re: Form Submission [EMAIL PROTECTED] May I ask why you don't want a submit button? On 17 Feb 2004, at 15:55, [EMAIL PROTECTED] wrote: Hi How can we submit a form without using html:submit tag. I dont want to use JavaScript for this? Thanks Regards Avinash Tiwari Tata Consultancy Services Mailto: [EMAIL PROTECTED] Website: http:// www.tcs.comInterScan_Disclaimer.txt-- --- 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] ForwardSourceID:NT4E3A - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:select
Well, I guess that's what Wendy was suggesting in the first place: make the value and the text the same, that way sending one is tatamount to sending both.. The other option is to use a hidden field and javascript (onSelect fill hidden field kind of thing along with the form.blah-blah[selectedIndex].value that another person suggested earlier..) Geeta Gonzalez, Sergio Eduardo wrote: I need to send the value and text dispayed to the server - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j integration
Hi Shankar: Two other people asked this same question so if you don't mind, I'll post my (simple) solution to the list. Btw, for those who don't remember, this is a way to enable changes in log4j.properties to be seen by the application without a server reboot. Here goes: 1. Create a simple action class say ReloadLog4jAction with just a couple of statements in the perform/execute method: Create a new LogManager, then call its resetConfiguration() method. (Write the class within the application context where you want your log4j.properties file reconfigured) 2. Create the appropriate action mapping in your struts-config.xml, so that (say) /admin/reloadLog4j.do would map to this class and maybe redirect to an OK page. (am following the way /admin/reload.do works). 3. Reload struts-config either by server restart (or simply by calling /admin/reload.do if you have that mapping in your struts-config.xml.) Of course you will need to do this just once.. 4. Make any changes to your log4j.properties file and then point your browser now to the url /admin/reloadLog4j.do. The log4j.properties file will then be reloaded and after your OK page displays, the new log4j.properties file will then be read in. Really simple and works so nicely..:) Regards, Geeta shankarr wrote: Hi Geeta, If you could let me know how to achieve the integration will be great. Where have you written the class which observes the file? What I mean is, where in the struts framework are u using it at the RequestProcessor level or what. As I understand, in order for making the struts application in itself monitor the file, I need to write some init file only . Which class to extend and where do I put the entries. Sample code for the class file and the web.xml entries will be greatly appreciated. Shankar To achieve all that is possible, one must attempt the impossible
Re: Tomcat 3.3.1 and Struts 1.1
Daniel: A fwe months ago I wanted to move to Struts 1.1 and found that unless you upgraded tomcat to 4 or above, at least one fundamental thing would not work. I forget the details of my exact problem, but my situation was the same as yours: I wanted to make struts 1.1 work on Tomcat 3.3.1. I remember searching for a solution and I found that heavyweights like Ted and Craig had thrown their hands in the air and stated that the solution was to upgrade tomcat. Sorry i don't remember the deatils, else I could point you to Ted's note about this.. But i do remember clearly that struts 1.1 and tomcat 3.* don't work well together.. Hope this helps, Geeta Daniel Richter wrote: Hi, I have a Problwm with using Struts 1.1 within Tomcat 3.3.1 On my local computer I use Tomcat 4.1.28 and my application works well, but on my providers server I get the following stacktrace: Während der Abarbeitung Ihrer Anfrage ist ein Fehler aufgetreten. javax.servlet.ServletException: Error - tag.getAsString : component context is not defined. Check tag syntax at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp l.java:460) at base_1._jspService(base_1.java:614) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574) at org.apache.tomcat.core.Handler.invoke(Handler.java:322) at org.apache.tomcat.core.Handler.service(Handler.java:235) at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:91 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833) at org.apache.tomcat.modules.server.Ajp12Interceptor.processConnection(Ajp12Int erceptor.java:221) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:516) at java.lang.Thread.run(Thread.java:484) It seems that this older version of struts cannot handle the tiles definitions from Struts 1.1 Is it because of the Tomcat version? Is there anything I can do against it? My provider don't want to update Tomcat yet, so is there anything else I can do? Daniel - 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: no process to read data written to a pipe ??
Khalid: Have you looked at the servlet generated by your billingInfo.jsp? Looking at your stack trace, the problem seems to occur in that servlet in line 763: at _billingInfo_jsp_30._jspService(_billingInfo_jsp_30.java:763) Regards, Geeta Khalid K. wrote: If anyone has seen this error, your input is appreciated, I can't seem to find any references to this on the web. Looks like the error is thrown during the rendering of jsp: billingInfo.jsp. Since this happens in production, I am not sure what is the outcome etc. stack trace: [1/28/04 8:38:00:380 PST] 21e97599 WebGroup X Servlet Error: There is no process to read data written to a pipe.: java.io.IOException: There is no process to read data written to a pipe. at java.net.SocketOutputStream.socketWrite(Native Method) at java.net.SocketOutputStream.write(SocketOutputStream.java(Compiled Code)) at com.ibm.ws.io.Stream.write(Stream.java(Compiled Code)) at com.ibm.ws.io.WriteStream.flushMyBuf(WriteStream.java(Inlined Compiled Code)) at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Inlined Compiled Code)) at com.ibm.ws.http.ResponseStream.flush(ResponseStream.java(Compiled Code)) at com.ibm.ws.io.WriteStream.flush(WriteStream.java(Compiled Code)) at com.ibm.servlet.engine.http11.HttpConnection.flush (HttpConnection.java(Inlined Compiled Code)) at com.ibm.servlet.engine.srp.SRPConnection.flush(SRPConnection.java (Compiled Code)) at com.ibm.servlet.engine.srt.SRTOutputStream.flush(SRTOutputStream.java (Compiled Code)) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java(Compiled Code)) at com.ibm.servlet.engine.srt.BufferedWriter.flushChars (BufferedWriter.java(Compiled Code)) at com.ibm.servlet.engine.srt.BufferedWriter.flush(BufferedWriter.java (Inlined Compiled Code)) at com.ibm.servlet.engine.srt.BufferedWriter.flushBuffer (BufferedWriter.java(Compiled Code)) at com.ibm.servlet.engine.srt.SRTServletResponse.flushBuffer (SRTServletResponse.java(Compiled Code)) at com.ibm.servlet.engine.webapp.HttpServletResponseProxy.flushBuffer (HttpServletResponseProxy.java(Compiled Code)) at com.ibm.servlet.engine.webapp.HttpServletResponseProxy.flushBuffer (HttpServletResponseProxy.java(Compiled Code)) at org.apache.jasper.runtime.JspWriterImpl.flush(JspWriterImpl.java (Compiled Code)) at _billingInfo_jsp_30._jspService(_billingInfo_jsp_30.java:763) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java (Compiled Code)) at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service (JspServlet.java(Compiled Code)) at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java (Compiled Code)) at org.apache.jasper.runtime.JspServlet.service(JspServlet.java (Compiled Code)) at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService (ServletManager.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service (StrictLifecycleServlet.java(Compiled Code)) at com.ibm.servlet.engine.webapp.IdleServletState.service (StrictLifecycleServlet.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service (StrictLifecycleServlet.java(Inlined Compiled Code)) at com.ibm.servlet.engine.webapp.ServletInstance.service (ServletManager.java(Compiled Code)) at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch (ServletManager.java(Compiled Code)) at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch (ServletManager.java(Inlined Compiled Code)) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch (WebAppRequestDispatcher.java(Compiled Code)) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch (WebAppRequestDispatcher.java(Compiled Code)) at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward (WebAppRequestDispatcher.java(Compiled Code)) at org.apache.struts.action.ActionServlet.processActionForward (ActionServlet.java(Compiled Code)) at org.apache.struts.action.ActionServlet.process(ActionServlet.java (Compiled Code)) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java (Compiled Code)) at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictServletInstance.doService (ServletManager.java(Compiled Code)) at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service (StrictLifecycleServlet.java(Compiled Code))
Re: log4j integration
Please forgive this note if it seems too obvious and I have misunderstood your question/comments.. If you think of both struts and log4j as just a bunch of Java packages/classes, then you will see that integrating struts with log4j is really nothing unusual. The log4j jar (or classes in the jar) needs a log4j.properties file (the name of this file is most probably hard-coded in the classes in log4j jar, which is why you don't need to personally tie the file with log4j) and this file should therefore be in the classpath and as you have found out yourself, this is all that is required...If for some reason you need a handle to this file, I don't see why the usual File class in the java.io package won't do the trick..? As for how to ensure that changes in your log4j.properties is made visible to struts, well, I guess you'll have to restart tomcat (or your app server)..(:( I don't believe the admin/reload.do will work (that works for changes to the struts-config.xml and such a blessing *that* is during development!!) .. Hope this helps, Geeta shankarr wrote: Hi! In fact, I got two responses for the question as I had sent the same question twice. My mailbox was acting funny yesterday, so I had to send it twice. Well, I do have the log4j.properties file under web-inf/classes I had thought of using the PropertyConfigurator too. But, when you integrate log4j with struts, we no where mention the log4j.properties file specifically, ie, we just create the file and put it under the mentioned location. And when we use it, we do not mention the log4j.properties file anywhere in the files too. So, how to get a handle to the file? Correct me if there are better approaches to the same. Steps by which I integrated are : a)Got the log4j.jar file b)created the log4j.properties file c)created commons-logging.properties file d) used static logger = new logger(this) in the files where this is the class name. TIA, Richie At 02:28 PM 1/27/2004 -0600, you wrote: Do you mean changes made after the initial configuration of log4j? You can use PropertyConfigurator.configureAndWatch( cfgFile, delay ) This will load your log4j configuration file and create a thread that looks for changes to the config file reloading when necessary. --Norm -- Norm Deane MIS Consultant Vanderbilt University (615) 322-7855 [EMAIL PROTECTED] -Original Message- From: shankarr [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 9:14 AM To: [EMAIL PROTECTED] Subject: log4j integration Hi! I have integrated log4j with struts. I need to know how to ensure that the changes done to log4j.properties file is taken into account at run time. TIA, Richie To achieve all that is possible, one must attempt the impossible - 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 achieve all that is possible, one must attempt the impossible - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j integration
*Yes*!! The LogManager is the ticket - I didn't know about this class, so tried it out. Works like a charm.. :) Thanks, Shirish (I think? I inadvertently erased the response to this question so am not sure of its author..) Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form validation question
Andy: What do you see in the source of the html page..? Maybe it is just a question of display not working right..? Geeta Andy Kriger wrote: I am having a curious problem with form validation. I submit a form, see in the logs that the form fails to validate, however, the webapp does not return to the input page (I get a blank page with no HTML in it), so I do not see the form with error messages as expected. If I put text in the field, the form does submit correctly and I see the JSP specified in the resulting action chain. The log files have no error messages indicating something is amiss. When validation fails, the subsequent action is definitely not running (I do not see the logging in the execute method). Does anyone have any ideas what could be happening here? Or how I can track down the problem? Below is the relevant info... === STRUTS CONFIG === action path=/OrderForm forward=/web/forms/orderForm.jsp / action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action action path=/OrderThanks parameter=/web/orderThanks.jsp type=org.apache.struts.actions.ForwardAction/ === orderForm.jsp === logic:messagesPresent html:messages id=err %=err%br/ /html:messages /logic:messagesPresent html:form action=SubmitOrder.do html:text property=firstName styleId=firstName size=20/ html:submit value=Press Me/ /html:form === VALIDATION CONFIG === form name=orderForm field property=firstName depends=required arg0 key=orderForm.firstName.label name=required / /field /form === LOG MESSAGES === [org.apache.struts.action.RequestProcessor][RequestProcessor] Validating input form properties [org.apache.struts.action.RequestProcessor][RequestProcessor] Validation failed, returning to '/OrderForm.do' Andy Kriger | Software Mechanic | Greater Than One, Inc. 28 West 27th Street | 7th Floor | New York, NY 10001 P: 212.252.7197 | F: 212.252.7364 | E: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: log4j integration
Ritchie: Just make sure the log4j.properties is in your class path.. (like maybe right in your classes directory). that should do it.. Regards, Geeta shankarr wrote: Hi! I have integrated log4j with struts. I need to know how to ensure that the changes done to log4j.properties file is taken into account at run time. TIA, Richie To achieve all that is possible, one must attempt the impossible - 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: form validation question
Andy: Any reason why you have the unusual input param..? action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action I woud have thought you'd use this instead: action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/web/forms/orderForm.jsp scope=request forward name=success path=/OrderThanks.do/ /action Regards, Geeta Andy Kriger wrote: I am having a curious problem with form validation. I submit a form, see in the logs that the form fails to validate, however, the webapp does not return to the input page (I get a blank page with no HTML in it), so I do not see the form with error messages as expected. If I put text in the field, the form does submit correctly and I see the JSP specified in the resulting action chain. The log files have no error messages indicating something is amiss. When validation fails, the subsequent action is definitely not running (I do not see the logging in the execute method). Does anyone have any ideas what could be happening here? Or how I can track down the problem? Below is the relevant info... === STRUTS CONFIG === action path=/OrderForm forward=/web/forms/orderForm.jsp / action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action action path=/OrderThanks parameter=/web/orderThanks.jsp type=org.apache.struts.actions.ForwardAction/ === orderForm.jsp === logic:messagesPresent html:messages id=err %=err%br/ /html:messages /logic:messagesPresent html:form action=SubmitOrder.do html:text property=firstName styleId=firstName size=20/ html:submit value=Press Me/ /html:form === VALIDATION CONFIG === form name=orderForm field property=firstName depends=required arg0 key=orderForm.firstName.label name=required / /field /form === LOG MESSAGES === [org.apache.struts.action.RequestProcessor][RequestProcessor] Validating input form properties [org.apache.struts.action.RequestProcessor][RequestProcessor] Validation failed, returning to '/OrderForm.do' Andy Kriger | Software Mechanic | Greater Than One, Inc. 28 West 27th Street | 7th Floor | New York, NY 10001 P: 212.252.7197 | F: 212.252.7364 | E: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: form validation question
Ok, maybe, I'd have to check into struts code to really be certain(input surely has some significance is what i'm thinking..) So just for the heck of it though, what happens if you do say /web/forms/orderForm.jsp instead? Andy Kriger wrote: OrderForm.do = /web/forms/orderForm.jsp That shouldn't make a difference. I like to refer to actions rather than JSPs to minimize the number of things I have to change if a JSP changes to a different JSP or to another action. -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 27, 2004 3:27 PM To: Struts Users Mailing List Subject: Re: form validation question Andy: Any reason why you have the unusual input param..? action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action I woud have thought you'd use this instead: action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/web/forms/orderForm.jsp scope=request forward name=success path=/OrderThanks.do/ /action Regards, Geeta Andy Kriger wrote: I am having a curious problem with form validation. I submit a form, see in the logs that the form fails to validate, however, the webapp does not return to the input page (I get a blank page with no HTML in it), so I do not see the form with error messages as expected. If I put text in the field, the form does submit correctly and I see the JSP specified in the resulting action chain. The log files have no error messages indicating something is amiss. When validation fails, the subsequent action is definitely not running (I do not see the logging in the execute method). Does anyone have any ideas what could be happening here? Or how I can track down the problem? Below is the relevant info... === STRUTS CONFIG === action path=/OrderForm forward=/web/forms/orderForm.jsp / action path=/SubmitOrder type=MyClass name=orderForm validate=true input=/OrderForm.do scope=request forward name=success path=/OrderThanks.do/ /action action path=/OrderThanks parameter=/web/orderThanks.jsp type=org.apache.struts.actions.ForwardAction/ === orderForm.jsp === logic:messagesPresent html:messages id=err %=err%br/ /html:messages /logic:messagesPresent html:form action=SubmitOrder.do html:text property=firstName styleId=firstName size=20/ html:submit value=Press Me/ /html:form === VALIDATION CONFIG === form name=orderForm field property=firstName depends=required arg0 key=orderForm.firstName.label name=required / /field /form === LOG MESSAGES === [org.apache.struts.action.RequestProcessor][RequestProcessor] Validating input form properties [org.apache.struts.action.RequestProcessor][RequestProcessor] Validation failed, returning to '/OrderForm.do' Andy Kriger | Software Mechanic | Greater Than One, Inc. 28 West 27th Street | 7th Floor | New York, NY 10001 P: 212.252.7197 | F: 212.252.7364 | E: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts beginner
Vanessa: Not sure how much help thsi is, but the NoClassDefFoundError is different from the ClassNotFoundError. I have had this error happen when I have *more* than one (conflicting) copy of a jar/class. I *think* what happens is that one jar is used during compile time (depending on the order of items in your classpath..?) and the other jar is accessed during runtime, resulting in chaos. So, maybe you can check to see that you don't have some previous digester jars floating about..? Geeta Vanessa Monteiro wrote: I've already have it on my /WEB-INF/lib but the app doesn't seem to find it Here is the listing for my WEB-INF/lib commons-beanutils.jar commons-collections.jar commons-digester.jar commons-lang.jar commons-logging.jar commons-pool-1.1.jar commons-validator.jar jstl.jar standard.jar struts-el.jar struts.jar [EMAIL PROTECTED] 09/01/2004 16:09:18 http://jakarta.apache.org/site/binindex.cgi and get commons-digester.jar Saludos, -M - Original Message - From: Vanessa Monteiro [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, January 09, 2004 1:10 PM Subject: Struts beginner Hello list members, I'm new at struts list and to using the framework. I'm starting my first web app and I got to map the actions just fine but when reach the action in my appl I get the following error msg: java.lang.NoClassDefFoundError: org/apache/commons/digester/Digester Here is the listing for my WEB-INF/lib commons-beanutils.jar commons-collections.jar commons-digester.jar commons-lang.jar commons-logging.jar commons-pool-1.1.jar commons-validator.jar jstl.jar standard.jar struts-el.jar struts.jar What am I missing? Thanks, Vanessa. - 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: Action to JSP
The easiest way is perhaps to simply add a redirect=true in your action mapping. However, be aware that this will kill your request attributes (since your request object is no longer forwarded..) Regards, Geeta Mauricio T. Ferraz wrote: There are a way to: When a click in a link in my jsp page, in address bar in my browser dont write the name of the action, and go direct to the jsp page (defined in action forward) ??? Thanks. Mauricio - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: expiring time
Otávio: To set session timeout to 60 minutes, add this to your web.xml: session-config session-timeout60/session-timeout /session-config Regards, Geeta Otávio Augusto wrote: How to I set the expiring time for a session (or the sessions)? Thanks in advance Otávio Augusto - 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: Form data preloading
Patrice: Here's one relatively simple way of doing this: 1. Extend the struts ActionServlet with say MyActionServlet and make this the controller for your app. 2. In MyActionServlet declare a static var (some Collection say) representing your list of secret answers and write the code to populate it in its init() method. 3. In web.xml ensure that MyActionServlet is loaded on start-up. The list will then be available (on server strat up) before anybody tries to authenticate. (Of course you will have to be careful to update it as and when necessary..) I have heard people mention that extending the ActionServlet is not something they like to do**, but I am not sure that you would be getting yourself into trouble in this simple scenario.. If anybody sees a problem with this, please do chip in..:) Regards, Geeta **P.S. You could of course also simply write another servlet which does this job in its init() method and declare it to load on start up.. Patrice Sicaud wrote: Before I go half-cock about this, I was curious about the cleaner way to preload a form. For example, prior to authenticating users who forgot their user id, I need to retrieve (from the database) the list of possible secret questions that will be used to validate their responses (secret answer). So... what do I do? provide an action without corresponding presentation layer element? May be an FindForwardAction? Or is it preferable to chain 2 actions. I have read somewhere that the latter was not recommended. May be, it makes no difference??? Any pointer would be appreciated... Thx Patrice - 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: server hangs after finite number of requests
Heather: Sounds like you nailed down your problem. You defintely do not want to hang on to a connection longer than absolutely necessary. So if you get a connection from your pool at say the start of a database access method, make sure you release it back to the pool at the end of that method. Plus make sure you place this code in a **finally* block - so regardless of whether or not your database query was a success, the connection is released to the pool.. Also the earlier suggesstion of having just one connection in the pool during development works perfectly - we have used it for a while now and have been able to uncover errors we otherwise would not have.. Good luck! Geeta Heather Marie Buch wrote: Hi, PROBLEM SOLVED (sort of) It was because I failed to close the database connections. Well, I closed them too late. I had things set up so that when a user logs on, a service object is created for them. The Action servlet calls the service and receive business objects. The service talks to the database and creates business objects to give back to the action servlets. I had been fetching a new connection from the pool upon initialization of the service, and returning the connection to the pool when the user logged out and the service object was destroyed. When I change my code so that the service creates a new db connection each time it interacts with the db, and returns the connection in the same method, the server no longer hangs. So I guess I will have to change it to one connection per query instead of one connection per user. Does this sound right? Thanks all! Heather Buch On Tue, 6 Jan 2004, Anthony Martin wrote: I've had something like that happen when I call getDataSource(request).getConnection() and forget to close them. After a finite number of requests, the server appears to hang. Actually, depending on the settings, it will timeout. But how you handle the exception could prevent it from being properly reported. On 1/6/04 11:38 AM, in article [EMAIL PROTECTED], Heather Marie Buch [EMAIL PROTECTED] wrote: Manfred Wolff wrote: Heather. Have you studied the tomcat logs? Yes, I have. This is the only thing that is remotely interesting. In localhost_log.2004-01-06.txt I get this: 2004-01-06 03:38:41 action: null 2004-01-06 03:40:08 action: null 2004-01-06 03:40:12 action: null 2004-01-06 03:40:14 action: null 2004-01-06 03:40:16 action: null 2004-01-06 03:40:18 action: null 2004-01-06 03:40:21 action: null 2004-01-06 03:40:23 action: null (corresponding to the 8 times I try to log in). I don't really know where it is coming from. I would like to know what is generating the above, so I could to in and modify the logging statements to produce a bit more detail! I also have log4j statements in my own code and have been testing this. But I can't generate any error or anything beyond the normal output, 8 times. What is interesting is that it always fails on the 9th try. I don't think it is a matter of seconds either. I have tested over a longer period (10 minutes), but it still gives me 8 requests before it hangs. And Geeta Ramani - thanks. I will take another look at the jdbc stuff! Best, Heather Buch Manfred Wolff Heather Marie Buch wrote: Hi all, If I submit the same page more than 8 times, my server dies and I have to restart. For example, the first 8 times I enter the wrong password, struts will simply return me to my original form with an error message. However, the 9th time - the server hangs. This also occurs if I enter the correct password, then press the back button and return to the original login screen and submit again. I can only repeat this 8 times. The server hangs on the 9th try. I am using: tomcat 4.1.12 httpd 2.0.43 mysql 3.23.53 struts 1.1 I am not even sure if this is a struts problem. I suspect it is because I tried that back button trick with a plain old servlet, and I was able to do it more than 9 times. Any help would be greatly appreciated! My boss wants users to be able to try passwords more than 9 times! Thanks, Heather Buch - 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: server hangs after finite number of requests
Heather: There are many pools out there and I don't feel qualified to comment on which may be the best.. Just use one that seems adequate and you can always go back and refactor your code later.. In any case, my thought is that it is not the fact of the use of the pool that is your problem, rather it is how you use it. If you are careful to release every connection that you acquire from the pool and you ensure that any user has at any time only one connection at his/her disposal, you should be ok. (So it is how many connections a user has at any given time that you should focus on (which is why setting your pool size to 1 at development time is such a good idea), more than the time that that user has it - after all, some database operations just take a while to complete; nothing you can do about that!) Also, remember to close every result set and evrey statement that you open. Otherwise your server hanging problem will be back! Regards, Geeta Heather Marie Buch wrote: Hi, Thanks for the helpful words. Currently, I have removed my dbcp pooling altogether and the problem went away. Now, I am trying to find a way to bring dbcp back without causing the problem. I noticed that I was using dbcp 1.0, so maybe switching to 1.1 will help. Thanks for the tip on keeping connections only a short time! Is dbcp the best connection pool for Tomcat/Apache/mysql/struts, or is there something better? I'm having a hard time trying to figure out how to configure it Best, Heather On Wed, 7 Jan 2004, Geeta Ramani wrote: Heather: Sounds like you nailed down your problem. You defintely do not want to hang on to a connection longer than absolutely necessary. So if you get a connection from your pool at say the start of a database access method, make sure you release it back to the pool at the end of that method. Plus make sure you place this code in a **finally* block - so regardless of whether or not your database query was a success, the connection is released to the pool.. Also the earlier suggesstion of having just one connection in the pool during development works perfectly - we have used it for a while now and have been able to uncover errors we otherwise would not have.. Good luck! Geeta Heather Marie Buch wrote: Hi, PROBLEM SOLVED (sort of) It was because I failed to close the database connections. Well, I closed them too late. I had things set up so that when a user logs on, a service object is created for them. The Action servlet calls the service and receive business objects. The service talks to the database and creates business objects to give back to the action servlets. I had been fetching a new connection from the pool upon initialization of the service, and returning the connection to the pool when the user logged out and the service object was destroyed. When I change my code so that the service creates a new db connection each time it interacts with the db, and returns the connection in the same method, the server no longer hangs. So I guess I will have to change it to one connection per query instead of one connection per user. Does this sound right? Thanks all! Heather Buch On Tue, 6 Jan 2004, Anthony Martin wrote: I've had something like that happen when I call getDataSource(request).getConnection() and forget to close them. After a finite number of requests, the server appears to hang. Actually, depending on the settings, it will timeout. But how you handle the exception could prevent it from being properly reported. On 1/6/04 11:38 AM, in article [EMAIL PROTECTED], Heather Marie Buch [EMAIL PROTECTED] wrote: Manfred Wolff wrote: Heather. Have you studied the tomcat logs? Yes, I have. This is the only thing that is remotely interesting. In localhost_log.2004-01-06.txt I get this: 2004-01-06 03:38:41 action: null 2004-01-06 03:40:08 action: null 2004-01-06 03:40:12 action: null 2004-01-06 03:40:14 action: null 2004-01-06 03:40:16 action: null 2004-01-06 03:40:18 action: null 2004-01-06 03:40:21 action: null 2004-01-06 03:40:23 action: null (corresponding to the 8 times I try to log in). I don't really know where it is coming from. I would like to know what is generating the above, so I could to in and modify the logging statements to produce a bit more detail! I also have log4j statements in my own code and have been testing this. But I can't generate any error or anything beyond the normal output, 8 times. What is interesting is that it always fails on the 9th try. I don't think it is a matter of seconds either. I have tested over a longer period (10 minutes), but it still gives me 8 requests before it hangs. And Geeta
Re: server hangs after finite number of requests
Heather: Check any jdbc code you have. If you don't close statements/result sets and/or release connections that you have opened, then this sort of thing can happen. Regards, Geeta Manfred Wolff wrote: Heather. Have you studied the tomcat logs? Manfred Wolff Heather Marie Buch wrote: Hi all, If I submit the same page more than 8 times, my server dies and I have to restart. For example, the first 8 times I enter the wrong password, struts will simply return me to my original form with an error message. However, the 9th time - the server hangs. This also occurs if I enter the correct password, then press the back button and return to the original login screen and submit again. I can only repeat this 8 times. The server hangs on the 9th try. I am using: tomcat 4.1.12 httpd 2.0.43 mysql 3.23.53 struts 1.1 I am not even sure if this is a struts problem. I suspect it is because I tried that back button trick with a plain old servlet, and I was able to do it more than 9 times. Any help would be greatly appreciated! My boss wants users to be able to try passwords more than 9 times! Thanks, Heather Buch - 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: Question regarding ActionForms.
Sepand: google under java pass by reference vs. pass by value and look at the very first result. It contains a real nice discussion about this.. Geeta EXCELSIS - Sepand Oboudiyat wrote: Hi, I am currently using Struts 1.0.2 and have notice something with regard to handling of ActionForms. Why is it, that in the perform() method of my Action I am able to modify the passed-in ActionForm and all modifications that I make to the ActionForm in my Action have effect on the ActionForm in the session, without the need to reset the modified form in the session. e.g. public ActionForward peform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, )throws IOException, ServletException { MyForm myForm = (MyForm)form; form.setMemberA(valA); form.setMemberB(valB); // why dont I have to do the following: session.setAttribute (myFormName, myForm); return success; } I thought that since Java passes method arguments by value and not by reference, then I would have to reset my modifed copy back into the session for changes on the form to be visible in the form in the session ? Any insights on how this mechanism works would be greatly appreciated. Thanks, Sepand - 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: Tokens
Gurpreet: Don't mean to jump in if you already have found a good solution, but wouldn't it be simpler to just not allow the user to press the submit btton twice? It is easy (using Javascript) to disable a submit button once it has already been pressed.. Regards, Geeta Mainguy, Mike wrote: Call saveToken() in GET (or read) Test isTokenValid() in the POST (or write) to see if it is a dupe (duplicate returns false [bad token]) worse is better -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:19 PM To: Struts Users Mailing List Subject: Re: Tokens hi Ramadoss Thanks for your help. But this is not i m looking for. I may not be able to explain my question proeprly . But i m looking for saveTOken() method implementation in struts which does not allow duplicate entry of records into the database when the user click on submit button twice. - Original Message - From: Ramadoss Chinnakuzhandai [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:56 PM Subject: RE: Tokens Hi Gurpreet, If what I understand is correct from your question, you can use split function the same way as you use String Token...following is sample snap shot String str = botherouioero:and:foroffo:mar:ssod:slave; String[] arr = str.split(:, 9); System.out.println(length of arr[] is: + arr.length); for (int i = 0; i arr.length; i++) { System.out.println(value is : + arr[i]); } String[] ar = str.split(o, 8); System.out.println(length of arr[] is: + ar.length); for (int i = 0; i ar.length; i++) { System.out.println(value is : + ar[i]); } Where the number 9 and 8 denotes number of occurences you want to consider after which it will be treated as whole single string and will be included into your String Array. Hope this help, -Ram -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 6:19 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Tokens hi All Can somebody explain small code snap shot of using Tokens. AS i am trying to use it in one of my application. but due to some unknown reason it is not working. I may be doing something wrong. Any help will be appreciated Regards GAry - 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] - This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately. - 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: Tokens
Oh, ok. I guess i was thinking of the more casual click-happy user who can be perhaps persuaded to see that overclicking is a bad thing.. But you're right: the scenario you describe can certainly occur for the more determined lets-break-this-code user..;) Thanks for setting me right..! Jason Lea wrote: The Struts saveToken() isTokenValid() methods save a token so that double submits are detected and can be dealt with. Just disabling the submit button won't stop a user submitting and then refreshing the page (which submits the same info twice) or going back in their history and clicking submit on an earlier page. Geeta Ramani wrote: Gurpreet: Don't mean to jump in if you already have found a good solution, but wouldn't it be simpler to just not allow the user to press the submit btton twice? It is easy (using Javascript) to disable a submit button once it has already been pressed.. Regards, Geeta Mainguy, Mike wrote: Call saveToken() in GET (or read) Test isTokenValid() in the POST (or write) to see if it is a dupe (duplicate returns false [bad token]) worse is better -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 11:19 PM To: Struts Users Mailing List Subject: Re: Tokens hi Ramadoss Thanks for your help. But this is not i m looking for. I may not be able to explain my question proeprly . But i m looking for saveTOken() method implementation in struts which does not allow duplicate entry of records into the database when the user click on submit button twice. - Original Message - From: Ramadoss Chinnakuzhandai [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 7:56 PM Subject: RE: Tokens Hi Gurpreet, If what I understand is correct from your question, you can use split function the same way as you use String Token...following is sample snap shot String str = botherouioero:and:foroffo:mar:ssod:slave; String[] arr = str.split(:, 9); System.out.println(length of arr[] is: + arr.length); for (int i = 0; i arr.length; i++) { System.out.println(value is : + arr[i]); } String[] ar = str.split(o, 8); System.out.println(length of arr[] is: + ar.length); for (int i = 0; i ar.length; i++) { System.out.println(value is : + ar[i]); } Where the number 9 and 8 denotes number of occurences you want to consider after which it will be treated as whole single string and will be included into your String Array. Hope this help, -Ram -Original Message- From: Gurpreet Dhanoa [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 19, 2003 6:19 AM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Tokens hi All Can somebody explain small code snap shot of using Tokens. AS i am trying to use it in one of my application. but due to some unknown reason it is not working. I may be doing something wrong. Any help will be appreciated Regards GAry -- Jason Lea - 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: Antwort: Re: [OT] Re: far reaching db question
Manuel: Manuel Lenz wrote: I tried to fill in the values with ps.setString(1, anyValue), etc. as shown in the example below. But the db drops an error: not all variables bound Has anybody an idea? The number of question marks in the sql-statement ist exactly the same as the amount of strings I´m setting into prepared statement. This is exactly why! Make sure they are the same (and the types match) and you will be ok.. Regards, Manuel Cheers, Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Planning Struts Application Development
What's more, the on-line help on the Expresso list is probably the best I have ever encountered.. In fact, I suspect the lead developer of the project is a vampire so he never sleeps..;) You can also pay a pretty nominal amount for prime support - and if you contribute to their open-source project, I believe you can even qualify for free support!! Re. your earlier question, here's my 1 cent: we have been working on a long (2+ years and counting) project. Version 1 involved a lot of home-grown servlets and jsps. Version 2 involved building additional functionality and was written in a combination of servlets and Struts (due to differing degrees of familiarity of the developers with Struts). Version 3 (currently being developed) is written entirely in Struts. I can tell you that every time the clients either notice a bug or want to change or add behaviour, we give a collective groan if it has anything to do with non-Struts code! But if it is the later code, we just breeze through it..:) Regards, Geeta Andrew Hill wrote: You might want to take a look at Jcorporates OpenSource Expresso framework. http://www.jcorporate.com/ Ive not used it myself yet so cant give you an experienced opinion, but it uses struts and provides whole bunch of other goodies which migh help you get a head start on your project. -Original Message- From: Lauri Jutila [mailto:[EMAIL PROTECTED] Sent: Wednesday, 29 October 2003 07:04 To: [EMAIL PROTECTED] Subject: Planning Struts Application Development Hello folks, I'm engaging in a web development project and my team is looking at Struts as a primary framework candidate for the application. Before we make final decision, I'd be glad to hear some commentary and experiences from real-world Struts users. Our project goal is to create an application which is leaning a little towards web-based group-ware applications in terms of feature set. No, we are not creating e-mail/calendar/task-list/foobar portal, but our app will include some of the basic group-ware app features and share quite many characteristics (different types of calendars come to mind). We would like our application to support at least hundreds of concurrent users. What kind of issues does this arise in terms of hardware and software/application configurations? How many users per app server would be feasible and how to handle multi-server environment gracefully? How is caching supported or implemented in Struts? What do you think are the fundamental issues to focus on design development? And if you think, based on my very poor description of requirements, that Struts may not be the right framework, what are the alternatives? Best regards, -- Lauri Jutila [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: newbie session problem
Geraldine: Cookies and urlRewriting have been discussed a lot in the past. You may want to search the archives.. regards, Geeta geraldine wrote: Thanks! The forward works great but the problem with the session still exists. My page only works when I enable cookies. However, I'm still looking for other solutions using url rewriting which somehow doesn't work! Can anyone else enlighten me or is my question just too trivial? Regards, Geraldine -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: Monday, October 27, 2003 9:35 PM To: Struts Users Mailing List Subject: Re: newbie session problem Hi! this doesn't explain why a new session is created, but in the link in your original jsp do not link directly to the second jsp: it's a bad practice anyway since it breaks MVC. Instead use something like this: html:link page=/goToJsp2.doJsp 2/html:link In your struts-config.xml, add this action mapping: action path=/goToJsp2 parameter=path_to_jsp2 type=org.apache.struts.actions.ForwardAction / My guess is you should be alright then.. (Read up on org.apache.struts.actions.ForwardAction in the docs if necessary..) hth, Geeta [EMAIL PROTECTED] wrote: My struts application has a link to another jsp. but everytime i click on this link, the jsp creates a new session. I've tried practically everything, html:link, %response.encodeURL()% and even manually appending the jsessionid to the end of the url to this jsp, but it just keeps on creating those new sessions. Is there something i'm missing out? the funny thing is that the rest of my links work fine (just this fiddly one) and the even cuter thing is that sometimes it works and sometimes it doesn't! i'm trying not to use cookies to store my session. am i missing something out here? 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] - 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: Forward Cannot Be Achieved In One Step
Caroline: ok, I didn't sleep enough last night so I may be blabbering(:(, but why don't you simply say: html:link page=/LogoffLOGOUT/html:link and lose the forward entry in your struts-config.xml? Geeta Caroline Jen wrote: The do/Menu does display my welcome page. The LOGOUT button and forward does eventually lead the visitor to the welcome page. The problem is that it takes two steps intead of going straight to the welcome page. Let me re-state my problem: I have the following code in the navbarMenu.jsp: html:link forward=exitLOGOUT/html:link and in the struts-config.xml, I have: forward name=exit path=/do/Logoff/ and action path=/Logoff type=org.NameOfOrganization.signoff.LogoffAction forward name=success path=/do/Menu/ /action In the LogoffAction.java, I invalidate the session and I want the user to go back the welcome page. And action path=/Menu name=menuForm type=org.apache.struts.scaffold.ExistsAttributeAction parameter=application;HOURS forward name=success path=.article.Menu/ forward name=failure path=/do/MenuCreate/ The .article.Menu is my tile that displays the welcome page. The problem is that it takes two steps for the user to go back to the welcome page - After the first click, the same screen remains in the browser. The only change is what is shown in the address bar. I have to click the LOGOFF button again and then the welcome page is displayed. What should I do to go back to the welcome page in one step? --- Ruth, Brice [EMAIL PROTECTED] wrote: Is your Menu actionforward the welcome screen you want to get to? And does your Action return an ActionForward to this? Caroline Jen wrote: Hi, I have the following code in the navbarMenu.jsp: html:link forward=exitLOGOUT/html:link and in the struts-config.xml, I have: forward name=exit path=/do/Logoff/ and action path=/Logoff type=org.NameOfOrganization.signoff.LogoffAction forward name=success path=/do/Menu/ /action In the LogoffAction.java, I invalidate the session and I want the user to go back the welcome page. The problem is that it takes two steps for the user to go back to the welcome page - After the first click, the same screen remains in the browser. The only change is what is shown in the address bar. I have to click the LOGOFF button again and then the welcome page is displayed. What should I do to go back to the welcome page in one step? __ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: newbie session problem
Hi! this doesn't explain why a new session is created, but in the link in your original jsp do not link directly to the second jsp: it's a bad practice anyway since it breaks MVC. Instead use something like this: html:link page=/goToJsp2.doJsp 2/html:link In your struts-config.xml, add this action mapping: action path=/goToJsp2 parameter=path_to_jsp2 type=org.apache.struts.actions.ForwardAction / My guess is you should be alright then.. (Read up on org.apache.struts.actions.ForwardAction in the docs if necessary..) hth, Geeta [EMAIL PROTECTED] wrote: My struts application has a link to another jsp. but everytime i click on this link, the jsp creates a new session. I've tried practically everything, html:link, %response.encodeURL()% and even manually appending the jsessionid to the end of the url to this jsp, but it just keeps on creating those new sessions. Is there something i'm missing out? the funny thing is that the rest of my links work fine (just this fiddly one) and the even cuter thing is that sometimes it works and sometimes it doesn't! i'm trying not to use cookies to store my session. am i missing something out here? 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: Session-scoped form and synchronization...
Craig R. McClanahan wrote: Unfortunately, having frames is *not* the only scenario where you have to worry about multiple simultaneous requests. Two simple additional ones: * Your app contains img tags that point back into your app (dynamically generated images, for example). * User starts a long request, presses stop, starts a second request. In fact in order to avoid just this last situation, we disabled all submit buttons on the page when any one was pressed (and the one that was submitted changed its face to a Please wait..). Of course i am sure users can always find ways to circumvent such blocks, but we at least disabled one of our testers from being too click-happy..;) Pete Craig Geeta - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to do Confirmation page.
Hi DN! Seems like the specs just changed..;) Please see inline comments.. Dinh Nguyen wrote: Geeta, thanks for pointing out the issue, however, we take care of that in the validation form. Either way if the user misses some fields, he/she'll be redirected back to the registration form asks them to fill-in the required fields. I am sorry I was confusing myself too: Below is the instructions: 1) Fill-out the registration form 2) Click on Submit button on registration form 3) User is redirected to Confirmation page Your information is submitted What is the purpose of this confirmation page? Is this just a display of what the user has just entered and asking the user if it is ok to submit now? If the user is happy with the input, (s)he is supposed to click on a Done button and if not, (s)he clicks on a Cancel button. Is this correct? If so, forget about the Javascript, use ordinary Actions to direct the user to the correct place. and you can just use the html:cancel tag for the CAnel button. (I think this was suggested by an earlier post by Rajat Pandit..?) . I am no longer sure where you ran into trouble in the first place..? 4) On confirmation page, the user clicks Done button 5) Redirects to index.jsp I assume the user is redirected to index.jsp only if there are no errors? and you are using the form bean validate for checking input errors and so on. What do you mean to do if there are no input errors but for some reason the registration is a failure (as in database is done etc.?) On the registration form (register.jsp) I code like this: head script language=JavaScript function confirmSubmit(){ if (confirm(are you sure you want to submit information?) { window.location.href =html:rewrite page=/register.do /; } } //end method confirmPrint /script /head html:errors/ html:form action=/register focus=userName html:submit value=Submit onclick=return confirmSubmit() / . When I filled out (correctly) the form, click on submit button, then it took me directly to register.do page. This is wierd. Seems like your onClick method isn't working correctly. Have you looked at the source of the regisration page? Have you checked for javascript errors? You could change you confirmSubmit() function so that all it does is throw an alert so that you know that onClick is working if you really want to dig into this. On the other hand, if your specs are such that (as I suspect) Javascript will not even be needed any more, maybe you can do away with this whole code anyway.. I guess that there is some logics behind this, but I don't know. Thanks, DN Regards, Geeta
Re: going straight to a jsp
Hi Simon: I think maybe you have misunderstood what it means to say don't directly go to jsps. What this means is don't break the MVC pattern. So for example, if you have a link on your jsp and all you want it to do is to go to a second jsp, resist the temptation to code the second jsp directly using that as your href value. Instead respect the MVC design and use the fowardAction that Struts already has. This way you are always going to the controller (the ActionServlet) to find out where to go next. So, adding a redirect=true in your mappings is not a bad thing really (unless you want to preserve request attributes.. but that's another story..:) hth, Geeta Simon Matic Langford wrote: Hi, I've been using struts for a couple of months now, and have been working on the assumption that it is a bad thing to allow users to go directly to jsp's. So I have ensured that I don't use redirect=true on forwards from an Action. Is this considered best practice for Struts? And are there any concrete reasons for or against this practice? Thanks Simon - 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: going straight to a jsp
Simon: I think I agree with what Mark writes below. Especially if you consider that what is a simple link today may very well not be one tomorrow - if your clients are like the ones I work for..;) .. My gut feeling is that performance will not be a major factor since struts-config.xml is loaded once at startup, but by all means run a performance test to be sure.. Going back to your second question, if you have say an 'initial page (like login.jsp) which you want people to always start from, then one way of getting round the bookmarking issue would be to set a session variable after a user gets in (like authenticates). Then at the top of every jsp you could ensure that that session variable exists and is nonnull. If it doesn't exist then forward to the login.jsp. This will effectively solve your bookmarkig issue.. Regards, Geeta Mark Lowe wrote: The performance costs are low, but using an action just to forward to different views does have a very small performance cost. Run a stress test and you'll see. The benefits however of doing everything via actions, far outweigh the slight performance hit. You can start to think about your app in an event based way. /save.do, /delete.do rather than the names of the view's file name. Cheers Mark On Saturday, October 25, 2003, at 06:09 PM, Simon Matic Langford wrote: it helps (a little). what i don't want is users bookmarking a jsp, which would then allow them to break MVC. however, isn't going via the forwardaction a little inefficent compared to linking direct to the jsp (my target environment is 2000 concurrent users)? or do you think the benefits of keeping to MVC might outweigh that? thanks for your help so far simon -Original Message- From: Geeta Ramani [mailto:[EMAIL PROTECTED] Sent: 25 October 2003 18:59 To: Struts Users Mailing List Subject: Re: going straight to a jsp Hi Simon: I think maybe you have misunderstood what it means to say don't directly go to jsps. What this means is don't break the MVC pattern. So for example, if you have a link on your jsp and all you want it to do is to go to a second jsp, resist the temptation to code the second jsp directly using that as your href value. Instead respect the MVC design and use the fowardAction that Struts already has. This way you are always going to the controller (the ActionServlet) to find out where to go next. So, adding a redirect=true in your mappings is not a bad thing really (unless you want to preserve request attributes.. but that's another story..:) hth, Geeta Simon Matic Langford wrote: Hi, I've been using struts for a couple of months now, and have been working on the assumption that it is a bad thing to allow users to go directly to jsp's. So I have ensured that I don't use redirect=true on forwards from an Action. Is this considered best practice for Struts? And are there any concrete reasons for or against this practice? Thanks Simon - 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: How to do Confirmation page.
Hi Dinh Nguyen: We had a similar requirement and we solved it using Javascript's location.href .. I reproduce our code below: script language=JavaScript function confirmPrint(msg){ if (confirm(msg)) { window.location.href =html:rewrite page=/BillingReportPrintAction.do /; } } //end method confirmPrint /script So i think you should be able to do something similar (combining it with an onClick method for your submit button..) Hth, Geeta Dinh Nguyen wrote: Hi, Do you know how to do the confirm page using struts? For example, after a person fill-out a registration form, he/she clicks on Submit button, she/he will be redirected to a page says that are you sure you want to submit information?. If the use clicks yes, button, then he/she will be redirected back to the home page, otherwise, he/she will be redirected back to registration form/page if the cancel button is clicked. Thanks, dinh Nguyen - 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]