Configuring WebApp to use Struts Tag Libs
OK, I guess I've missed something fundamental, so someone please point out what it is. How do I declare the Struts (1.2.4) tag libs in web.xml so that : 1) Tomcat 5.0.28 can access them from Struts.jar at runtime 2) I can use the Ant Jasper task to compile my JSPs to validate them during the build? I have them defined as taglib taglib-uri/tags/struts-html/taglib-uri taglib-location/META-INF/tlds/struts-html.tld/taglib-location /taglib in web.xml as this seems to match the position in Struts.jar, but the Jasper task complains with D:\source\main\chopperheavysite\build.xml:178: org.apache.jasper.JasperException: file:D:/Source/main/chopperheavysite/b uild/weblog/extra-header.jsp(1,1) File /META-INF/tlds/struts-html.tld not found even though I have added Struts.jar to its classpath. Any ideas? William - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuring WebApp to use Struts Tag Libs
You don't need that at all. You can just in your jsp point to the tld in the jsp. (I normaly put them in WEB-INF/lib). (or just have a header tile or include that declares all your jsps once) hth, .V William Ferguson wrote: OK, I guess I've missed something fundamental, so someone please point out what it is. How do I declare the Struts (1.2.4) tag libs in web.xml so that : 1) Tomcat 5.0.28 can access them from Struts.jar at runtime 2) I can use the Ant Jasper task to compile my JSPs to validate them during the build? I have them defined as taglib taglib-uri/tags/struts-html/taglib-uri taglib-location/META-INF/tlds/struts-html.tld/taglib-location /taglib in web.xml as this seems to match the position in Struts.jar, but the Jasper task complains with D:\source\main\chopperheavysite\build.xml:178: org.apache.jasper.JasperException: file:D:/Source/main/chopperheavysite/b uild/weblog/extra-header.jsp(1,1) File /META-INF/tlds/struts-html.tld not found even though I have added Struts.jar to its classpath. Any ideas? William -- RiA-SoA w/JDNC http://www.SandraSF.com forums - help develop a community My blog http://www.sandrasf.com/adminBlog - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Attributes, Parameter or Class
This line gives me a cannot find symbol variable request String userID = request.getParameter(userID); This line gives me a cannot find symbol variable request String userID = request.getSession().getAttribute(userID); This line gives me a cannot find symbol variable request HttpSession session = request.getSession(); String userID = session.getAttribute(userID); This is not a servlet so request is not available. There has to be a way for non-servlet classes in a web app to access the session object? Correct? Jim From: Dakota Jack [EMAIL PROTECTED] Reply-To: Dakota Jack [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sat, 8 Jan 2005 21:18:53 -0800 String userID = request.getSession().getAttribute(userID); or HttpSession session = request.getSession(); String userID = session.getAttribute(userID); However, really, as you have been told twice, what you want is: String userID = request.getParameter(userID); RIght? Jack On Sun, 09 Jan 2005 02:44:42 +, Jim Douglas [EMAIL PROTECTED] wrote: I can connect and authenticate via a database no problem. My problem is I can't compile because of this line, String userID = session.getAttribute(userID); - gives an error cannot find symbol variable session So I changed it to this, String userID = HttpSession.getAttribute(userID); ...and I get an error message that says, non-static methods getAttribute(java.lang.String) cannot be referenced from a static context The answer may be my syntax on that line, I'm not sure. (This is the code, it's not a servlet) public class SQL92FormDetailDAO implements FormDetailDAO { private Connection connection; public SQL92FormDetailDAO(Connection connection) { this.connection = connection; } public List listFormDetail() { List items = new ArrayList(); Statement statement =null; try { statement = connection.createStatement(); String userID = session.getAttribute(userID); String query = select name, formdetail from + forms where userID = + userID; Thank for the great responses! -Jim From: Larry Meadors [EMAIL PROTECTED] Reply-To: Larry Meadors [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sat, 8 Jan 2005 17:06:34 -0700 Sorry Jim, I have to agree with the other posters...this is a really unclear question. I think what you are asking is this: When a user logs in, i want to put the user id and password somewhere that i can always find it easily. If so, put it in session scope. It will be there until the session expires, and you can get to it from a JSP or servlet. If you need it available from everything in the web app, you could use something like a filter in conjunction with ThreadLocal to do that...but I do not think that is such a great idea. IMO, keeping it in session, and passing it to your model is a cleaner and more maintainable design. Larry On Sat, 08 Jan 2005 19:25:15 +, Jim Douglas [EMAIL PROTECTED] wrote: I have an LogonForm, LogonAction and when a user successfully logs on, I set Attributes for userID and userName. How would be the best way to make this information available to the Web App regardless of whether I need the data from within a JSP, servlet or class file(for example, building a dynamic query) This is what I was trying to do and raised this issue(I can't get it to work) public class SQL92FormDetailDAO implements FormDetailDAO { private Connection connection; public SQL92FormDetailDAO(Connection connection) { this.connection = connection; } public List listFormDetail() { List items = new ArrayList(); Statement statement =null; try { statement = connection.createStatement(); String userID = session.getAttribute(userID); String query = select name, formdetail from + forms where userID = + userID; Thanks, Jim - 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] -- -- You can lead a horse to water but you cannot
Re: Attributes, Parameter or Class
From: Jim Douglas [EMAIL PROTECTED] This line gives me a cannot find symbol variable request String userID = request.getParameter(userID); Re-read Frank's response-- your DAO class does not (and should not) know anything about requests or sessions. You might also want to review the J2EE BluePrints for the DAO Pattern: http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html Looking back at your original post, I question having a 'FormDetailDAO'. The DAO layer shouldn't care about forms (unless it refers to something in your database, and not the HTML form as I am assuming.) To fix the problem you first posed, I think you should change the signature of this method: public List listFormDetail() { to public List listFormDetail(String userId) { This means you'll pass the userId to the DAO class, which won't care where it came from. And then, from your Action, you would use the code Jack suggested, plus change your method call: //retrieve the userId from the session [or wherever it is]: String userId = session.getAttribute(userId); //call the DAO class to get the list from the database List myList = myDao.listFormDetail( userId ); HTH, Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please explain Struts Chain
[D] And finally, we have a PagePrep action which operates between the return from the Action and the tiles processing. This is the thing I'm always talking about which provides us with a straightforward way to prepopulate forms, set up menus and select lists, and otherwise shepherd data around so that the Actions and the JSPs on either side can be a bit simpler and clearer. Joe, can you elaborate a little bit more on how the PagePrep action works? Is there some sort of ActionForm works with it? I have to provide my own PagePrep action implementation to populate any forms when returning from Action, right? Thank you for the hard work! - Lee - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please explain Struts Chain
At 12:11 PM -0600 1/9/05, Shihgian Lee wrote: [D] And finally, we have a PagePrep action which operates between the return from the Action and the tiles processing. This is the thing I'm always talking about which provides us with a straightforward way to prepopulate forms, set up menus and select lists, and otherwise shepherd data around so that the Actions and the JSPs on either side can be a bit simpler and clearer. Joe, can you elaborate a little bit more on how the PagePrep action works? Here's an earlier post where I elaborated at some detail: http://article.gmane.org/gmane.comp.jakarta.struts.devel/22034/match=pageprep Is there some sort of ActionForm works with it? I have to provide my own PagePrep action implementation to populate any forms when returning from Action, right? In our local environment, yes, there's a way of making a form available to the page preparation process so that values can be prefilled from system data when that's appropriate (as opposed to displaying a blank form or prefilling with user data after a validation failure.) What we use here is not directly what I would propose for inclusion in Struts, but this message is the last thing I wrote about how I'm thinking about it: http://article.gmane.org/gmane.comp.jakarta.struts.devel/24279 In our local environment, the page preparation code is in custom Renderer classes and requires a custom configuration; I'd rather use commons-chain commands for page prep and integrate the configuration into current Struts config style as much as possible. Some mechanism for making a form available for prepopulation is one of my primary goals, because it's such a common use case, and because so many Struts developers have had to cook up their own solutions to the problem. Comments and criticisms are always welcomed, although any substantial discussion about changes to the framework should probably move to the struts-dev list. Joe -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com Narrow minds are weapons made for mass destruction -The Ex - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Attributes, Parameter or Class
Wendy, You said And then, from your Action, you would use the code Jack suggested, plus change your method call: //retrieve the userId from the session [or wherever it is]: String userId = session.getAttribute(userId); //call the DAO class to get the list from the database List myList = myDao.listFormDetail( userId ); Must it be from an Actioon? Does this mean that you can't use that code above from a within a tiles contrloller, specifically the session.getAttribute()? Jim From: Wendy Smoak [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sun, 9 Jan 2005 09:20:26 -0700 From: Jim Douglas [EMAIL PROTECTED] This line gives me a cannot find symbol variable request String userID = request.getParameter(userID); Re-read Frank's response-- your DAO class does not (and should not) know anything about requests or sessions. You might also want to review the J2EE BluePrints for the DAO Pattern: http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html Looking back at your original post, I question having a 'FormDetailDAO'. The DAO layer shouldn't care about forms (unless it refers to something in your database, and not the HTML form as I am assuming.) To fix the problem you first posed, I think you should change the signature of this method: public List listFormDetail() { to public List listFormDetail(String userId) { This means you'll pass the userId to the DAO class, which won't care where it came from. And then, from your Action, you would use the code Jack suggested, plus change your method call: //retrieve the userId from the session [or wherever it is]: String userId = session.getAttribute(userId); //call the DAO class to get the list from the database List myList = myDao.listFormDetail( userId ); 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: Attributes, Parameter or Class
From: Jim Douglas [EMAIL PROTECTED] And then, from your Action, you would use the code Jack suggested, plus change your method call: Must it be from an Actioon? Does this mean that you can't use that code above from a within a tiles contrloller, specifically the session.getAttribute()? No! That's the whole point-- your DAO class can be called from anywhere. That's why it shouldn't know about a 'session' or a 'request'. Likewise it shouldn't be tied to any other class above it. The DAO class only knows its job and where to get the data. (As a layer it sits below the application and above the database.) It doesn't care where the call is coming from, it just receives a userId and returns whatever it's supposed to return to whoever called it. And the flip side is that your Action or Tiles Controller (or command line or Swing app) doesn't know what kind of database you have, or even if there IS a database. It just makes a DAO object, calls the method, and uses the returned object however it intends to. HTH, Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Attributes, Parameter or Class
This is not a DOA issue at all, I guess I didn't do a very good job of explaining. I simply want to access an UserID from anywhere in an web-app. JSP, method of any class file, servlet or otherwise...etc. ( Passing a string is what I ended up with.) Thanks all! Jim From: Wendy Smoak [EMAIL PROTECTED] Reply-To: Struts Users Mailing List user@struts.apache.org To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sun, 9 Jan 2005 13:14:55 -0700 From: Jim Douglas [EMAIL PROTECTED] And then, from your Action, you would use the code Jack suggested, plus change your method call: Must it be from an Actioon? Does this mean that you can't use that code above from a within a tiles contrloller, specifically the session.getAttribute()? No! That's the whole point-- your DAO class can be called from anywhere. That's why it shouldn't know about a 'session' or a 'request'. Likewise it shouldn't be tied to any other class above it. The DAO class only knows its job and where to get the data. (As a layer it sits below the application and above the database.) It doesn't care where the call is coming from, it just receives a userId and returns whatever it's supposed to return to whoever called it. And the flip side is that your Action or Tiles Controller (or command line or Swing app) doesn't know what kind of database you have, or even if there IS a database. It just makes a DAO object, calls the method, and uses the returned object however it intends to. 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: Attributes, Parameter or Class
From: Jim Douglas [EMAIL PROTECTED] I simply want to access an UserID from anywhere in an web-app. JSP, method of any class file, servlet or otherwise...etc. ( Passing a string is what I ended up with.) It sounds like you want a global variable like you might have in a procedural language. That would break encapsulation and go against the rules of object oriented programming. In a JSP or a Servlet, you can get a reference to the session and retrieve the UserID (assuming you placed it as a session attribute.) But it's not going to be visible to any method of any class, and IMO should not be. I think you've arrived at the correct solution-- pass the String into the method that needs it. -- Wendy Smoak - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Attributes, Parameter or Class
The only thing that's like a global in Java is a static variable (static final usually, but in this case just static). If you had a class like so: public class userInfo { private static String userID; public static void setUserID(String userID) { this.userID = userID; } public static String getUserID() { return this.userID; } } Then you could, AFTER you've set the userID yourself, treat this like a global. No need to pass the userID around. Note of course that the above is not thread-safe, and therefore is a Very Bad Thing(tm) in servlet programming. You could pull something like this off by synchronizing the getter and setter, but of course you can only ever have one of these, so probably you'd want to instead have a class that looks very much like the above, with the synchronized methods, but the String becomes a HashMap, and in it you store userInfo object, keyed by the userID probably. This wouldn't really solve your problem because you'd have to know the userID to look up anything else, but I'm just trying to illustrate a point. As Wendy correctly said though, just passing it around is the right answer. I suspect that's the end of the story :) -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Wendy Smoak wrote: From: Jim Douglas [EMAIL PROTECTED] I simply want to access an UserID from anywhere in an web-app. JSP, method of any class file, servlet or otherwise...etc. ( Passing a string is what I ended up with.) It sounds like you want a global variable like you might have in a procedural language. That would break encapsulation and go against the rules of object oriented programming. In a JSP or a Servlet, you can get a reference to the session and retrieve the UserID (assuming you placed it as a session attribute.) But it's not going to be visible to any method of any class, and IMO should not be. I think you've arrived at the correct solution-- pass the String into the method that needs it. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Attributes, Parameter or Class
On Sun, 09 Jan 2005 17:05:04 -0500, Frank W. Zammetti wrote: The only thing that's like a global in Java is a static variable (static final usually, but in this case just static). Another good trick in a web app is to use the ThreadLocal class to simulate globals that are thread specific. AFAIK, all servlet containers use one thread to process a request (unless you are doing some funky stuff with threading in your application). What that means is that you can extend ThreadLocal and use that class as you would a static variable, but its data is only shared by code executing on one thread. Where I work, we use a filter to call ThreadUser.setUser() with a User object - so anywhere in the application, we can reference ThreadUser.getUser() (as if it were static), and always get the user that the thread is serving. Larry - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
flexbible JSP
(thanks for the great responses to my prior post) Now that my query's all done I want a flexible JSP that can handle the results. What would be the best approach? I started sown this path 1 - setAttributes based on the recordset results, like this String formMessage = rs.getString(4); request.setAttribute(formMessage, formMessage); 2 - then in the JSP, % request.getAttribute(frmMessage); % Any better solutions? Thanks, Jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Security in Struts Application
Hi All i'd like to say sorry if someone already asked this question before... what is best practice implement security in struts apps ? i'm looking something that similar with acegi security but more suitable with struts
Exception handling / jsp / tiles
Hi, How to correctly display the error page when some content has been written to the OutputStream? When an exception occurs in some nested jsp component (e.g. a tile inserted by tiles:insert or some other tag), how do you display the error page rather than the partially returned content. A while ago, the error page would be displayed in the place of the errant component within the returned html. This could lead to the error page being embedded within other pages. This is no longer happening with Tomcat as I get an IllegalStateException - presumably as tomcat knows it has already written some content to the OutputStream A previous worked around (back in the days of struts 1.1) was: 1) declare an error jsp 2) within that jsp, store the exception in the session 3) the error jsp does a meta refresh to the real error page META HTTP-EQUIV=Refresh CONTENT=0;url=%=request.getContextPath() %/RealError.jsp 4) In the RealError.jsp display the exception from the session. Is this the only way to resolve the problem or is there something I've missed in struts that does this for me? I guess I'd have to write the Meta refresh in some exception handling code if tomcat is going to complain if I attempt to use declared servlet exception handling after content has been written to the OutputStream. Other solutions that could work - buffer all output, don't write to the output stream until you're sure no exceptions have been thrown, then std servlet exception handling should work. No idea how to do this but if its possible I guess it's a tomcat config. cheers Nathan -- Nathan Coast Managing Director Codeczar Ltd mob : (852) 9049 5581 tel : (852) 2834 8733 fax : (852) 2834 8755 web : http://www.codeczar.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: flexbible JSP
Your going to have to be more specific than that :) Only because I know what your prior post was, I have at least some idea what your talking about, but you'll want to fill us in a bit more here... What you suggest is fine, except that your JSP scriplet as written wouldn't output anything... You probably meant to type: %=request.getAttribute(formMessage);% ...but, that's a minor point... This is a Struts-based application, correct? If so, while you can do what your saying (I've done it in Struts apps myself), it's not the typical solution. What you probably want to do is populate the ActionForm associated with the request, and access that in your JSP. Also, most people will tell you to use the taglibs instead of scriplets (everyone except me actually, but in this case you might be better off listening to them). -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com Jim Douglas wrote: (thanks for the great responses to my prior post) Now that my query's all done I want a flexible JSP that can handle the results. What would be the best approach? I started sown this path 1 - setAttributes based on the recordset results, like this String formMessage = rs.getString(4); request.setAttribute(formMessage, formMessage); 2 - then in the JSP, % request.getAttribute(frmMessage); % Any better solutions? Thanks, Jim - 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: Attributes, Parameter or Class
Jim, You said it was LogonAction, so there is a request object in the execute method. Jack On Sun, 09 Jan 2005 15:43:25 +, Jim Douglas [EMAIL PROTECTED] wrote: This line gives me a cannot find symbol variable request String userID = request.getParameter(userID); This line gives me a cannot find symbol variable request String userID = request.getSession().getAttribute(userID); This line gives me a cannot find symbol variable request HttpSession session = request.getSession(); String userID = session.getAttribute(userID); This is not a servlet so request is not available. There has to be a way for non-servlet classes in a web app to access the session object? Correct? Jim From: Dakota Jack [EMAIL PROTECTED] Reply-To: Dakota Jack [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sat, 8 Jan 2005 21:18:53 -0800 String userID = request.getSession().getAttribute(userID); or HttpSession session = request.getSession(); String userID = session.getAttribute(userID); However, really, as you have been told twice, what you want is: String userID = request.getParameter(userID); RIght? Jack On Sun, 09 Jan 2005 02:44:42 +, Jim Douglas [EMAIL PROTECTED] wrote: I can connect and authenticate via a database no problem. My problem is I can't compile because of this line, String userID = session.getAttribute(userID); - gives an error cannot find symbol variable session So I changed it to this, String userID = HttpSession.getAttribute(userID); ...and I get an error message that says, non-static methods getAttribute(java.lang.String) cannot be referenced from a static context The answer may be my syntax on that line, I'm not sure. (This is the code, it's not a servlet) public class SQL92FormDetailDAO implements FormDetailDAO { private Connection connection; public SQL92FormDetailDAO(Connection connection) { this.connection = connection; } public List listFormDetail() { List items = new ArrayList(); Statement statement =null; try { statement = connection.createStatement(); String userID = session.getAttribute(userID); String query = select name, formdetail from + forms where userID = + userID; Thank for the great responses! -Jim From: Larry Meadors [EMAIL PROTECTED] Reply-To: Larry Meadors [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: Re: Attributes, Parameter or Class Date: Sat, 8 Jan 2005 17:06:34 -0700 Sorry Jim, I have to agree with the other posters...this is a really unclear question. I think what you are asking is this: When a user logs in, i want to put the user id and password somewhere that i can always find it easily. If so, put it in session scope. It will be there until the session expires, and you can get to it from a JSP or servlet. If you need it available from everything in the web app, you could use something like a filter in conjunction with ThreadLocal to do that...but I do not think that is such a great idea. IMO, keeping it in session, and passing it to your model is a cleaner and more maintainable design. Larry On Sat, 08 Jan 2005 19:25:15 +, Jim Douglas [EMAIL PROTECTED] wrote: I have an LogonForm, LogonAction and when a user successfully logs on, I set Attributes for userID and userName. How would be the best way to make this information available to the Web App regardless of whether I need the data from within a JSP, servlet or class file(for example, building a dynamic query) This is what I was trying to do and raised this issue(I can't get it to work) public class SQL92FormDetailDAO implements FormDetailDAO { private Connection connection; public SQL92FormDetailDAO(Connection connection) { this.connection = connection; } public List listFormDetail() { List items = new ArrayList(); Statement statement =null; try { statement = connection.createStatement(); String userID = session.getAttribute(userID); String query = select name, formdetail from + forms where userID = + userID; Thanks, Jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Struts 1.1 UTF-8 problem
Hi, here is the situation: Tomcat 5.25 MySQL 4.1 Struts 1.1 when I use Struts form to get some form data submited by a webpage, it is encode in latin but not utf-8. I have already set the page encoding to UTF-8 in my JSP. I need to new a String specific the encoding to UTF-8 in order to save unicode data into MySQL Is there any way to tell Struts encode all data in UTF-8 ?? btw, display UTF-8 character is fine Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Trouble validating
Hi Matt, In my validation.xml I have: form-validation ... formset form name=MyValidatorForm field property=field1 depends=required arg key=label.property1/ /field !-- I´m always getting error in The 2 url fields bellow -- field property=urlfield1 depends=required,url arg key=label.urlfield1/ var var-nameallowallschemes/var-name var-valuetrue/var-value /var /field field property=urlfield2 depends=required,url arg key=label.urlfield2/ /field !-- The mask bellow works fine -- field property=positiveIntegerfield depends=required,mask arg key=label.positiveIntegerfield/ var var-namemask/var-name var-value^\d+$/var-value /var /field !-- The field bellow won´t get any error with String value -- field property=doublefield depends=required,double arg key=label.doublefield/ /field !-- I tried some mask´s like this bellow but it won´t get any error with a String value -- field property=doublefield2 depends=required,mask arg key=label.doublefield2/ var var-namemask/var-name var-value\d{1,}\.\d{1,}/var-value /var /field /form /formset ... /form-validation And My ErrorValidation.jsp is : %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % html:html head titlebean:message key=errors.cancel//title html:base/ /head body bgcolor=white bean:message key=errors.cancel/ html:errors/ /body /html:html -Mensaje original- De: Matt Bathje [mailto:[EMAIL PROTECTED] Enviado el: viernes, 07 de enero de 2005 16:29 Para: Struts Users Mailing List Asunto: Re: Trouble validating Miguel Atienza wrote: Hi!, I´m having trouble validating a standard form using de validation.xml file. I defined one class,MyValidatorForm that extends ValidatorForm with the fields of the form and the getters and setters methods. In the validation.xml,when I use depends=required for the fields I want, It works fine, And I get the messages fine With html:errors/ in a jsp page : /pages/ErrorValidation.jsp but when I use depends=required,double or depends=required,url It does not work. If I send a String in the form field that is supposed to be double it won´t get any error. I also have tried using some mask following the jakarta RegExp ,I tested then in http://jakarta.apache.org/regexp/applet.html. but only some mask´s works when I put them in the validation.xml. In the struts-config.xml I have: plug-in className=org.apache.struts.validator.ValidatorPlugIn set-property property=pathnames value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/ /plug-in And in the action tag that uses this validation I have this attributes name=MyValidatorForm validate=true scope=request input=/pages/ErrorValidation.jsp Any help is appreciated. Miguel Migule - we need to see what your validation.xml for the fields that aren't working looks like. The relevant JSP (for the non-working fields) may also help. Matt - 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]