AW: LookupDispatchAction-problem getting started
Thank you, the spaces work. Volker > -Ursprüngliche Nachricht- > Von: Wendy Smoak [SMTP:[EMAIL PROTECTED] > Gesendet am: Montag, 22. August 2005 14:43 > An: Struts Users Mailing List > Betreff: Re: LookupDispatchAction-problem getting started > > From: "Tiller, Volker" <[EMAIL PROTECTED]> > > > I can't get started with the example about using LookupDispatchAction > > of Ted Husted, Tip #3 (http://husted.com/struts/tips/index.html). > > What is my error or can I get some working code ? > > > > > The 'method' parameter should be set to the _value_ from > ApplicationResources.properties (not the key). I'm not sure how to encode > the spaces to do this manually, maybe method=add+it+all or > method=add%20it%20all. Or maybe the spaces will just work. (It's early...) > > Here's what happens: > - the framework sees "add it all" as the value of the 'method' parameter > - it figures out that 'add it all' came from the 'button.add' property > - looks up 'button.add' in the keyMethodMap and finds 'add' > - calls the 'add' method in your Action > > (Naming the parameter something other than 'method' may make things > clearer-- maybe 'choice'.) > > HTH, > -- > Wendy Smoak > > > > - > 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: Set the file name in html:file
Browsers don't allow you to set a file name, as it could be a security risk eg set file name to be c:\windows\someimportantfile.txt then get the form to auto submit and send the file to the server Anuradha S.Athreya wrote: Hello, In the JSP, I need to set the default file name in the JSP. I'm using html:file taglib. I'm retrieving the file name (to be set) from a bean. What is the syntax for this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Jason Lea - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
'required' is undefined when using struts javascript validation
Hi, I'm a newbie at using strus and have been trying to get client-side validation to work using Struts, but I 'm receiving a javascript error while trying to use the 'required ' validation rule. The error in IE and FireFox both say: Error: 'required ' is undefined When I look at the generated javascript, it seems the object 'required' is not defined in the following generated function. Can anyone give me some guidance how to resolve this? I'd really appreciate it. Hope to hear from you soon. function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRequired = new required(); for (x in oRequired) { var field = form[oRequired[x][0]]; ... Thanks in advance, -Paul - Start your day with Yahoo! - make it your home page
Set the file name in html:file
Hello, In the JSP, I need to set the default file name in the JSP. I'm using html:file taglib. I'm retrieving the file name (to be set) from a bean. What is the syntax for this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Debug easier
Wendy turned me on to JSwat... as someone who historically hasn't found much use for a debugger, I have to say it has been a joy to use. And it is a fairly light app, certainly far lighter than a full IDE would be. If you develop under Tomcat, it attaches very easily too. If anyone feels the need to use a debugger, I very much recommend JSwat. Frank Martin Gainty wrote: I would urge you to strongly consider Oracle JDeveloper with the caveat that *any* debugger is/are severely resource hungry for both diskspace and memory If you want to run your app lite on it feet ..logging is still the best way to go HTH, Martin- - Original Message - From: "Larry Meadors" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Monday, August 22, 2005 10:57 AM Subject: Re: How to Debug easier Why not just use a debugger? There are several very good free debuggers available - netbeans, eclipse, jedit, ... Simple to set up, and a bit less "predictive" to use. (By that, I mean instead of trying to log what you think the problem might be, you can examine it as it is running to SEE what the problem really is.) Larry On 8/21/05, C.F. Scheidecker Antunes <[EMAIL PROTECTED]> wrote: Hello all, If I have a System.out.Println() statement on my Struts code where would that be written to? I would like to write stuff to either the console or the Tomcat log text file. How can I achieve that? System.out.println() does not seem to be doing anything. I want to know what it is going on at run time to make it easier to debug stuff. Any suggestions? Thanks, C.F. - 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] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Debug easier
I would urge you to strongly consider Oracle JDeveloper with the caveat that *any* debugger is/are severely resource hungry for both diskspace and memory If you want to run your app lite on it feet ..logging is still the best way to go HTH, Martin- - Original Message - From: "Larry Meadors" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Monday, August 22, 2005 10:57 AM Subject: Re: How to Debug easier Why not just use a debugger? There are several very good free debuggers available - netbeans, eclipse, jedit, ... Simple to set up, and a bit less "predictive" to use. (By that, I mean instead of trying to log what you think the problem might be, you can examine it as it is running to SEE what the problem really is.) Larry On 8/21/05, C.F. Scheidecker Antunes <[EMAIL PROTECTED]> wrote: Hello all, If I have a System.out.Println() statement on my Struts code where would that be written to? I would like to write stuff to either the console or the Tomcat log text file. How can I achieve that? System.out.println() does not seem to be doing anything. I want to know what it is going on at run time to make it easier to debug stuff. Any suggestions? Thanks, C.F. - 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 1.2 - Using Tile Definitions as ActionForwards
Thanks for the reply. Is the syntax you forwarded in the globalforwards section of the config file? It looks like you are declaring an action. That works for me too. I'm looking to do the same type of thing but in the globalforwards section. lee On Mon, 22 Aug 2005 18:32:07 -0400, Robert Taylor wrote > I'm using Struts 1.2.7 running in Tomcat5.x and it works for me. > > > > /robert > > lchalupa wrote: > > I'm trying to use a feature of Tiles. > > > > I'm using struts 1.2. I'm using Tiles Definitions maintained in a > > configuration file. > > I want to use the definition names in the strutsconfig file instead of a jsp > > path. > > I'm able to get this feature to work if I use an action to specify an > > actionforward with a parameter containing the tile definition name. This > > works fine. > > I also want to specify tile definitions in Global Forwards. Is this suppose > > to work? Some of the Struts books lead me to believe it should. When I try > > it, I get an error saying it cannot find the page. > > > > My first step is to find out if this feature is available for use. > > > > Comments? > > > > Thanks > > > > lee > > Lee Chalupa > > [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] Lee Chalupa [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts 1.2 - Using Tile Definitions as ActionForwards
Ooops. Responded without comprehending the entire message. I haven't tried it with global forwards. Sorry. /robert Robert Taylor wrote: I'm using Struts 1.2.7 running in Tomcat5.x and it works for me. /robert lchalupa wrote: I'm trying to use a feature of Tiles. I'm using struts 1.2. I'm using Tiles Definitions maintained in a configuration file. I want to use the definition names in the strutsconfig file instead of a jsp path. I'm able to get this feature to work if I use an action to specify an actionforward with a parameter containing the tile definition name. This works fine. I also want to specify tile definitions in Global Forwards. Is this suppose to work? Some of the Struts books lead me to believe it should. When I try it, I get an error saying it cannot find the page. My first step is to find out if this feature is available for use. Comments? Thanks lee Lee Chalupa [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: Displaying errors for all except one key
Hi again, everybody! I promised I'd report back with results. I think the tag is working quite well so far, and it turned out to be pretty simple to extend the html:messages custom tag. I got the source code and overrode the doStartTag() method. I left all the original source in place but added this: //Were any properties to be excluded? Configuration config = Configuration.getConfiguration(); String excludedProperties = config.getValue("excludedProperties"); ArrayList excludedList = new ArrayList(); if(excludedProperties!=null && excludedProperties.length()>0){ String[] excludedArray = excludedProperties.split(","); for(int i=0;i0){ ActionMessages tempMessages=new ActionMessages(); Iterator tempIt = messages.get(); while(tempIt.hasNext()){ ActionMessage tempMessage=(ActionMessage)tempIt.next(); if(!excludedList.contains(tempMessage.getKey())){ tempMessages.add(tempMessage.getKey(),tempMessage); } } messages=tempMessages; } That was it. The JSP code is actually simpler than it was before: <%-- Display Error Messages if the showErrors parameter is true --%> Etc. So I'm just displaying everything but I'm using my custom tag instead of the default one from html:messages, and that custom tag does the exclusions I need. I do have a problem I should solve: in the case where the only error in errors is one I need to exclude, it does get excluded but I also get the empty which displays a big red box on my page. Fortunately, that happens very rarely. I guess I could extend messagesPresent as well to take care of that. Thanks again for the help. I really appreciate it. Chris Loschen -Original Message- From: Chris Loschen Sent: Tuesday, August 16, 2005 9:52 PM To: 'Struts Users Mailing List' Subject: RE: Displaying errors for all except one key Yes, I wouldn't be able to get away with the empty tag -- it would create a great big red box on my page which wouldn't be acceptable. I'm working on extending html:messages, and it's working quite well (and surprisingly easily) so far. I'll do some more testing tomorrow and if all goes well, I'll post what I've done. Again, thank you very much for your help. Chris -Original Message- From: Kishore Senji [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 1:08 PM To: Struts Users Mailing List Subject: Re: Displaying errors for all except one key On 8/16/05, Chris Loschen <[EMAIL PROTECTED]> wrote: > Thank you very much for the idea. I'm starting to wrestle with it. > > My first instinct is that I'm going to need to extend html:messages > because the JSP solution below wouldn't work (I think!) with the HTML > structure -- in other words, I'm going to end up with a new > for every new error instead of the single div and ul for the whole set > that I need. But I couldn't rearrange it either because then if I have > only the error I want to exclude, I still get the (now empty) . > Does that sound right? If you have the something like this in your jsp, even if you have only one error that you would want to exculde you will be left with only a If you don't like to display the empty div when there are no errors, you would have to do some processing of the "properties" to see if you have atleast one other property other than the one that you want to exclude then only show the div and the errors. But anyway, is showing an empty div that big of an issue? > I'm tracking down the appropriate source code so that I can look at > the messages tag. I'm thinking that what I need to do is simply > iterate through my errors, copy each one that isn't in my excluded > list (for now, only one, but might grow later) to a new collection, > and then pass that new collection to super along with the appropriate > arguments. Does that sound reasonable, or am I missing something? There is no super method in HtmlMessages tag that can take the collection of errors and iterate. You would have to override the doStartTag of the HtmlMessages tag and create the iterator excluding the errors that you don't want to see. > > Thanks again for your help. > > Chris > > -Original Message- > From: Kishore Senji [mailto:[EMAIL PROTECTED] > Sent: Monday, August 15, 2005 6:15 PM > To: Struts Users Mailing List > Subject: Re: Displaying errors for all except one key > > I believe the reason that the Validator errors are missing is that > Validator keys the errors with the property name of the form field. > And so, if you say that just show the errors whose property is > "ActionErrors.GLOBAL_ER
Re: Struts 1.2 - Using Tile Definitions as ActionForwards
I'm using Struts 1.2.7 running in Tomcat5.x and it works for me. /robert lchalupa wrote: I'm trying to use a feature of Tiles. I'm using struts 1.2. I'm using Tiles Definitions maintained in a configuration file. I want to use the definition names in the strutsconfig file instead of a jsp path. I'm able to get this feature to work if I use an action to specify an actionforward with a parameter containing the tile definition name. This works fine. I also want to specify tile definitions in Global Forwards. Is this suppose to work? Some of the Struts books lead me to believe it should. When I try it, I get an error saying it cannot find the page. My first step is to find out if this feature is available for use. Comments? Thanks lee Lee Chalupa [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]
Struts 1.2 - Using Tile Definitions as ActionForwards
I'm trying to use a feature of Tiles. I'm using struts 1.2. I'm using Tiles Definitions maintained in a configuration file. I want to use the definition names in the strutsconfig file instead of a jsp path. I'm able to get this feature to work if I use an action to specify an actionforward with a parameter containing the tile definition name. This works fine. I also want to specify tile definitions in Global Forwards. Is this suppose to work? Some of the Struts books lead me to believe it should. When I try it, I get an error saying it cannot find the page. My first step is to find out if this feature is available for use. Comments? Thanks lee Lee Chalupa [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about Struts html tags and Javascript getElementById
This works in IE, Hope this helps. Thanks. var checkMe = function(thisForm) { alert(thisForm.elements['uploadedFiles[0]'].value); return false; }; On 8/22/05, Dave Newton <[EMAIL PROTECTED]> wrote: > Gordon Hu wrote: > > > > > > > > I was asking as a subtle hint that there is nothing with an id of > "uploadedFiles" making your JavaScript not do what you want it to. > > >On 8/22/05, Dave Newton <[EMAIL PROTECTED]> wrote: > > > > > >>Gordon Hu wrote: > >> > >> > >>> >>>accept="image/jpg, image/jpeg"> > >>>I am trying to set up a Javascript function like the following: > >>>document.form.getElementById("uploadedFiles"); > >>>Any ideas? > >>> > >>What does the generated file upload HTML look like if you view source? > >> > >> > > > > - > 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 about Struts html tags and Javascript getElementById
According to the docs, http://struts.apache.org/userGuide/struts-html.html#file, the html:file tag will render and id tag with the attribute styleId. Also, when I use getElementById I just call it on the document. So what I think you are trying to do is so: styleId="uploadedFiles1" accept="image/jpg, image/jpeg"> styleId="uploadedFiles2" accept="image/jpg, image/jpeg"> styleId="uploadedFiles3" accept="image/jpg, image/jpeg"> styleId="uploadedFiles4" accept="image/jpg, image/jpeg"> In javascript you should be able to get a reference to those nodes by calling document.getElementById("uploadedFiles1"), for example. That being said, what I showed you is not the way I would do it. Also, your property attributes look funny to me. I would do this. accept="image/jpg, image/jpeg"> accept="image/jpg, image/jpeg"> accept="image/jpg, image/jpeg"> accept="image/jpg, image/jpeg"> (I think you'll want surrounding the html:files, I omitted them for space). Even without the id attribute you can still easily get a reference to these nodes in javascript You could call a javascript function when the form submits, i.e. . In the javascript you could get the reference to the html:file nodes like so: function verify(form){ /* this will return an array of the html:file nodes with property="uploadedFiles" */ var fileInputs = form['uploadedFiles']; } Some of my syntax could be wrong, but the jist of it should be correct. Ross Gordon Hu wrote: I am having difficulties referencing struts html tags through Javacript. I am trying to validate 10 file upload boxes to see if the user has at least uploaded 1 file and also to validate the extension of the file (.jpg). accept="image/jpg, image/jpeg"> accept="image/jpg, image/jpeg" > accept="image/jpg, image/jpeg" > accept="image/jpg, image/jpeg" > ..and so on I am trying to set up a Javascript function like the following: document.form.getElementById("uploadedFiles"); But it does not work. Any ideas? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about Struts html tags and Javascript getElementById
Gordon Hu wrote: I was asking as a subtle hint that there is nothing with an id of "uploadedFiles" making your JavaScript not do what you want it to. On 8/22/05, Dave Newton <[EMAIL PROTECTED]> wrote: Gordon Hu wrote: I am trying to set up a Javascript function like the following: document.form.getElementById("uploadedFiles"); Any ideas? What does the generated file upload HTML look like if you view source? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about Struts html tags and Javascript getElementById
On 8/22/05, Dave Newton <[EMAIL PROTECTED]> wrote: > > Gordon Hu wrote: > > > >accept="image/jpg, image/jpeg"> > > I am trying to set up a Javascript function like the following: > > document.form.getElementById("uploadedFiles"); > >Any ideas? > > > > > What does the generated file upload HTML look like if you view source? > > Dave > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: question about Struts html tags and Javascript getElementById
Gordon Hu wrote: accept="image/jpg, image/jpeg"> I am trying to set up a Javascript function like the following: document.form.getElementById("uploadedFiles"); Any ideas? What does the generated file upload HTML look like if you view source? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
question about Struts html tags and Javascript getElementById
I am having difficulties referencing struts html tags through Javacript. I am trying to validate 10 file upload boxes to see if the user has at least uploaded 1 file and also to validate the extension of the file (.jpg). ..and so on I am trying to set up a Javascript function like the following: document.form.getElementById("uploadedFiles"); But it does not work. Any ideas?
Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Seems to me that you do not really understand what LookupDispatchAction is for and how does it work. Do you have property file that maps button caption to "button.add" property name? Well, even if you do, you do not have to use LookupDispatchAction, because you use a link. Use standard DispathAction instead. Or use something else, like SelectAction, which works uniformly with pushbuttons, links and imagebuttons: http://struts.sourceforge.net/strutsdialogs/selectaction.html --- Struts Dialogs: http://struts.sourceforge.net/strutsdialogs On 8/22/05, Letícia Álvares Barbalho <[EMAIL PROTECTED]> wrote: > Well, I should be embarrassed by now. Actually, you're 100% correct: > something is sending literally 'button.delete' as the value of method param, > instead of the value from the .properties file. And this something would be > me. > > It happens that I am not using html:submit buttons to call the dispatch > action. Instead of it, I'm trying to use links, like this: > > property="method"> > > Well, if it worked like the html:button, it would send the method with the > value from the bean. But it obviously doesn't. So, I put this js function to > be called onclick: > > function dispatchIt() > { > document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method= > button.add"; > document.addColecaoForm.submit(); > } > > > And that's causing the error. So, if the property=method doesn't work, and > passing it literally doesn't work... that means I cannot use links to submit > the form? Or am I doing it totally wrong? > > Sorry, thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Validator's indexedListProperty
On Mon, Aug 22, 2005 at 11:18:50AM -0500, Josh Cronemeyer wrote: > Hi, > > I've been playing with the indexedListProperty to validate what a user has > selected in my forms. The problem I am having is that when an error message > gets returned, It does not get associated with the form element > ( in my case). I think the problem is that > the message comes back with a key of test[x] where x is the index of the > error. If I just print out my error messages like this I can > see the error message, but doesn't show > anything. It seems like the tag should have an > indexedListProperty parameter as well so I can display my error messages > correctly. What am i missing? > > Regards, > > josh cronemeyer > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > I've looked all over in the struts user guide and googled for information on this. It appears that while the validator can handle validation of indexed beans in forms, the struts JSP taglibs cannot handle the resulting indexed messages. Could this be a bug? It sure looks that way. Thanks, josh cronemeyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
On 8/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > From: "Rick Reumann" <[EMAIL PROTECTED]> > > > Ok, I'll try this with Shale, although I'm really surprised the framework > > (JSF) doesn't take care of this for you by default? In struts it's so > > simple, I simply forward to an Action that populates my employees. > Some people find the need for separate setup and processing actions to be a usability issue with Struts :-). Of course, it's all about what you are used to, as well ... learning new idioms always seems more difficult than applying what you already know. > Consider that Struts added services on top of Servlets and JSP... and now > Shale is adding services on top of JSF. You can only get so much into a > specification. ;) Some of it either has to wait for the next version, or > just doesn't belong in there to begin with. > The timing issue was definitely important when we were trying to finish up JSF 1.0 ... if we'd made it a requirement to cover all the functionality of every important web framework in existence, we'd still be working on it :-). That being said, one of the roles Shale will likely play is a proving ground for what sorts of functionality *should* be added in a JSF 2.0 type time frame. That lets the innovation and experimentation happen where it works best (in an open source environment) before APIs get locked down into a standard. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Wendy, thank you a lot for the help I ended up solving the problem using smart forwarding... it seemed a little better (and I must say, it worked faster hehe) anyways, I'll try the solution you gave so I'll know it the next time thank you On 8/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > > > > property="method"> > > > > Well, if it worked like the html:button, it would send the method with > the > > value from the bean. But it obviously doesn't. So, I put this js > function > > to > > be called onclick: > > > > function dispatchIt() > > { > > document.addColecaoForm.action= > "/AugeProducao/UpdateDeleteColecao.do?method= > > button.add"; > > document.addColecaoForm.submit(); > > } > > > > And that's causing the error. So, if the property=method doesn't work, > and > > passing it literally doesn't work... that means I cannot use links to > > submit > > the form? Or am I doing it totally wrong? > > You're on the right track... but I admit to just hardcoding the text value > for the > button. :) > > Change it to method=Add (or whatever the value is from > ApplicationResources.properties) and it should start working. From there, > you can figure out how to retrieve the value for the right locale. Without > actually trying it, I think possibly and (JSTL) and > then use an expression inside the script. > > -- > Wendy Smoak > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Letícia Álvares Barbalho [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
On 8/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote: > David Haynes wrote the following on 8/22/2005 3:57 PM: > > > public List getList() { > >List list = populateList(); > >return list; > > } > > > > The getList would be invoked during the jsp:useBean wouldn't it? > > > > I'm probably missing something obvious here, but this seems so much > > simpler. > > I would think that I should be able to do this easily without having to > use jsp:useBean? Heck, it seems like I'm taking two steps backwards > now:) Funny how with Struts the goal was to move 'away' from making any > calls to your business objects from the view. JSF seems to encourage > this? Trust me, I don't mind this - as long as it's clean and easy to > maintain. Sort of funny, though, that if someone proposed this on the > Struts list (having a JSP make a useBean call in order to get a List in > scope) people would have a cow. > I wouldn't suggest using at all in this scenario. Put the getList() method on your backing bean that contains the event handlers for that page, which would be registered as a managed bean (in request scope). Then, you can use value binding expressions to connect your components to the list values. The only thing I would do differently from David's example is put the populateList() call in prerender(), instead of in the getter method. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Well, if it worked like the html:button, it would send the method with the value from the bean. But it obviously doesn't. So, I put this js function to be called onclick: function dispatchIt() { document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method= button.add"; document.addColecaoForm.submit(); } And that's causing the error. So, if the property=method doesn't work, and passing it literally doesn't work... that means I cannot use links to submit the form? Or am I doing it totally wrong? You're on the right track... but I admit to just hardcoding the text value for the button. :) Change it to method=Add (or whatever the value is from ApplicationResources.properties) and it should start working. From there, you can figure out how to retrieve the value for the right locale. Without actually trying it, I think possibly and (JSTL) and then use an expression inside the script. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Wendy Smoak wrote the following on 8/22/2005 4:28 PM: Consider that Struts added services on top of Servlets and JSP... and now Shale is adding services on top of JSF. True. I keep forgetting the separation. I keep thinking JSF is to servlets/JSP as Struts is to servlets/JSP but I remember another post explaining how that really isn't the case. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
On 8/22/05, David Haynes <[EMAIL PROTECTED]> wrote: > > > Sorry to hi-jack this thread a bit, but I am confused. Can't the getter > methods be enhanced to call the data population methods to do what Rick > wants? By that I mean something like getList() containing a List which > is populated by a call to, say, populateList(). Sort of: > > public List getList() { > List list = populateList(); > return list; > } > > The getList would be invoked during the jsp:useBean wouldn't it? > > I'm probably missing something obvious here, but this seems so much simpler. > This would work (although you'd probably want to do some sort of in-request caching so you don't call populateList() more than once), but I tend to shy away from making getter and setter methods for properties have side effects like this. It's much clearer (well, to me anyway :-) when pulling data from the model is explictly called out in its own methods. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
From: "Rick Reumann" <[EMAIL PROTECTED]> Ok, I'll try this with Shale, although I'm really surprised the framework (JSF) doesn't take care of this for you by default? In struts it's so simple, I simply forward to an Action that populates my employees. Consider that Struts added services on top of Servlets and JSP... and now Shale is adding services on top of JSF. You can only get so much into a specification. ;) Some of it either has to wait for the next version, or just doesn't belong in there to begin with. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
David Haynes wrote the following on 8/22/2005 4:19 PM: I'm just fumbling my way through like most others... I can relate. Trust me you don't want me as your 'JSF running back' right now in JSF Fantasy Football. I've been fumbling in all my pre-season attempts at carrying the ball:) I think I'm averaging -20 yards/carry. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Rick Reumann wrote: David Haynes wrote the following on 8/22/2005 3:57 PM: public List getList() { List list = populateList(); return list; } The getList would be invoked during the jsp:useBean wouldn't it? I'm probably missing something obvious here, but this seems so much simpler. I would think that I should be able to do this easily without having to use jsp:useBean? Heck, it seems like I'm taking two steps backwards now:) Funny how with Struts the goal was to move 'away' from making any calls to your business objects from the view. JSF seems to encourage this? Trust me, I don't mind this - as long as it's clean and easy to maintain. Sort of funny, though, that if someone proposed this on the Struts list (having a JSP make a useBean call in order to get a List in scope) people would have a cow. Hey! Don;'t take what I say a gospel. I'm just fumbling my way through like most others... -david- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
David Haynes wrote the following on 8/22/2005 3:57 PM: public List getList() { List list = populateList(); return list; } The getList would be invoked during the jsp:useBean wouldn't it? I'm probably missing something obvious here, but this seems so much simpler. I would think that I should be able to do this easily without having to use jsp:useBean? Heck, it seems like I'm taking two steps backwards now:) Funny how with Struts the goal was to move 'away' from making any calls to your business objects from the view. JSF seems to encourage this? Trust me, I don't mind this - as long as it's clean and easy to maintain. Sort of funny, though, that if someone proposed this on the Struts list (having a JSP make a useBean call in order to get a List in scope) people would have a cow. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Craig McClanahan wrote the following on 8/22/2005 3:38 PM: Grab Shale. Make your backing bean implement ViewController. Stick the list setup logic in the prerender() method. Smile, knowing that this technique works not only for the welcome page, but for *any* page to which you navigate (in Struts Classic terms, this is the kind of thing that you use a Controller for in Tiles). :-) If you wanted to do it the hard way, you could set things up to register a phase listener, and call your list setup logic in a "before render response" event handler ... but that's the part Shale takes care of for you. Ok, I'll try this with Shale, although I'm really surprised the framework (JSF) doesn't take care of this for you by default? In struts it's so simple, I simply forward to an Action that populates my employees. I'm still trying to get a handle on all of this and it seems like things are done so many different ways that's it's quite confusing. Complicating matters of course is every example I'm finding seems to deal with more advanced features that I don't care about at this time - I don't want the bells and whistles yet, just the meat:). Making matter worse is that I do want to use Tiles. Bascially what I want is something very simple User goes to /webapp/index.jsp (or just /webapp - welcome file will be index.jsp) This ends up bringing the user to a page... /webapp/employees.jsp that looks like -- header (a tile) - | | menu | (tile)| { display a list of employees } | (body tile) | What is the standard way of accomplishing this in JSF? I'm looking at Geary's example in Core JSF with Tiles but that doesn't seem to help much in this case and I've been looking over the MyFaces tiles example. The former deals with Tiles in a more advanced example (nothing in the faces config) and the later deals with tiles where no business logic in any classes needs to take place. I guess I'll try all this first without using tiles. -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Craig McClanahan wrote: On 8/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote: Craig McClanahan wrote the following on 8/22/2005 12:50 PM: It doesn't ... if you want to fire the standard request processing lifecycle, you need to actually submit the request. Using will cause "/foo.jsp" to be rendered (assuming you are using the standard extension mappings), entering the JSF lifecycle at the Render Response phase. What problem are you trying to solve with that can't be solved a different way? What I'm trying to figure out is the best way to handle setting up an initial page when someone goes to the welcome page defined in web.xml (ie index.jsp). What's the best way to handle this? On page 20 of Core JSF they give the example of doing something like but I don't see how this would ever trigger a method in my backing bean? It won't. Only a form submit will trigger those method calls. Sorry to hi-jack this thread a bit, but I am confused. Can't the getter methods be enhanced to call the data population methods to do what Rick wants? By that I mean something like getList() containing a List which is populated by a call to, say, populateList(). Sort of: public List getList() { List list = populateList(); return list; } The getList would be invoked during the jsp:useBean wouldn't it? I'm probably missing something obvious here, but this seems so much simpler. -david- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Friday] [somewhat-ajax-related] XMLHttpRequest scoping problems
Jeff Beal wrote: req.onreadystatechange = function() { processResponse(req); } yeah, I think this is what I was looking for. Thanks. - Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: (ultra-newbie) Cannot forward to a JSP within WEB-INF
On 8/22/05, Glen Mazza <[EMAIL PROTECTED]> wrote: > redirect="true"/> > redirect="true"/> You are using redirects here, which causes the browser to make a second request to the new URL. It's not legal to make a request directly to a JSP page (or any other resource) inside the /WEB-INF directory; you have to use forwards instead. Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
(ultra-newbie) Cannot forward to a JSP within WEB-INF
Hello, I'm trying unsuccessfully, within an action-mapping, to forward to a UserQuery.JSP kept within the WEB-INF/pages folder of the web application. (I'm intentionally placing it there to prevent direct access of this jsp from the browser.) I'm getting a Tomcat 5.0.28 error as follows: "The requested resource (/myapp/WEB-INF/pages/UserQuery.jsp) is not available." (I've confirmed that the file is there.) My action mapping is as follows: redirect="true"/> redirect="true"/> I'm sure I'm making an obvious mistake here. Any enlightenment would be much appreciated. Thanks, Glen - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
On 8/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote: > Craig McClanahan wrote the following on 8/22/2005 12:50 PM: > > > It doesn't ... if you want to fire the standard request processing > > lifecycle, you need to actually submit the request. Using > > will cause "/foo.jsp" to be rendered > > (assuming you are using the standard extension mappings), entering the > > JSF lifecycle at the Render Response phase. > > > > What problem are you trying to solve with that can't be > > solved a different way? > > What I'm trying to figure out is the best way to handle setting up an > initial page when someone goes to the welcome page defined in web.xml > (ie index.jsp). What's the best way to handle this? On page 20 of Core > JSF they give the example of doing something like page="/index.faces"/> but I don't see how this would ever trigger a > method in my backing bean? > It won't. Only a form submit will trigger those method calls. > For example, in this sample CRUD app I was wanting to load a list of > employees right away that would show up on "employees.jsp" I'm keeping > this simple and will make this call to getEmployees in my > EmployeeBacking bean, but I'm unclear about the best using JSF to fire > this method and forward to the appropriate page when the user simply > goes to foobarApp/index.jsp ? Grab Shale. Make your backing bean implement ViewController. Stick the list setup logic in the prerender() method. Smile, knowing that this technique works not only for the welcome page, but for *any* page to which you navigate (in Struts Classic terms, this is the kind of thing that you use a Controller for in Tiles). :-) If you wanted to do it the hard way, you could set things up to register a phase listener, and call your list setup logic in a "before render response" event handler ... but that's the part Shale takes care of for you. > > Thanks for the help > > -- > Rick Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: messages help
Did you read this ? http://www.niallp.pwp.blueyonder.co.uk/HelpTagsErrorsAndMessages.html Especially the section 4.2 Using a Custom Key. HTH, Glenn "draegoon Z" <[EMAIL PROTECTED]> 22/08/2005 02:19 PM Please respond to "Struts Users Mailing List" To struts-user@jakarta.apache.org cc Subject messages help Sorry, but I've been reading archives all morning. Using Struts 1.2.7 Setting up a system to catch all errors/messages on a page. Getting the errors from my ActionForm: ActionErrors errors = new ActionErrors(); errors.add("system_name",new ActionError("errors.required",ar.getMessage("com.draegoonZ.social.label.system_name"))); return(errors); Getting the ???bad_key??? from my ActionForm: ActionMessages errors = new ActionMessages(); errors.add("system_name",new ActionMessage(ar.getMessage("com.draegoonZ.social.password.lookup.no_user_name"))); saveMessages(request,errors); return(mapping.getInputForward()); Results in: ???en_US.That username doesn't exist in our system. Please try again.??? Now I don't know what key it is telling me is missing, when it is displaying the value from my messages resource. I thought the problem was with using the property (system_name) instead of ActionMessages.GLOBAL_MESSAGE, but that gave the same results. Also, I want to use the property name, so I can display next to the input tag. A related question I have is: I read somewhere (this morning) that once html:message is read/accessed that it is removed/deleted. Is this true? How then could one list all the errors/messages at the top of a page, and then check for them to display next to the input tag? My jsp reads: <%-- check for errors --%> <%-- If not errors present... --%> <%-- check for messages (Globals.MESSAGE_KEY) --%> Thanx in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Rick Reumann wrote: Craig McClanahan wrote the following on 8/22/2005 12:50 PM: It doesn't ... if you want to fire the standard request processing lifecycle, you need to actually submit the request. Using will cause "/foo.jsp" to be rendered (assuming you are using the standard extension mappings), entering the JSF lifecycle at the Render Response phase. What problem are you trying to solve with that can't be solved a different way? What I'm trying to figure out is the best way to handle setting up an initial page when someone goes to the welcome page defined in web.xml (ie index.jsp). What's the best way to handle this? On page 20 of Core JSF they give the example of doing something like page="/index.faces"/> but I don't see how this would ever trigger a method in my backing bean? For example, in this sample CRUD app I was wanting to load a list of employees right away that would show up on "employees.jsp" I'm keeping this simple and will make this call to getEmployees in my EmployeeBacking bean, but I'm unclear about the best using JSF to fire this method and forward to the appropriate page when the user simply goes to foobarApp/index.jsp ? Thanks for the help If I understand you correctly, you have something like: index.jsp does a to foo.faces (a jsf page). If so, then I think the backing bean is invoked in foo.faces when the is referenced. So, the backing store bean is already created *before* the foo.faces is rendered to the browser. At least, that's the way it is working for me... As a quick test, you could create a test foo.faces that contains: The bean has this: and have the bean something simple like: public class FooBean { priviate String string = "foo"; public FooBean() { super(); } public String getString() { return string; } public void setString(String string) { this.string = string; } } -david- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Michael Jouravlev wrote the following on 8/22/2005 2:41 PM: David Geary advised me to use "rendered" attribute of view of subview, like this: You can stick whatever code you want into the method, and simply return true. I don't know is there a better way to do this. So you would stick something like this on the index.jsp page? Ok I'll try that, thanks. Maybe too soon for one, but is there a JSF 'best practices' out there somewhere? -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Well, I should be embarrassed by now. Actually, you're 100% correct: something is sending literally 'button.delete' as the value of method param, instead of the value from the .properties file. And this something would be me. It happens that I am not using html:submit buttons to call the dispatch action. Instead of it, I'm trying to use links, like this: Well, if it worked like the html:button, it would send the method with the value from the bean. But it obviously doesn't. So, I put this js function to be called onclick: function dispatchIt() { document.addColecaoForm.action="/AugeProducao/UpdateDeleteColecao.do?method= button.add"; document.addColecaoForm.submit(); } And that's causing the error. So, if the property=method doesn't work, and passing it literally doesn't work... that means I cannot use links to submit the form? Or am I doing it totally wrong? Sorry, thanks. On 8/22/05, Wendy Smoak <[EMAIL PROTECTED]> wrote: > > > I'm trying to call a LookupDispatchAction from a link, and I'm getting > > the error above. I'd like you to help me find the reason... > > It looks like something is sending (literally) 'button.delete' as the > value > of the 'method' param, instead of using value from > ApplicationResources.properties. > > What HTML does this turn into? > > > > > > > > > Assuming your properties file is in place and properly configured, that > should work. > > -- > Wendy Smoak > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Letícia Álvares Barbalho [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
David Geary advised me to use "rendered" attribute of view of subview, like this: You can stick whatever code you want into the method, and simply return true. I don't know is there a better way to do this. Michael. On 8/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote: > What I'm trying to figure out is the best way to handle setting up an > initial page when someone goes to the welcome page defined in web.xml > (ie index.jsp). What's the best way to handle this? On page 20 of Core > JSF they give the example of doing something like page="/index.faces"/> but I don't see how this would ever trigger a > method in my backing bean? > > For example, in this sample CRUD app I was wanting to load a list of > employees right away that would show up on "employees.jsp" I'm keeping > this simple and will make this call to getEmployees in my > EmployeeBacking bean, but I'm unclear about the best using JSF to fire > this method and forward to the appropriate page when the user simply > goes to foobarApp/index.jsp ? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
Craig McClanahan wrote the following on 8/22/2005 12:50 PM: It doesn't ... if you want to fire the standard request processing lifecycle, you need to actually submit the request. Using will cause "/foo.jsp" to be rendered (assuming you are using the standard extension mappings), entering the JSF lifecycle at the Render Response phase. What problem are you trying to solve with that can't be solved a different way? What I'm trying to figure out is the best way to handle setting up an initial page when someone goes to the welcome page defined in web.xml (ie index.jsp). What's the best way to handle this? On page 20 of Core JSF they give the example of doing something like page="/index.faces"/> but I don't see how this would ever trigger a method in my backing bean? For example, in this sample CRUD app I was wanting to load a list of employees right away that would show up on "employees.jsp" I'm keeping this simple and will make this call to getEmployees in my EmployeeBacking bean, but I'm unclear about the best using JSF to fire this method and forward to the appropriate page when the user simply goes to foobarApp/index.jsp ? Thanks for the help -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
I'm trying to call a LookupDispatchAction from a link, and I'm getting the error above. I'd like you to help me find the reason... It looks like something is sending (literally) 'button.delete' as the value of the 'method' param, instead of using value from ApplicationResources.properties. What HTML does this turn into? Assuming your properties file is in place and properly configured, that should work. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
messages help
Sorry, but I've been reading archives all morning. Using Struts 1.2.7 Setting up a system to catch all errors/messages on a page. Getting the errors from my ActionForm: ActionErrors errors = new ActionErrors(); errors.add("system_name",new ActionError("errors.required",ar.getMessage("com.draegoonZ.social.label.system_name"))); return(errors); Getting the ???bad_key??? from my ActionForm: ActionMessages errors = new ActionMessages(); errors.add("system_name",new ActionMessage(ar.getMessage("com.draegoonZ.social.password.lookup.no_user_name"))); saveMessages(request,errors); return(mapping.getInputForward()); Results in: ???en_US.That username doesn't exist in our system. Please try again.??? Now I don't know what key it is telling me is missing, when it is displaying the value from my messages resource. I thought the problem was with using the property (system_name) instead of ActionMessages.GLOBAL_MESSAGE, but that gave the same results. Also, I want to use the property name, so I can display next to the input tag. A related question I have is: I read somewhere (this morning) that once html:message is read/accessed that it is removed/deleted. Is this true? How then could one list all the errors/messages at the top of a page, and then check for them to display next to the input tag? My jsp reads: <%-- check for errors --%> footer="errors.footer"> <%-- If not errors present... --%> <%-- check for messages (Globals.MESSAGE_KEY) --%> header="errors.header" footer="errors.footer"> Thanx in advance. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: displaying JSP errors on screen
Hi Ulrich, Indeed i do use tiles. I haven't tried a pure jsp as all my pages always descend from some base.jsp which is defined in my tiles-defs. Hmm, but this is something I can work with. Never thought that it could be the tiles plugin... Perhaps some property I can set in the definition or the JspException is silently catched.. I'll get back to you.. thanks, Martijn Ulrich Elsner wrote: Hi, are you using tiles as well? I experienced the same problem some time ago, but only in tile-based .jsp, not in 'pure' jsp. I could not pinpoint the exact time when this started since I wasn't working on the display part at that time but one of the bigger changes I did shortly before I noticed this was the switch from 1.1 to 1.2.4. After some time I got used to looking in the console for problems so eventually I just stopped looking for the reason. Sorry that I can offer no help, but it might console you to know that others have the same problem. Ulrich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- 31.69 nHz = once a year - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Action[/UpdateDeleteColecao] missing resource 'button.delete' in key method map
Hey guys, how's everything? I'm trying to call a LookupDispatchAction from a link, and I'm getting the error above. I'd like you to help me find the reason... my jsp is like this: <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> <[EMAIL PROTECTED] uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%> <%@ page import="auge.conexao.ColecaoService" %> <%@ page import="java.util.*" %> <[EMAIL PROTECTED] contentType="text/html"%> <[EMAIL PROTECTED] pageEncoding="UTF-8"%> http://www.w3.org/TR/html4/loose.dtd";> Coleção Coleção Coleção Descricão My action is like: package auge.action; import java.util.Map; import java.util.HashMap; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import javax.servlet.ServletException; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.actions.LookupDispatchAction; import org.hibernate.HibernateException; import auge.conexao.ColecaoService; import auge.bean.Colecao; import auge.form.AddColecaoForm; public class UpdateDeleteColecaoAction extends LookupDispatchAction { protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.add", "update"); map.put("button.delete", "delete"); return map; } public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { AddColecaoForm addColecaoForm = (AddColecaoForm) form; Colecao colecao; try { Long colec = Long.valueOf(request.getParameter("colecao")); colecao = ColecaoService.getInstance().getColecao(colec); } catch (Exception e){ colecao = new Colecao(); } if (addColecaoForm.getDescricao() != null) { colecao.setDescricao(addColecaoForm.getDescricao()); colecao.setColecao(addColecaoForm.getColecao()); ColecaoService.getInstance().updateColecao(colecao); addColecaoForm.clear(); return mapping.findForward("success"); } } catch(Exception e){ return mapping.findForward("error"); } return mapping.findForward("error"); } public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { AddColecaoForm addColecaoForm = (AddColecaoForm) form; Long colec = Long.valueOf(request.getParameter("colecao")); Colecao colecao = ColecaoService.getInstance().getColecao(colec); try { ColecaoService.getInstance().delColecao(colecao); } catch(HibernateException e){ // nada a fazer } addColecaoForm.clear(); } catch(Exception e){ return mapping.findForward("error"); } finally{ return mapping.findForward("success"); } } } and my struts-config: does anyone know why I'm getting this error? I'd appreciate any help. Thanks. -- Letícia Álvares Barbalho [EMAIL PROTECTED]
Re: displaying JSP errors on screen
Hi, are you using tiles as well? I experienced the same problem some time ago, but only in tile-based .jsp, not in 'pure' jsp. I could not pinpoint the exact time when this started since I wasn't working on the display part at that time but one of the bigger changes I did shortly before I noticed this was the switch from 1.1 to 1.2.4. After some time I got used to looking in the console for problems so eventually I just stopped looking for the reason. Sorry that I can offer no help, but it might console you to know that others have the same problem. Ulrich - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JSF] using a jsp:forward to get to backing bean method?
On 8/22/05, Rick Reumann <[EMAIL PROTECTED]> wrote: > I'm looking in my Core JSF book and I can seem to find out how to do > something that I would think would/should be pretty simple... > > How do I use a jsp:forward to trigger a method in my backing bean? > > > > I see how JSF uses h:commandLink for it's link but not sure how this > helps with JSP forwards. > It doesn't ... if you want to fire the standard request processing lifecycle, you need to actually submit the request. Using will cause "/foo.jsp" to be rendered (assuming you are using the standard extension mappings), entering the JSF lifecycle at the Render Response phase. What problem are you trying to solve with that can't be solved a different way? Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[JSF] using a jsp:forward to get to backing bean method?
I'm looking in my Core JSF book and I can seem to find out how to do something that I would think would/should be pretty simple... How do I use a jsp:forward to trigger a method in my backing bean? I see how JSF uses h:commandLink for it's link but not sure how this helps with JSP forwards. thanks -- Rick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: displaying JSP errors on screen
Hi Frank, Thanks for your time. In fact the 'errors' I expect are mostly tags where the expected object cannot be found in any of the scopes. I used to get those "javax.servlet.jsp.JspException: Cannot find bean xyz in any scope" in my browser but since I switched to 1.2.x they are all silent and I only see them in my Eclipse console. Which is quite ok, but this is itching for some time now. Could be I'm barking up the wrong tree here and forgot to define a valve/logger/whatever in my context of overlooked some 'tinkering' at another config file which accidentally slipped in all my new projects... regards, Martijn Frank W. Zammetti wrote: Hi Martijn, Struts doesn't inherently do anything (that I'm aware of at least) to stop JSP errors from being displayed in the browser... in fact it's kind of unlikely it could since it's more or less out of the picture by the time the JSP is executing (taglib code notwithstanding). Has anything else changed that could cause this? Anything having to do with JSP error page or something like that? And, a slightly more pointed question :) ... are you sure the errors you expect to see in the browser are really errors in the JSP? Generally-speaking, runtime JSP errors are rare (they certainly should be), and I'm assuming that's what we're talking about here rather than compile-time errors. -- 31.69 nHz = once a year - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Validator's indexedListProperty
Hi, I've been playing with the indexedListProperty to validate what a user has selected in my forms. The problem I am having is that when an error message gets returned, It does not get associated with the form element ( in my case). I think the problem is that the message comes back with a key of test[x] where x is the index of the error. If I just print out my error messages like this I can see the error message, but doesn't show anything. It seems like the tag should have an indexedListProperty parameter as well so I can display my error messages correctly. What am i missing? Regards, josh cronemeyer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
within -- problem
Hi all, I have a where I am iterating over a list of objects. Each object has a property label, which is being displayed as a textbox. Now, I have a hidden field hdnField, for each row of object. I want to call a javascript function fnUpdate onChange of the textbox to update the hidden field. So, I need to pass the index (row number) of the particular row to the javascript function, so that, the particular hidden field for the particular row can be updated. I am trying something as follows: ');/> (The above code snippet is also in the attached .txt file, in case there is a problem in reading). But it is not identifying indxFunc for nested:text in . It works fine for static tags like or in , eg. ');" /> Any way to solve the problem? A work-around is to update the hidden field in each row just before submitting the form. But I was wondering if the problem can be solved the way I am trying. Thanks for your time, Anjishnu. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ');/> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:form not generating name="" attribute
On Saturday at 9:36am, DB=>Don Brown <[EMAIL PROTECTED]> wrote: DB> Ok, I looked at the 1.2.7 source, and indeed, it doesn't generate an DB> "id" or"name" if xhtml mode is on. You are correct, the styleId is a DB> good workaround, especially if you use the commons-validator checked DB> out from trunk. DB> DB> Don This is fixed in subverion: http://issues.apache.org/bugzilla/show_bug.cgi?id=35127 and needs to be used with commons validator (latest subversion as well). -- Haroon Rafique <[EMAIL PROTECTED]> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Debug easier
Why not just use a debugger? There are several very good free debuggers available - netbeans, eclipse, jedit, ... Simple to set up, and a bit less "predictive" to use. (By that, I mean instead of trying to log what you think the problem might be, you can examine it as it is running to SEE what the problem really is.) Larry On 8/21/05, C.F. Scheidecker Antunes <[EMAIL PROTECTED]> wrote: > Hello all, > > If I have a System.out.Println() statement on my Struts code where would > that be written to? > > I would like to write stuff to either the console or the Tomcat log text > file. How can I achieve that? > > System.out.println() does not seem to be doing anything. > > I want to know what it is going on at run time to make it easier to > debug stuff. > > Any suggestions? > > Thanks, > > C.F. > > > - > 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: [Friday] [somewhat-ajax-related] XMLHttpRequest scoping problems
I haven't actually tried having multiple simultaneous requests with this, but it's not using the global namespace, so it should work: submitRequest("../yourURL.html",processResponse); function submitRequest(url,handler) { var req = null; if (window.XMLHttpRequest) { // Non-IE browsers req = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE req = new ActiveXObject("Microsoft.XMLHTTP"); } req.onreadystatechange = function() { processResponse(req); } req.open("GET",url,true) req.send(); } function processResponse(asyncRequest) { if (asyncRequest.readyState == 4 && asyncRequest.status == 200) { alert(asyncRequest.responseText); } } On 8/19/05, David Durham <[EMAIL PROTECTED]> wrote: > Hi -- > > There's been some traffic on this list involving XMLHttpRequests and > javascript, and since it's Friday ... > > My problem: How to use multiple asynchronous requests simultaneously > without using the global namespace. For instance, I'd like to create a > little DirectoryTree widget that I can drop in pages like so: > > > new DirectoryTree("some_directory_name"); > > > Ideally, I could drop as many of these widgets on the page as I want. > > Then I have some javascript like so: > > DirectoryTree = function(directory, url) { > //setup > ... > execute(url, DefaultCallback); > } > > Here's an execute method that supposed to trigger some kind of action: > > execute(url, callback) { > var cb = new callback(); > cb.request = new XMLHttpRequest(); > cb.request.onreadystatechange = callback.processResponse; > cb.request.open(this.METHOD, url, this.ASYNC); > cb.request.send(null); > } > > DefaultCallback = function() { > this.request = null; > > function processResponse() { > log.info("decorating: " + this.request); > } > } > > > The processResponse() method alerts: "decorating: undefined". I even > tried: > > DefaultCallback = function() { > this.request = null; > } > > DefaultCallback.processResponse = function() { > log.info("decorating: " + this.request); > } > > and got the same result. > > I'm somewhat experienced with Javascript and it's OO concepts and event > handling, but not terribly so. I think what's happening here is that on > readystate change triggers the creation of a new > 'DefaultCallback.processResponse' object and therefore a new scope with > no concept of the 'var cb = new callback()' scope. Therefore, in order > to get at the xmlrequest/response, I need to go through the global > namespace or some other static-like namespace, which I don't really want > to do because I'd like to avoid managing, say a queue of xml http > requests. I haven't looked through the xml http request stuff that was > posted to struts sandbox (I think it's in sandbox, not really sure), but > does anyone have ideas on this one, or can point me to some code or info > with solution(s)? > > > - Dave > > - > 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: LookupDispatchAction-problem getting started
From: "Tiller, Volker" <[EMAIL PROTECTED]> I can't get started with the example about using LookupDispatchAction of Ted Husted, Tip #3 (http://husted.com/struts/tips/index.html). What is my error or can I get some working code ? The 'method' parameter should be set to the _value_ from ApplicationResources.properties (not the key). I'm not sure how to encode the spaces to do this manually, maybe method=add+it+all or method=add%20it%20all. Or maybe the spaces will just work. (It's early...) Here's what happens: - the framework sees "add it all" as the value of the 'method' parameter - it figures out that 'add it all' came from the 'button.add' property - looks up 'button.add' in the keyMethodMap and finds 'add' - calls the 'add' method in your Action (Naming the parameter something other than 'method' may make things clearer-- maybe 'choice'.) HTH, -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dynamic forward path?
thanks for this idea; I implemented it the way you suggested - with this solution everything is still configurable through the struts-config file as you are stating below ... thanks a lot, karin. Laurie Harper wrote: Karin Schellner wrote: I am new to Struts and would appreciate your ideas for a solution to the following problem: In my webapplication I have a login-form with a submit and cancel button. When the user clicks the cancel-button I would like to return him to the page he previously visited (before calling the page with the login-form). Using a forward in the action-mapping would redirect the user always to the same page (e.g. welcome.do), therefore I was thinking of storing the last visited page in the session and use it for a redirect, but then I would bypass the struts-config ... what do you think? Is there a possibility to achieve this in Struts? The second option is the one you want. There's no way you can statically define a forward in struts-config that points to 'the page the user was on before this one'. What you could do, though, is create a ReturnToPreviousPage action which redirects to the URL you stored in the session and have an action forward in struts-config pointing to that action. You still have to keep track of where that action should redirect to yourself (though the session or whatever). The advantage is that your struts-config is still declaratively declaring the behaviour -- and you can then change the behaviour (e.g. to always forward to the application home page instead of the previous page) by modifying the config. You also get the option to re-use the ReturnToPreviousPage action anywhere else you need the same behaviour. HTH, L. -- DI Karin Schellner Research Studios Austria - Digital Memory Engineering ARC Seibersdorf research GmbH Thurngasse 8/20, A-1090 Wien M. +43.664.825-1105 T. +43.1.585-0537 F. +43.1.585-3741 http://dme.researchstudio.at - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [SHALE] Simple "getting started"-type question
Thanks to both of you, that definitely helped. I'm going to go read a tutorial or two now... I actually have in the past, and also saw some code-intensive demos at two user group meetings, so I thought I had at least the JSF basics in my brain already... as it turns out, that might not be quite true :) And in any case, this is the first attempt I've made at actually getting hands-on. Frank David G. Friedman wrote: Frank, I hate to try to answer a question after Craig, but from my JSF newbie point of view, I didn't get an answer I'd want from his letter. So, here's my try to help answer your questions. Just keep in mind I'm re-reading (2nd time around) a JSF book so I'm no authority. MyFaces, JSF actually, doesn't care about action mappings, like Struts does. When a url comes in which maps to JSF (or Myfaces) such as a *.faces URL, JSF looks for a file matching that url but ending in .jsp, not .faces. That's how /usecases.faces maps automatically to /usecases.jsp. Why does it do that? The mapping of *.faces allows MyFaces/JSF to do the JSF tricks listed in the jsp file which could include bean auto-population, page redirects, validations, navigations, callback functions, templates, etc. A tree is made of the JSF components from that page so further visits to that page don't require a rull re-parse of the page. In my opinion, JSF navigation seems to care more about the direction of where to navigate next than how to come into a page. You'll see loads of those 'where to next' ideas in the faces-config.xml file as 'navigation-rule' sections. A few useful tidbits of knowledge: 1. Everything JSF starts inside the f:view tags. 2. The *.faces don't have to map to *.jsp extension files. A servlet container configuration parameter allows you to specify the default extension to use so you could use something other than *.jsp for your actual files. You can also change your incoming *.faces URL mapping to *.html to hide the fact that you're using JavaServer Faces. 3. JSF can be sufficiently complicated to 'look at' if you haven't read a JSF tutorial or book so jumping into Shale could be even more confusing. Shale confuses me some and I've read a JSF book once (I'm on read #2 as I mentioned). 4. There are plenty of JSF tutorials at www.jsftutorials.net. (I've read a few of them, I'm reading about Facelets now - kind of a 'Shale Clay' alternative.) This includes a section on their front page entitled: Golden Collection for JSF Newbies. 5. navigation-rules got a little confusing for me when looking at JSF with Tiles, especially with Shale's Tiles mapper. I think it (Shale's Tile mapper) looks for a tile with a name very similar to the jsp name and if one isn't found, it skips tiles and looks for a regular jsp instead. Craig could comment on that if I'm wrong or off slightly but I think I just read about that last week. 6. In case you need it, myfaces is at http://myfaces.apache.org. Tomahawk if the name of their set of custom add-on components, which you don't need if you are trying out JSF. You can just use the MyFaces (non-Tomahawk stuff) implementation of JavaServer Faces. Regards, David -Original Message- From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] Sent: Monday, August 22, 2005 12:53 AM To: Struts User Subject: [SHALE] Simple "getting started"-type question Hi everyone, I'm finally getting a little bit of time to look at Shale, with the intent of doing the Mailreader app under it as I offered to do a few weeks back... although I was thinking of writing a blog app instead since I wanted to re-do mine anyway, but that is neither here nor there :) I'm looking at the use cases app, as that seemed like the logical place to begin... there's quite a bit in there, it's a bit overwhelming to start, and, after just a few minutes of browsing, I have a question already :) Looking at index.jsp, I see a forward to usecases.faces. My question is, where is that mapping defined? It's obviously winding up at usecases.jsp, and I can see that .faces is mapped to FacesServlet in web.xml, so it's straight-forward to an extent, but I'm not seeing in the config files were something akin to a Struts path to /usecases is defined. I assumed it would be in faces-config.xml, but unless I'm really missing something, it's not (by the way, I *DO* assume I'm missing something there!). Thanks! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: displaying JSP errors on screen
Hi Martijn, Struts doesn't inherently do anything (that I'm aware of at least) to stop JSP errors from being displayed in the browser... in fact it's kind of unlikely it could since it's more or less out of the picture by the time the JSP is executing (taglib code notwithstanding). Has anything else changed that could cause this? Anything having to do with JSP error page or something like that? And, a slightly more pointed question :) ... are you sure the errors you expect to see in the browser are really errors in the JSP? Generally-speaking, runtime JSP errors are rare (they certainly should be), and I'm assuming that's what we're talking about here rather than compile-time errors. -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Martijn Smit wrote: Hello list, Since I've upgraded struts a while back all my JSP generated errors are only seen at the console. How do tinker my config so that I see een JSP error in my browser once more? I'm sorry to ask this question here, bus since the terms of my question are somewhat 'generic' I'm not finding any answers... Thanks in advance, Martijn - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
displaying JSP errors on screen
Hello list, Since I've upgraded struts a while back all my JSP generated errors are only seen at the console. How do tinker my config so that I see een JSP error in my browser once more? I'm sorry to ask this question here, bus since the terms of my question are somewhat 'generic' I'm not finding any answers... Thanks in advance, Martijn -- 31.69 nHz = once a year - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LookupDispatchAction-problem getting started
Hi all, I can't get started with the example about using LookupDispatchAction of Ted Husted, Tip #3 (http://husted.com/struts/tips/index.html). What is my error or can I get some working code ? This is the problem: The forward test it gets ERROR DispatchAction:220 - Request[/test] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text. Altering the global forward 'testit' to gets javax.servlet.ServletException: Action[/test] missing resource 'button.add' in key method map org.apache.struts.actions.LookupDispatchAction.getLookupMapName(LookupDispatchAction.java:240) org.apache.struts.actions.LookupDispatchAction.getMethodName(LookupDispatchAction.java:281) org.apache.struts.actions.LookupDispatchAction.execute(LookupDispatchAction.java:158) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) + This is the code +++Action public final class MyAction extends LookupDispatchAction { private static Log log = LogFactory.getLog(MyAction.class); protected Map getKeyMethodMap() { Map map = new HashMap(); map.put("button.add", "add"); map.put("button.delete", "delete"); return map; } public ActionForward add(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do add log.info("--- in add()"); return mapping.findForward("success"); } public ActionForward delete(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // do delete log.info("--- in delete()"); return mapping.findForward("success"); } } +++Form: public final class MyForm extends ActionForm { private String prop; public String getProp() { return prop; } public void setProp(String prop) { this.prop = prop; } } +++JSP: /tiles/test.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ include file="taglibs.jsp"%> test LookupDispatchAction... +++application.properties: button.add=add it all button.delete=delete it all +++struts-config ++ Thanks, Volker. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]