Form field validation - best practices
In our application, the implementation for error message handling is: using a HashMap for error messages with the form propertyName as the key. This prevents duplicate messages for form fields. Taking one example use-case: zipCode, rules are: must be numeric, and must be at least 5-digits in length. Debated in our group is the need for having both messages presented to the user if qwe were entered for a zip code. Granted, this simple use case may not be the best example of needing multiple messages. But we feel the implementation should support it. Changing the HashMap key to propertyName+messageName would suffice, but the need for this change is pending our findings on best-practices. I searched the archives for +validation +'per field' with few results that did not really address this question.
RE: Problem loading/invoking struts app
The following technotes address the classloader issue and give detailed instructions on how to override a WebSphere included file such as JDOM: How to use the latest JDOM jar http://www-1.ibm.com/support/docview.wss?uid=swg21222645 Best Practice for Using Common Application Files http://www-1.ibm.com/support/docview.wss?uid=swg27006159 Other Websphere resources I've collected in notes: WebSphere Application Server v6.0 InfoCenter - Product Documentation http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp Rational Web Developer v6.0 InfoCenter - Product Documentation http://publib.boulder.ibm.com/infocenter/rtnl0600/index.jsp?rcss=rtlrwdw s WebSphere Application Server Pre-reqs - List of all supported hardware and software http://www-306.ibm.com/software/webservers/appserv/doc/latest/prereq.htm l WebSphere Application Server developerWorks - Latest technical articles, product links, tutorials, etc. http://www-128.ibm.com/developerworks/websphere/zones/was/ IBM Press IBM Redbooks WebSphere Application Server V6 System Management Configuration Handbook (sg24-6451) http://www.redbooks.ibm.com/abstracts/sg246451.html?Open Ch.5 covers the Administrative Console Ch. 14 covers Class Loaders Ch. 16.5 covers Updating Applications (e.g. full_app, single-file, single-module, partial_app, etc.) WebSphere Application Server - Express V6 Developers Guide and Development Examples (sg24-6500) http://www.redbooks.ibm.com/abstracts/sg246500.html?Open IBM(r) WebSphere(r): Deployment and Advanced Configuration (ISBN: 0131468626) http://www.ibmpressbooks.com/bookstore/product.asp?isbn=0131468626rl=1 Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6 (sg24-6690) http://www.redbooks.ibm.com/abstracts/sg246690.html?Open Duane -Original Message- From: Adari, Chandra [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 6:37 PM To: Duane Rosengartner Subject: RE: Problem loading/invoking struts app Can you please send me the article you are talking about from IBM. Thanks, Chandra. -Original Message- From: Duane Rosengartner [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 2:11 PM To: Struts Users Mailing List Subject: RE: Problem loading/invoking struts app It appears your classloader is picking up the wrong jar. If this is websphere 6, it comes with a jdom.jar that has given us problems similar to yours. Attempt to use the parent-first parent last setting; match with your working environment. It should be under the server(or node) properties. If this does not work, there is an article on ibm.com that I can try to find for you, a workaround for this issue. Duane -Original Message- From: Adari, Chandra [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 4:00 PM To: Struts Users Mailing List Subject: Problem loading/invoking struts app I am getting the following error during run time (ERROR Stack during Runtime) when I invoke the Login.do. Please find the error stack down below. I tried to put some debug statements and what I found was module config is coming null. I tried the same exact ear on a different machine and it works just fine(included the debug messages as well). I don't do any custom configuration to the app server so I am not sure what the difference is. DEBUG STATEMENT from a non-working machine : [6/12/06 18:32:50:715 GMT] 0055 SystemOut O Page /Login.do?from=index [6/12/06 18:32:50:715 GMT] 0055 SystemOut O module config null DEBUG STATEMENT from a working machine : [6/4/06 15:46:24:138 PDT] 00f3 SystemOut O Page /Login.do?from=index [6/4/06 15:46:24:138 PDT] 00f3 SystemOut O module config [EMAIL PROTECTED] ERROR Stack during app server start up from non-working machine : [6/4/06 8:27:15:492 GMT] 000a Digester E org.apache.commons.digester.Digester getParser Digester.getParser: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/validation/dynamic at oracle.xml.jaxp.JXSAXParserFactory.setFeature(JXSAXParserFactory.java:12 8) at org.apache.commons.digester.parser.XercesParser.configureXerces(XercesPa rser.java:185) at org.apache.commons.digester.parser.XercesParser.newSAXParser(XercesParse r.java:138) at org.apache.commons.digester.ParserFeatureSetterFactory.newSAXParser(Pars erFeatureSetterFactory.java:73) at org.apache.commons.digester.Digester.getParser(Digester.java:682) at org.apache.commons.digester.Digester.getXMLReader(Digester.java:891) at org.apache.commons.digester.Digester.parse(Digester.java:1572) at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServl et.java:708) at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.ja va:670) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:329
RE: Problem loading/invoking struts app
It appears your classloader is picking up the wrong jar. If this is websphere 6, it comes with a jdom.jar that has given us problems similar to yours. Attempt to use the parent-first parent last setting; match with your working environment. It should be under the server(or node) properties. If this does not work, there is an article on ibm.com that I can try to find for you, a workaround for this issue. Duane -Original Message- From: Adari, Chandra [mailto:[EMAIL PROTECTED] Sent: Monday, June 12, 2006 4:00 PM To: Struts Users Mailing List Subject: Problem loading/invoking struts app I am getting the following error during run time (ERROR Stack during Runtime) when I invoke the Login.do. Please find the error stack down below. I tried to put some debug statements and what I found was module config is coming null. I tried the same exact ear on a different machine and it works just fine(included the debug messages as well). I don't do any custom configuration to the app server so I am not sure what the difference is. DEBUG STATEMENT from a non-working machine : [6/12/06 18:32:50:715 GMT] 0055 SystemOut O Page /Login.do?from=index [6/12/06 18:32:50:715 GMT] 0055 SystemOut O module config null DEBUG STATEMENT from a working machine : [6/4/06 15:46:24:138 PDT] 00f3 SystemOut O Page /Login.do?from=index [6/4/06 15:46:24:138 PDT] 00f3 SystemOut O module config [EMAIL PROTECTED] ERROR Stack during app server start up from non-working machine : [6/4/06 8:27:15:492 GMT] 000a Digester E org.apache.commons.digester.Digester getParser Digester.getParser: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/validation/dynamic at oracle.xml.jaxp.JXSAXParserFactory.setFeature(JXSAXParserFactory.java:12 8) at org.apache.commons.digester.parser.XercesParser.configureXerces(XercesPa rser.java:185) at org.apache.commons.digester.parser.XercesParser.newSAXParser(XercesParse r.java:138) at org.apache.commons.digester.ParserFeatureSetterFactory.newSAXParser(Pars erFeatureSetterFactory.java:73) at org.apache.commons.digester.Digester.getParser(Digester.java:682) at org.apache.commons.digester.Digester.getXMLReader(Digester.java:891) at org.apache.commons.digester.Digester.parse(Digester.java:1572) at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServl et.java:708) at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.ja va:670) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:329) at javax.servlet.GenericServlet.init(GenericServlet.java:256) at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java: 274) at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper .java:1398) at com.ibm.wsspi.webcontainer.extension.WebExtensionProcessor.createServlet Wrapper(WebExtensionProcessor.java:86) at com.ibm.ws.webcontainer.webapp.WebApp.getServletWrapper(WebApp.java:788) at com.ibm.ws.webcontainer.webapp.WebApp.initializeTargetMappings(WebApp.ja va:515) at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:404) at com.ibm.ws.webcontainer.webapp.WebGroup.addWebApplication(WebGroup.java: 115) at com.ibm.ws.webcontainer.VirtualHost.addWebApplication(VirtualHost.java:1 28) at com.ibm.ws.webcontainer.WebContainer.addWebApp(WebContainer.java:924) at com.ibm.ws.webcontainer.WebContainer.addWebApplication(WebContainer.java :877) ERROR Stack during Run time from non-working machine : [6/12/06 18:32:50:717 GMT] 0055 ServletWrappe E SRVE0068E: Could not invoke the service() method on servlet /index.jsp. Exception thrown : java.lang.NullPointerException at org.apache.struts.taglib.TagUtils.pageURL(TagUtils.java:1118) at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.ja va:466) at org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.ja va:329) at org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectT ag.java:296) at org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:270 ) at com.ibm._jsp._index._jspx_meth_logic_redirect_0(_index.java:101) at com.ibm._jsp._index._jspService(_index.java:75) at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:91) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.ja va:1282) at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrap per.java:673) at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(G enericServletWrapper.java:117) at
RE: [OT]what techonolgies will you use to develop a new web application
I don't know folks; perhaps we're hung up on the word 'simple' or you'd have gotten more responses. Or is it that we're a Struts User group and we feel the question is rhetorical? No, that can't be it. I personally feel you should have searched the archives on this one. It's one that's asked every week sometimes twice. I realize in our line-of-work the answer can change from week-to-week, but it'll change from responder-to-responder just as well. You should repost on the struts-BASHERS-user list just to make sure. OK, I'll give you some credit. You came to Struts-users for the answer. Use the force, Luke: - try Struts -Original Message- From: Ashish Kulkarni [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 09, 2005 1:15 PM To: Struts Users Mailing List; [EMAIL PROTECTED] Subject: Re: [OT]what techonolgies will you use to develop a new web application Hi i have to develop a simple web application for CRUD Ashish --- Larry Meadors [EMAIL PROTECTED] wrote: That is like asking If you were going to build a house, where would you build it? Sooo many variables. I am currently working on an app that uses Spring+Struts+Tiles+iBATIS+Tomcat. Provide some more details on what the app will do, and you will get more accurate answers. Larry On 11/9/05, Ashish Kulkarni [EMAIL PROTECTED] wrote: Hi Suppose i have to develop a new web application what are the best and latest techonlogies you recommend to use. 1 Framework : struts,struts+shale,jsf,tapestry 2 front end(jsp): AJAX with JSF tages or with JSTL 3 database connection: ibatis, hibernate, object relation dataase mapping 4 business logic: EJB, spring or something else Ashish __ Yahoo! Mail - PC Magazine Editors' Choice 2005 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] __ Yahoo! Mail - PC Magazine Editors' Choice 2005 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: problem in Beanutils.copyProperties()
Try writing your own utils class extending BeanUtils. You can either check all input variables for null, or check datatype first, then check for null only on those properties you wish to allow 'null-ok'. You can still take advantage of BeanUtils by calling super.X(property, value), or super(dest, src) on anything that passes your validation. Possibilities are endless. Another option, which I don't like myself, is having a default date in your app new date(0)- defaults to 1974(?), that you can ignore elsewhere in your app (e.g. - put it in your DAO, so it doesn't write the bad date to the DB table, but clears the value first) This second option litters the code with exception handling, which I would only do as a last resort. Duane -Original Message- From: rahul [mailto:[EMAIL PROTECTED] Sent: Monday, September 26, 2005 10:03 AM To: Jakarta-Struts-List Subject: problem in Beanutils.copyProperties() Hi all, I am having a problem in using copyProperties() of org.apache.commons.beanutils.BeanUtils class I am doing it in this way BeanUtils.copyProperties(destBean,srcBean) where destBean and srcBean both have a property by name date, which is of type java.sql.Timestamp() If date property of srcBean is set to null then the above statement gives an exception: BeanUtil.ConversionException: No value specified It works fine in case srcBean.date is properly initialized. But there is a possibility of having null in srcBean.date in my code. So, how to deal with this? --RahulJoshi - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DynaForms Radio Buttons
use the Id (userId,accountId)or concatination of Id|someOtherVariable as the value of the Radio button property. Then in your action you would use the value of the radio to perform further processing. In most cases, the rows are simple views of an object. The selection of the row would require you to build a more complex view of the object(built from it's ID) and send you to an edit screen. If you already have the complex model built, you need a rowId as the value, which you would use as the index of the list. Easiest way: String[] rowsSelected = form.get(propertyName); //in the action class String[] rowsSelected = get(propertyName); //in the form Going to an edit Screen? Perhaps you should use javascript to ensure only one is selected. Or use rowsSelected.size here Duane -Original Message- From: Enda Dowling [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 07, 2005 10:07 AM To: user@struts.apache.org Subject: DynaForms Radio Buttons Hey, I am running into a problem with trying to create radio buttons with a dynamic amount of entries on the page. It is meant to be a very simple page where there are options and you just select Yes or No. The only thing is the number of options that are presented to the user is dynamic which means there needs to be a dynamic number of radio buttons present on the page. I started to use DynaForms but I don't think im configuring it correctly. The form that holds the Radio Buttons will just take need to take in the Yes or No answers as the other data is already stored in the session. What would be the best way to take those values in from the page? Thanks, Enda - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Forwarding to the previous page
This works very well for me. a class=button href=javascript:history.back()Back/a -Original Message- From: Tremal Naik [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 07, 2005 7:24 AM To: Struts Users Mailing List Subject: Forwarding to the previous page Hi, I have a menu on my application, which is tiled in all the pages. I have an action of the menu which is common to all the page in which I am, so the execute() method of the action class associated to it must return a forward to the page which called it. I know how to map the forward of an action to a specific, struts-config hard-coded page. How can I deal with this kind of dynamic forwarding? Id est forwarding the action to the page which called it? Thanks -- TREMALNAIK - 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]
Tomcat 5 issue
I need to know if Tomcat has a request timeout that can be configured. Looking into the server.xml, I see timeouts related to database connections, and session, and something called tcpSelectorTimeout I have a wierd scenario: Typically, logging massive amounts of data will overburden memory usage and create OutOfMemory exception in the JVM. We have a situation where running in DEBUG mode works where ERROR mode does not. This is backwards to what we are used to seeing. I believe if we up the minutes for our request timeout, we might be able to alleviate this issue. My hunch is that queuing the log.write is circumventing the request timeout; by the time the queue is empty, the objects are built and ready to render the page. In ERROR mode(log4J), the browser just quits after 2 minutes. Nothing in the log looks suspicious. Duane
RE: strut 1.2.7 and web.xml
I don't believe the web.xml would have to change to upgrage struts version, except of cource references to Struts.jar etc. I believe the header has to be in Sync with the Tomcat/web-app version you're using. For example, I have Tomcat5.0.28 and my web.xml begins as such: ?xml version=1.0 encoding=UTF-8? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 filter filter-nameRmeSessionFilter/filter-name filter-classcom.ccistech.rme.portal.util.RmeSessionFilter/filter-clas s /filter. -Original Message- From: Phan, Hienthuc T (Rosetta) [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 4:52 PM To: 'Struts Users Mailing List' Subject: strut 1.2.7 and web.xml Hi, I'm in process of upgrading of strut 1.0 to 1.2.7 but cannot start the app server because of this error. Is this the correct tld declaration for web.xml? ?xml version=1.0 encoding=UTF-8? !DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd' Servlet: action failed to preload on startup in webapp: rpm javax.servlet.ServletException at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl. java :912) at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImp l.ja va:833) at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl .jav a:773) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServ letC ontext.java:2782) at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebAppSer vlet Context.java:2727) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppSe rvle tContext.java:2700) at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java:56 3) at weblogic.servlet.internal.WebService.preloadResources(WebService.java:47 6) at weblogic.t3.srvr.ServletInitRunner$1.run(ServletInitRunner.java:50) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceMa nage r.java:780) at weblogic.t3.srvr.ServletInitRunner.run(ServletInitRunner.java:46) at java.lang.Thread.run(Thread.java:479) -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Conditionally show values in Tile (c:when?)
%=errmsg.toString().length()% %--correctly prints the expected value--% I believe the scriptlet is evaluated at runtime(server-side). Is it possible you have a bean property holding this: errmsg 'expected value' ? tiles:useAttribute id=errmsg name=FieldError scope=page/ However the JSTL is explicitly directed to Page-scope for this. See a problem? To address your previos question, I believe Tiles does not impose any limitation on your JSTL. -Original Message- From: Albrecht Leiprecht [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 8:34 AM To: 'Struts Users Mailing List'; [EMAIL PROTECTED] Subject: RE: Conditionally show values in Tile (c:when?) Let me rephrase the question Is there any limitation on using JSTL in Tiles ??? Rgs albi -Original Message- From: Albrecht Leiprecht [mailto:[EMAIL PROTECTED] Sent: Thursday, August 11, 2005 3:28 PM To: 'Struts Users Mailing List' Subject: Conditionally show values in Tile (c:when?) Hi all, I have a tile that shows my default input row in a form. In case that I put a value in FieldError, I want it to show it the errorMessage in red color. So far so good. The values get to the tile (formRow)... and there it's getting somewhat tricky. After reading a number of explanations, I understands that struts.apache.org recommends to use JSTL whenever possible... thus I use the c:when/c:otherwise construct like follows tiles:useAttribute id=errmsg name=FieldError scope=page/ td %=errmsg.toString().length()% %--correctly prints the expected value--% c:choose c:when test=${errmsg.toString().length() 0} font color=#FF tiles:getAsString name=FieldError/ /font /c:when c:otherwise img src=/img/blank.gif height=1 width=111 %--unexpectedly always shows this--% /c:otherwise /c:choose /td Substitutes using logic:greaterThat are showing the same strange behavior... Any Idea why this happens ? Any Tutorials, I could look up ? TIA, albi - 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: validate() not called haunts
p. Now i have got the debugging working. But Since debugging is working, try catching a breakpoint where validate is being called, then step-into... My best guess is the method signatures need to be verified. INO, are you overridding validate or overloading? You may be invoking the superclass validate instead of the intended forms' validate. If all else fails, place a breakpoint/sys.out in Struts' ActionForm.validate to see if it's getting there. Happy debugging, Duane -Original Message- From: Jay Sheth [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 9:23 AM To: Struts Users Mailing List Subject: validate() not called haunts Hi, Thanks for all the help. Now i have got the debugging working. But still the problem remains, validate() not being called. I tried all combinations...I made a simple action and form without any business logic etc...but i dont understand why validate method is being called in only a single form and not being called for any other forms. Most weird error. Even if I call validate from the corresponding action, it does not get called. However if I rename the validate method by another method e..g update then I can call the update method from action. Is there a way that the action errors created can be shown as error by jsp page ? Heres the code ; **action form.update(mapping,request); // form.validate() doesnt get called so i renamed to update() **form public ActionErrors update(ActionMapping mapping, ServletRequest request) { super.validate(mapping,servlet); errors = new ActionErrors(); if (nullOrBlank(m_location)) { errors.add(Location,new ActionError(errors.location.required)); } return new ActionErrors(); } So basically the action class can get the errors, but how should i display that errors on jsp (This is all because validate() not being called). Jay - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Nice try (was Java code generator including Struts 1.2)
Version 3.0? -Original Message- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 1:51 PM To: 'Struts Users Mailing List' Subject: AW: Nice try (was Java code generator including Struts 1.2) Su, but those generators are pain in the ass... You generate with generator version 1.0, customize the code, version 2.0 comes out with cool features, what now ? :-) Regards Leon -Ursprüngliche Nachricht- Von: Lindholm, Greg [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 10. August 2005 19:18 An: Struts Users Mailing List Betreff: RE: Nice try (was Java code generator including Struts 1.2) That's a very narrow view of code generators. There are plenty of domains where the generator is used once to give the programmer a starting point. (I'm not commenting on nor judging this guys stuff.) -Original Message- From: Leon Rosenberg [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 1:05 PM To: 'Struts Users Mailing List' Subject: AW: Nice try (was Java code generator including Struts 1.2) Hmm... I think you clearly offence the rule one for generators: generated code should never be touched! Regards leon - 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: Validator...the 1001st question...
shouldn't it show error.saluation.makechoice instead ?? It should. Do any of your other messages work, or is it possible that error.saluation.makechoice is not in your .properties file, or worse, the file is not being found in your classes directory? OK, We can assume the file is found if the default msg works... Am I stupid LOL . Not enough information provided :- Sorry, you asked for that one. Duane We all ask that one from time to time; it comes with the territory. -Original Message- From: Albrecht Leiprecht [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 2:23 PM To: 'Struts Users Mailing List' Subject: Validator...the 1001st question... Hi all, I'm curious ... shouldn't it be possible to override the default error message assigned to a validator rule ? Here's the example: validator.xml [...] field depends=validwhen property=salutation msg name=testmsg key=error.saluation.makechoice/ arg key=label.salutation position=0/ var var-nametest/var-name var-value(*this* != u)/var-value /var /field [...] validator-rules.xml [...] validator name=validwhen msg=errors.required classname=org.apache.struts.validator.validwhen.ValidWhen method=validateValidWhen methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest/ [...] I understand, that the errors.required is the default msg. And thats exactly what gets shown in case of an error. Am I stupid or shouldn't it show error.saluation.makechoice instead ?? scratching his head albi - 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: Validator...the 1001st question...
Based on the following... field property=codeType depends=required, maxlength msg name=required key=errors.required / msg name=maxlength key=errors.maxlength/ arg0 key=Code Type resource=false/ arg1 name=maxlength key=${var:maxlength} resource=false/ var var-namemaxlength/var-name var-value20/var-value /var /field Try this in your own... Change: msg name=testmsg To: msg name=salutation -Original Message- From: Albrecht Leiprecht [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 2:23 PM To: 'Struts Users Mailing List' Subject: Validator...the 1001st question... Hi all, I'm curious ... shouldn't it be possible to override the default error message assigned to a validator rule ? Here's the example: validator.xml [...] field depends=validwhen property=salutation msg name=testmsg key=error.saluation.makechoice/ arg key=label.salutation position=0/ var var-nametest/var-name var-value(*this* != u)/var-value /var /field [...] validator-rules.xml [...] validator name=validwhen msg=errors.required classname=org.apache.struts.validator.validwhen.ValidWhen method=validateValidWhen methodParams=java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionMessages, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest/ [...] I understand, that the errors.required is the default msg. And thats exactly what gets shown in case of an error. Am I stupid or shouldn't it show error.saluation.makechoice instead ?? scratching his head albi - 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: Javascript + Struts html:hidden write='true' tag problem
Thanks for your response. In the code in question, disabled is a local variable passed in as a parameter on the function, and does not refer to the form properties state. Although, this may lead to a hint of the 'reserved word' behavior I was trying to track. I suspected 'locked' was the culprit, but this gives me another avenue to test. Thanks! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Saturday, August 06, 2005 1:46 AM To: Struts Users Mailing List Subject: Re: Javascript + Struts html:hidden write='true' tag problem Duane, As far as I understand, disabled is a property of the form which should be denoted as document.forms[0].disabled and not just by disabled as you have done in if(disabled ==true ) change it to: if( document.forms[0].disabled == true ) and it should work. This is the reason the if(...) is always evaluating to false (i.e the 'else' case). Amitava Basak ASE Tata Consultancy Services Limited Mailto: [EMAIL PROTECTED] Website: http://www.tcs.com Duane Rosengartner [EMAIL PROTECTED] 08/06/2005 12:13 AM Please respond to Struts Users Mailing List user@struts.apache.org To struts-user@jakarta.apache.org cc Subject Javascript + Struts html:hidden write='true' tag problem I have the following Javascript primarily used to manipulate a CSS style and make a portion of a form visible. In the process, the achor invoking the JavaScript passes parameters from a table Row(resultset) displayed. In this Row, I have two bean properties declared as Java type Boolean. The toString() on the link resolves to 'true'/'false' correctly. I have placed alert tags in the javascript and have determined that the 'if' statements are working correctly also. The problem is that the two properties are behaving differently in the view, for reasons I cannot pin down. document.forms[0].disabled shows the correct status of the Row, document.forms[0].locked always shows false. I suspected 'locked' may be a reserved word, but have rewritten the bean and supporting code to rename the property, and this has had no effect. Things that DO WORK: The link is passing the correct values to JS, No JS error being thrown, as it would if the form property were not found. The visible, not visible works, also a checkbox instead shows the appropriate checked/not checked condition, so I can assume a page refresh is not the issue. Any other debug tips would be appreciated. Javascript: function PortalFilterForm_AccountDetails(rowId,rewardSummaryId,pin,inUse,disabled ) { //alert(rowId = + rowId + \nrewardSummaryId = + rewardSummaryId + \ninUse = + inUse + \ndisabled = + disabled); var detailElement = document.getElementById(accountDetail); detailElement.style.visibility = visible; var rid = document.getElementById(rid); rid.innerHTML = rowId; document.forms[0].rewardSummaryId.value = rewardSummaryId; document.forms[0].pin.value = pin; if(inUse == true){ document.forms[0].locked.checked = true; //alert(evaluated true); } else{ document.forms[0].locked.checked = false; //alert(evaluated false); } if(disabled == true) document.forms[0].disabled.checked = true; else document.forms[0].disabled.checked = false; //document.forms[0].locked.value = inUse; //document.forms[0].disabled.value = disabled; // also tried: //document.forms[0].locked.value = inUse + ; //document.forms[0].disabled.value = disabled + ; } JSP - Note the commented out code does not work (hidden write=true). The checkbox does work on both.. (Boolean type on both) ( Struts API says HTML:hidden requires String, but Boolean can be cast, and remember I have one working property, plus one not working ? ? ) td align=left width=15% %--html:hidden property=locked write=true/ --% html:checkbox property=locked disabled=true/ /td td align=right class=form-td-label width=15%span class=form-element-label Disabled /span/td td align=left %--html:hidden property=disabled write=true/--% html:checkbox property=disabled disabled=true/ /td * * a href=javascript:PortalFilterForm_AccountDetails(${row_rowNum},${row.rew ardSummaryId},${row.acctId},${row.inUse},${row.disabled}); class=fancy %=pageContext.getAttribute(row_rowNum)%/a ForwardSourceID:NT7576 Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
Javascript + Struts html:hidden write='true' tag problem
I have the following Javascript primarily used to manipulate a CSS style and make a portion of a form visible. In the process, the achor invoking the JavaScript passes parameters from a table Row(resultset) displayed. In this Row, I have two bean properties declared as Java type Boolean. The toString() on the link resolves to 'true'/'false' correctly. I have placed alert tags in the javascript and have determined that the 'if' statements are working correctly also. The problem is that the two properties are behaving differently in the view, for reasons I cannot pin down. document.forms[0].disabled shows the correct status of the Row, document.forms[0].locked always shows false. I suspected 'locked' may be a reserved word, but have rewritten the bean and supporting code to rename the property, and this has had no effect. Things that DO WORK: The link is passing the correct values to JS, No JS error being thrown, as it would if the form property were not found. The visible, not visible works, also a checkbox instead shows the appropriate checked/not checked condition, so I can assume a page refresh is not the issue. Any other debug tips would be appreciated. Javascript: function PortalFilterForm_AccountDetails(rowId,rewardSummaryId,pin,inUse,disabled ) { //alert(rowId = + rowId + \nrewardSummaryId = + rewardSummaryId + \ninUse = + inUse + \ndisabled = + disabled); var detailElement = document.getElementById(accountDetail); detailElement.style.visibility = visible; var rid = document.getElementById(rid); rid.innerHTML = rowId; document.forms[0].rewardSummaryId.value = rewardSummaryId; document.forms[0].pin.value = pin; if(inUse == true){ document.forms[0].locked.checked = true; //alert(evaluated true); } else{ document.forms[0].locked.checked = false; //alert(evaluated false); } if(disabled == true) document.forms[0].disabled.checked = true; else document.forms[0].disabled.checked = false; //document.forms[0].locked.value = inUse; //document.forms[0].disabled.value = disabled; // also tried: //document.forms[0].locked.value = inUse + ; //document.forms[0].disabled.value = disabled + ; } JSP - Note the commented out code does not work (hidden write=true). The checkbox does work on both.. (Boolean type on both) ( Struts API says HTML:hidden requires String, but Boolean can be cast, and remember I have one working property, plus one not working ? ? ) td align=left width=15% %--html:hidden property=locked write=true/ --% html:checkbox property=locked disabled=true/ /td td align=right class=form-td-label width=15%span class=form-element-label Disabled /span/td td align=left %--html:hidden property=disabled write=true/--% html:checkbox property=disabled disabled=true/ /td * * a href=javascript:PortalFilterForm_AccountDetails(${row_rowNum},${row.rew ardSummaryId},${row.acctId},${row.inUse},${row.disabled}); class=fancy %=pageContext.getAttribute(row_rowNum)%/a