Re: Error messages
--- On Wed, 9/10/08, Cosmin Marginean wrote: Is there a way to check if a certain field error has been set? In S2 use ValidationAware's getFieldErrors(...) method. http://struts.apache.org/2.0.11.2/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html#getFieldErrors() Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error messages
Sorry for the misunderstanding - might not have been so clear. I meant performing some logic in the JSP. I would like to be able to do something like: td c:if test=${an error for field 'xxx' exists} class=someErrorClass /c:if --- On Wed, 9/10/08, Cosmin Marginean wrote: Is there a way to check if a certain field error has been set? In S2 use ValidationAware's getFieldErrors(...) method. http://struts.apache.org/2.0.11.2/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html#getFieldErrors() Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Cosmin Marginean -- cosminaru.ro - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error messages
--- On Wed, 9/10/08, Cosmin Marginean wrote: Sorry for the misunderstanding - might not have been so clear. I meant performing some logic in the JSP. I would like to be able to do something like: td c:if test=${an error for field 'xxx' exists} class=someErrorClass /c:if ... In that case, use ValidationAware's getFieldErrors(). s:if test=getFieldErrors('xxx') != null class=someErrorCalss /s:if (Syntax may be off.) Dave --- On Wed, 9/10/08, Cosmin Marginean wrote: Is there a way to check if a certain field errorhas been set? In S2 use ValidationAware's getFieldErrors(...) method. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error messages
depends on if you want JS validation action validation ajax validation explained at http://struts.apache.org/2.x/docs/ajax-validation.html HTH Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Wed, 10 Sep 2008 14:06:28 +0300 From: [EMAIL PROTECTED] To: user@struts.apache.org Subject: Error messages Hello everyone, I am trying to provide some custom validation error handling in a JSP. For this I would like to perform some logic in the JSP when a validation fails, instead (or in addition) of displaying the actual error message. Is there a way to check if a certain field error has been set? Thanks in advance, Cosmin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ See how Windows connects the people, information, and fun that are part of your life. http://clk.atdmt.com/MRT/go/msnnkwxp1020093175mrt/direct/01/
Re: Error messages is repeated Using Struts 2 Annotation validation
The documentation covers using images in submit buttons. http://struts.apache.org/2.0.11/docs/submit.html * input: renders as html input type=submit... * image: renders as html input type=image... * button: renders as html button type=submit... s:submit type=image src=whatever.gif/ Regards, Randy Burgess Sr. Web Applications Developer Nuvox Communications From: Johnson nickel [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org Date: Tue, 29 Jan 2008 23:28:42 -0800 (PST) To: user@struts.apache.org Subject: Re: Error messages is repeated Using Struts 2 Annotation validation Thanks for your quick response, In my Login.jsp, s:textfield name=username label=UserName / s:password name=spassword label=Password / input type=image src=../images/Login.gif value=Login Instead of using s:submit value=Login/, I used html image tag . If i used s:submit it works fine. newton.dave wrote: --- Johnson nickel [EMAIL PROTECTED] wrote: @RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName=username,messag e=UserName is required) For a string field you'll probably want to use the @RequiredStringValidator: a text field will return an empty string, whereas @RequiredFieldValidator only checks for null-ness (different from blank-ness). Same as For password also , *Exactly* the same? (You put the right fieldName for the password field, right?) When i have submit the Login button, the Error messages is displaying Repeated. You'll need to provide some JSP and possibly configuration in order to help diagnose the problem. Where are the duplicated messages appearing? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Error-messages-is-repeated-Using-Struts-2-Annotation-val idation-tp15157319p15176802.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error messages is repeated Using Struts 2 Annotation validation
Hi, Something simillar happens to me when i started with Struts 2. I use appfuse and I realized that a message displays just above the field I'd validated, and where I included a messages.jsp (this jsp displays the action and error messages), usually at the top of the html page. To solve this I supressed the field messages (those that are displayed above the field) rewriting the tag templates. Struts gives you the chance to override the templates they provide. I created a tree at WEB-INF level just like they are in the struts2-core library (template/css_xhtml/...). The files you put there will overwrite the Struts2 ones, and change the default behaviour of the tags. Regards. Johnson nickel wrote: Hi Friends, I am using Struts 2 application for my project. Before I was used Struts 1 when compare to this Struts 2 is reduced lot of configuration problems. I have use the Annotation validation to validate the Username and password fields in my Login page. Code: @RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName=username,message=UserName is required) public String getUsername() { return username; } Same as For password also , When i have submit the Login button, the Error messages is displaying Repeated. I have spend lot of time on this issue. Can u anybody give me the solution. Thanks and Regards, Johnson -- View this message in context: http://www.nabble.com/Error-messages-is-repeated-Using-Struts-2-Annotation-validation-tp15157319p15160651.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error messages is repeated Using Struts 2 Annotation validation
--- Johnson nickel [EMAIL PROTECTED] wrote: @RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName=username,message=UserName is required) For a string field you'll probably want to use the @RequiredStringValidator: a text field will return an empty string, whereas @RequiredFieldValidator only checks for null-ness (different from blank-ness). Same as For password also , *Exactly* the same? (You put the right fieldName for the password field, right?) When i have submit the Login button, the Error messages is displaying Repeated. You'll need to provide some JSP and possibly configuration in order to help diagnose the problem. Where are the duplicated messages appearing? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error messages is repeated Using Struts 2 Annotation validation
Thanks for your quick response, In my Login.jsp, s:textfield name=username label=UserName / s:password name=spassword label=Password / input type=image src=../images/Login.gif value=Login Instead of using s:submit value=Login/, I used html image tag . If i used s:submit it works fine. newton.dave wrote: --- Johnson nickel [EMAIL PROTECTED] wrote: @RequiredFieldValidator(type=ValidatorType.SIMPLE,fieldName=username,message=UserName is required) For a string field you'll probably want to use the @RequiredStringValidator: a text field will return an empty string, whereas @RequiredFieldValidator only checks for null-ness (different from blank-ness). Same as For password also , *Exactly* the same? (You put the right fieldName for the password field, right?) When i have submit the Login button, the Error messages is displaying Repeated. You'll need to provide some JSP and possibly configuration in order to help diagnose the problem. Where are the duplicated messages appearing? Dave - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Error-messages-is-repeated-Using-Struts-2-Annotation-validation-tp15157319p15176802.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error messages doesn't appear if validate is called programatically
Thank you very much Paul. It was a big time save for me. Regards Hakan Paul Benedict [EMAIL PROTECTED] 20/01/2006 04:07 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: error messages doesn't appear if validate is called programatically Hakan, You need to store the error messages in the request or session after you retrieve them: ActionErrors errors = form.validate(); if ((errors != null) !errors.isEmpty()) { saveErrors(request, errors); return mapping.getInputForward(); } Paul __ 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] This email may contain privileged/confidential information. You may not copy or disclose this email to anyone without the written permission of the sender. If you have received this email in error please kindly delete this message and notify the sender. Opinions expressed in this email are those of the sender and not necessarily the opinions of the employer. This email and any attached files should be scanned to detect viruses. No liability will be accepted by the employer for loss or damage (whether caused by negligence or not) as a result of email transmission.
Re: error messages doesn't appear if validate is called programatically
Hakan, You need to store the error messages in the request or session after you retrieve them: ActionErrors errors = form.validate(); if ((errors != null) !errors.isEmpty()) { saveErrors(request, errors); return mapping.getInputForward(); } Paul __ 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: Error messages in login page doesn't show up
I solved it, removing redirect=true from the action-mapping tag in struts-config.xml solved it. Ian. On 6/8/05, Ian van der Neut [EMAIL PROTECTED] wrote: Hello all, I have a little problem with displaying an Invalid login message on my login page. I am using tomcat 5.0.28 and struts 1.2.4 I have a login.jsp that looks like this: html:form action=login !-- table stuff mostly snipped -- tdbean:message key=logon.title//td tdbean:message key=logon.username//td tdhtml:text property=userName value= //td tdbean:message key=logon.password//td tdhtml:password property=password value= //td div align=righthtml:submit property=submit bean:message key=logon.button.label/ /html:submit /html:form html:errors/ In my ActionForm, the validate method looks like this: public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (userName == null || userName.length() == 0) { errors.add(username, new ActionMessage(errors.username.required)); } if (password == null || password.length() == 0) { errors.add(password, new ActionMessage(errors.password.required)); } return errors; } When I leave username or password fields empty, I get the proper error messages as I expect, however, in my Action class LoginAction I have the following code to handel illegal logins: if (user != null) { fwd = mapping.findForward(SUCCESS); session.setAttribute(userName, userName); session.setAttribute(user, user); } else { ActionMessages errors = new ActionMessages(); errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(errors.invalidlogin)); saveMessages(request, errors); fwd = mapping.findForward(ERROR); log.info(userName + tried to login with invalid credentials.); } I have the errors.invalidlogin in application.properties file: errors.invalidlogin=Invalid username and password combination. (Other messages in that file are displayed properly, so the file is read and found by struts and the servlet container.) My struts-config.xml has these relevant tags: form-beans form-bean name=LoginForm type=my.package.LoginForm / !-- others snipped -- /form-beans action path=/login type=my.package.LoginAction name=LoginForm scope=session input=/login.jsp forward name=success path=/Welcome.do redirect=true / forward name=error path=/login.jsp redirect=true / /action Does anybody have a clue as to what I am doing wrong? As far as I can see, I'm doing everything the way it is described in the jakarta o'reilly book (Cavaness). Thank you all very much in advance for any input, Ian. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error Messages from the Database - Simple method?
Thank you. This is something I havent gotten to yet (trying to talk the client ouf ot if given the time contraints, of course) but thank you. I will no doubt make use of it!! On 4/14/05, David Johnson [EMAIL PROTECTED] wrote: -- Forwarded message -- From: Fogleson, Allen [EMAIL PROTECTED] Date: Apr 13, 2005 9:18 PM Subject: RE: Error Messages from the Database - Simple method? To: [EMAIL PROTECTED] David, I think I replied to this, but I released a more generalized version of the two reloadable message resources on sourceforge. (struts apps) The main improvements here are ease of development of new types of message resources. (I have not moved this over to commons-resources as the superclasses yet by the way so it is workable with struts 1.2x) Mainly now, to implement a reloadable message resource you subclass my BaseReloadableMessageResource and supply 2 methods 1) parseConfig(...) which will know what to do with the config passed from the factory. 2) getMessagesAsProperties() which returns a properties file containing all the messages for a particular locale. This would make it rather simple for you to partition messages between a DB and a properties file and you can enforce whatever ordering you desire. (i.e. all general messages come from the DB which can be changed by admins or whatever, and error messages come from a properties file so that the replacement arguments aren't mucked up) or vice versa or whatever. All of the caching/reloading, is determined by a timeout that can either be hardcoded and supplied to the superclass, or can be a part of the configuration. To load from different sources would be relatively simple, you devise some type of configuration that you can parse. And then load the messages from the appropriate resource type (file,db,etc) based on your scheme. You can grab the source or binary from the sourceforge site at: http://sourceforge.net/projects/struts/ The files are in reloadable message resources. Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 3:13 PM To: Fogleson, Allen Subject: Re: Error Messages from the Database - Simple method? ahh so inside your factory is where you're connecting to your database for the sole purpose of populating the messages hashmap? I suppose you looked at the default implementation to see that variable you're meant to be populating, huh? I also notice that this is an all or none thing... meaning errors AND messages in general now have to be in the DB (if I go this route) Thank you so much for the assistance. :) On Apr 7, 2005 4:06 PM, Fogleson, Allen [EMAIL PROTECTED] wrote: David, Correct, although I believe you can extend o.a.s.u.PropertyResources for an easier implementation. Once you have your stuff created you get struts to recognize it by changing the message-resources elements in your struts-config file. For instance I created a DBMessageResources class and factory (I can send them to you if you want a quick example of how to do these things. They don't merge two files but it might give you an idea on where to go) At any rate in mine I expect to get three things from the MR config 1) the JNDI Datasource name, 2) the sql to use to retrieve the value given a key, 3) a timeout for my cache. So my message-resources looks like this: message-resources factory=org.homedns.afogleson.messageresources.DBMessageResourcesFactor y parameter=java:comp/env/jdbc/myusersDS,SELECT value from Messages where locale=? and messagekey=?,30 null=false / As you can see there is no need to have your classes exist in o.a.s.util or any particular package in fact. Im sure you are aware, but the parameter is what gets passed as the config so it can pretty much be anything you want as long as it can be passed as a string. Let me know if you want my example and I will shoot it your way. Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 1:47 PM To: Fogleson, Allen; Struts Users Mailing List Subject: Re: Error Messages from the Database - Simple method? Oy. I'm assuming that you're talking about the loadLocale() method within... org.apache.struts.util.PropertyMessageResources I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead
RE: Error Messages from the Database - Simple method?
David, Well the answer is simple yet complex. First off what you want to do is of course not quite possible right now. MessageResources are loaded from a property file based on locale, and are initialized in the loadLocale method. Examination of that method shows that if the locale is already loaded then don't try to reload it. So the simple answer is you need to create your own class extending (probably) PropertyMessageResources and a factory class that instantiates your class for use (factory extends either MessageResourceFactory or PropertyMessageResourceFactory). You could override MessageResources but I think propertyMessageResources is the right superclass, and you override loadLocale and getMessage(String, String). Al -Original Message- From: David Johnson [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 1:08 PM To: Struts Users Mailing List Subject: Error Messages from the Database - Simple method? Hi all I have a similar need to a topic entitled Load Message Resources from DB??? but only for ERROR messages, and quite honestly, I want the simplest approach possible. since my Error Messages and my other test fields currently share ApplicationResources.properties I'm a little trapped though, and that's fine because I want it **totally*** transparent from the JSP tag My current vision is this: I will have a simple table as follows appliction_errors error_label - varchar(25) error_text - varchar(255) I will build a service within a plug-in to retrieve all of the error messages from the database and replace the proprtties bundle that struts loads. My questions are: 1. Where does stuts actually load up the message resources from the file into memory 2. What is the name and type of the variable (to make it transparent to the JSP tag 3. is it possible to just load up a new object and **replace** the one that struts creatd with mine? if not, what am I missing? -- -Dave [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: Error Messages from the Database - Simple method?
Oy. I'm assuming that you're talking about the loadLocale() method within... org.apache.struts.util.PropertyMessageResources I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources What about my idea of just letting the whole thing run notmally then replacing the resulting collection with a NEW collection... The benefit there is I dont have to touch Struts at all, which, I'll be honest.. I REALLY dont want to. what I guess I'm looking at is somehow replacing that hashpamp of messages with my OWN messages. whaddya think? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error Messages from the Database - Simple method?
Comments in line.. - Original Message - From: David Johnson [EMAIL PROTECTED] Sent: Thursday, April 07, 2005 7:46 PM Oy. I'm assuming that you're talking about the loadLocale() method within... org.apache.struts.util.PropertyMessageResources I see that inheritance wise, 1. PropertyMessageResources extends MessageResources 2. PropertyMessageResourcesFactory extends MessageResourcesFactory Logical. So, I'll create 1. DatabaseMessageResources extends MessageResources 2. DatabaseMessageResourcesFactory extends MessageResourcesFactory Yes Questions 1. should I create them in the org.apache.struts.util. package? mucking with struts seems risky Theres no need or reason to use the Struts package. 2. how do I tell the application to use MY DatabaseMessageResourcesFactory and DatabaseMessageResources instead of PropertyMessageResourcesFactory and PropertyMessageResources Use the factory attribute. In your struts-config.xml... message-resources factory=mPackage.DatabaseMessageResourcesFactory / Add a key, if you don't want them to be the default bundle. What about my idea of just letting the whole thing run notmally then replacing the resulting collection with a NEW collection... The benefit there is I dont have to touch Struts at all, which, I'll be honest.. I REALLY dont want to. You don't have to customize Struts, just configure it as I showed above. Niall - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Error Messages via redirect
Ben, Your statement doesn't really give a lot of detail on what you're trying to accomplish, but I'm going to take a stab: Struts is going to save validation errors into the request. If you're doing a redirect back to the input form when validation fails you're going to wind up with a new request ... and your errors aren't going to be there (because they were added to the old request). That help? Feel free to flesh-out your question if you don't feel I've answered it. On Mon, 20 Dec 2004 08:32:13 +1100, Ben [EMAIL PROTECTED] wrote: Hi What is the prefer way to handle error messages via redirect? Regards, Ben -- Eddie Bush - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error messages not displaying
When you broke your jsp up into tiles did you still include the html taglib definition? Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:17 PM Subject: error messages not displaying Hi Everyone, I have this weird problem. My error messages were displaying fine but after I started using tiles, the messages dont show up. If I do the logic:messagesPresent for a particular property, it shows that error is present. But the html:errors/ tag doesnt show errors. Anyone can help with this. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error messages not displaying
Hi, I have my html taglib definition on the top on my main jsp. Thanks --- Niall Pemberton [EMAIL PROTECTED] wrote: When you broke your jsp up into tiles did you still include the html taglib definition? Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:17 PM Subject: error messages not displaying Hi Everyone, I have this weird problem. My error messages were displaying fine but after I started using tiles, the messages dont show up. If I do the logic:messagesPresent for a particular property, it shows that error is present. But the html:errors/ tag doesnt show errors. Anyone can help with this. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: error messages not displaying
You need it in every jsp that use those tags, not just the main one. Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 5:28 PM Subject: Re: error messages not displaying Hi, I have my html taglib definition on the top on my main jsp. Thanks --- Niall Pemberton [EMAIL PROTECTED] wrote: When you broke your jsp up into tiles did you still include the html taglib definition? Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:17 PM Subject: error messages not displaying Hi Everyone, I have this weird problem. My error messages were displaying fine but after I started using tiles, the messages dont show up. If I do the logic:messagesPresent for a particular property, it shows that error is present. But the html:errors/ tag doesnt show errors. Anyone can help with this. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - 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: error messages not displaying
Hi, I have the following definition in the tiles.xml. definition name=global path=/WEB-INF/tiles/standardLayout.jsp put name=title value=Title / put name=topLinks value=/WEB-INF/tiles/topNav.jsp / put name=bottomLinks value=/WEB-INF/tiles/bottomNav.jsp / put name=topMenu value=/WEB-INF/tiles/topMenu.jsp / put name=content value=/WEB-INF/tiles/index.jsp / /definition definition extends=global name=customer.Page put name=content value=/WEB-INF/jsp/customer.jsp / /definition I have defined the html taglib in the topNav.jsp,topMenu.jsp,customer.jsp,bottomNav.jsp. The customer.jsp has other includes like %@ include file=address_include.inc % I have not defined taglib in the includes. Am I doing anything wrong ??? --- Niall Pemberton [EMAIL PROTECTED] wrote: You need it in every jsp that use those tags, not just the main one. Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 5:28 PM Subject: Re: error messages not displaying Hi, I have my html taglib definition on the top on my main jsp. Thanks --- Niall Pemberton [EMAIL PROTECTED] wrote: When you broke your jsp up into tiles did you still include the html taglib definition? Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:17 PM Subject: error messages not displaying Hi Everyone, I have this weird problem. My error messages were displaying fine but after I started using tiles, the messages dont show up. If I do the logic:messagesPresent for a particular property, it shows that error is present. But the html:errors/ tag doesnt show errors. Anyone can help with this. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - 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] __ 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: error messages not displaying
I don't really use includes, but I believe you do. Quickest way to find out is give ita try and see if it resolves the problem. Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 5:55 PM Subject: Re: error messages not displaying Hi, I have the following definition in the tiles.xml. definition name=global path=/WEB-INF/tiles/standardLayout.jsp put name=title value=Title / put name=topLinks value=/WEB-INF/tiles/topNav.jsp / put name=bottomLinks value=/WEB-INF/tiles/bottomNav.jsp / put name=topMenu value=/WEB-INF/tiles/topMenu.jsp / put name=content value=/WEB-INF/tiles/index.jsp / /definition definition extends=global name=customer.Page put name=content value=/WEB-INF/jsp/customer.jsp / /definition I have defined the html taglib in the topNav.jsp,topMenu.jsp,customer.jsp,bottomNav.jsp. The customer.jsp has other includes like %@ include file=address_include.inc % I have not defined taglib in the includes. Am I doing anything wrong ??? --- Niall Pemberton [EMAIL PROTECTED] wrote: You need it in every jsp that use those tags, not just the main one. Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 5:28 PM Subject: Re: error messages not displaying Hi, I have my html taglib definition on the top on my main jsp. Thanks --- Niall Pemberton [EMAIL PROTECTED] wrote: When you broke your jsp up into tiles did you still include the html taglib definition? Niall - Original Message - From: struts lover [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 26, 2004 1:17 PM Subject: error messages not displaying Hi Everyone, I have this weird problem. My error messages were displaying fine but after I started using tiles, the messages dont show up. If I do the logic:messagesPresent for a particular property, it shows that error is present. But the html:errors/ tag doesnt show errors. Anyone can help with this. Thanks a lot. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail - 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] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error messages in tiles using tiles-defs.xml
Hi Ganesh, Listing down what all has to be done to display error message when you are using resource bundle and tiles definition. This is a very simple example which should give you a picture of how to go about it. application.properties ( The resource bundle file ) error.auth.failure=Error:Not authorized to access this page. Including a snippet of an example Action class. public final class UserConfAction extends DispatchAction { public ActionForward addUser(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { try { authMgr.createUser(sessionKey, user); } catch (AuthException aex) { // Code to handle container based error condition. ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError(error.auth.failure)); saveErrors(request,errors); ?xml:namespace prefix = o ns = urn:schemas-microsoft-com:office:office / return mapping.findForward(failure); } return mapping.findForward(success); } } struts configuration file ( struts-config.xml ) action path=/UserConfig type=com.action.main.UserConfAction scope=request parameter=method forward name=success path=Success/ forward name=failure path=Failure/ /action tiles defintion file ( tiles-defs.xml ) !-- Definition for the Failure -- definition name=Failure extends=configBaseDef put name=top value=/WEB-INF/pages/top.jsp/ put name=body value=/WEB-INF/pages/userconf.jsp/ put name=top value=/WEB-INF/pages/bottom.jsp/ /definition Say the error message to be displayed will be in the body part of this layout. So, in the userconf.jsp you need to have something like this %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % !-- Error Block -- tr td align=center colSpan=2 html:errors/ /td tr Hope this should give you a fair idea on how to do the implementation. Cheers, Ashutosh Satyam -Original Message- From: Ganesh Rao [ mailto:[EMAIL PROTECTED] Sent: Tuesday, June 01, 2004 11:01 AM To: Struts Users Mailing List Subject: Error messages in tiles using tiles-defs.xml Hi everybody! Can anybody tell me how to display error messages using saveErrors() from resouecebundle properties. Here i'm using tiles.So i need to follow tiles-defs.xml file configureation rules. Ur help thankfully accepted. Ganesh - Yahoo! Messenger - Communicate instantly...Ping your friends today! Download Messenger Now
Re: Error messages in tiles using tiles-defs.xml
I would recommend any of the standard textbooks, Ganesh. Do you have access? You can also look at the manuals on the struts sight. There is a lot of documentation on this. The fact that you use tiles is irrelevant to this question. I think I own all the books, etc., so if you get stuck, please feel free to inquire about what they mean. Maybe I will know? ///;-) If you don't have access to books, please let me know and I will go into detail. Michael At 10:31 PM 5/31/2004, Ganesh Rao wrote: Hi everybody! Can anybody tell me how to display error messages using saveErrors() from resouecebundle properties. Here i'm using tiles.So i need to follow tiles-defs.xml file configureation rules. Ur help thankfully accepted. Ganesh - Yahoo! Messenger - Communicate instantly...Ping your friends today! Download Messenger Now