RE: Error while upgrading from struts version 1.0 to 1.1
From the error log, it seems it's looking for the default logger which comes with jdk1.4. Have you configured to use a logger like log4j, if you havn't configured one, then Struts will try to use the logger from jdk1.4. So, try to configure log4j, or use jdk1.4 to see how it goes. The following thread may be helpful. http://www.faqchest.com/prgm/tomcat-l/tmct-02/tmct-0209/tmct-020998/tmct 02092603_04404.html -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 10:34 PM To: Struts Users Mailing List Subject: Re: Error while upgrading from struts version 1.0 to 1.1 Well I think my struts-config.xml is proper except I dont know what to put for controller /controller In web.xml file all parameters are proper Except following config/${module} and rulesets parameter . My aplication has only one module and I dont know what to put for RuleSet since I am using th e default one i.e. org.apache.commons.digester.RuleSet. Also I have moved the MessageResources has been moved from web.xml to struts-Config.xml. From the error I had set earlier. I think its failing in ActionServlet.init(). I am attaching the error file again. Thanks, Jignesh Saul Q Yuan [EMAIL PROTECTED] wrote: Well, here is a bit longer version of the reply. There are many changes from Struts 1.0.1 to 1.1, you can find a full description below: http://jakarta.apache.org/struts/userGuide/release-notes.html and the configuration changes below. http://jakarta.apache.org/struts/userGuide/configuration.html Back to your particular questions, yes, you'll need to define your Message resouce like the following: in Struts-config.xml file. And Struts1.1 works with JDK1.2 and up. HTH, Saul - Original Message - From: Jignesh Kapadia To: Struts Users Mailing List Sent: Monday, March 22, 2004 7:52 PM Subject: RE: Error while upgrading from struts version 1.0 to 1.1 Well, All the jar files are compiled properly. do we need to add some special parameter in in Struts-Config.xml file? It seems its looking for some Message Resource Factory Information. Also does Struts 1.1 work with JDK 1.3.* or we need to have JDK 1.4*? I am struggling with this for almost 2 days now. I created a new application and copied this Struts1.1/jar file along with the set of Commons.jar file. It will a good if somebody can help out in this. Thanks, Jignesh Saul Q Yuan wrote: I think you need to recompile your application against the new Struts.jar file and other jar files it depends on. Saul -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 1:55 PM To: [EMAIL PROTECTED] Subject: Error while upgrading from struts version 1.0 to 1.1 Hi , I am upgrading my current application from Struts 1.0 to Struts 1.1. The application is working properly with version 1.0. I just copied the struts 1.1 realted jar files in my web-inf/lib directory. Now when I restart my application it gives meError while loading Action Servlet. its failing in Super.init(). Is there anything I need to do other that just realcing the war files when I upgrade the Struts version. The error file is attached in e-mail. Thanks and Regards, Jignesh Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. Do you Yahoo!? http://taxes.yahoo.com/filing.html Yahoo! Finance Tax Center - File online. File on time.
Re: Error while upgrading from struts version 1.0 to 1.1
Can you run any example applications from Struts1.1 in your current enviroment, that is Webshpere, I think? just try to see if it's an upgrading issue or your application server setup issue. If it's an Websphere issue, you may have better luck from the Websphere user group. - Original Message - From: Jignesh Kapadia To: Struts Users Mailing List Sent: Tuesday, March 23, 2004 7:30 PM Subject: RE: Error while upgrading from struts version 1.0 to 1.1 Hi , Now today I tried it with the Simple Log and tried to run a very simple APP using in WSAD with Struts 1.1 and the Log file generated following error. 3/23/04 15:58:10:184 EST] 26c486ff ServletEngine A SRVE0169I: Loading Web Module: Hello. [3/23/04 15:58:10:512 EST] 26c486ff WebGroup I SRVE0091I: [Servlet LOG]: JSP 1.1 Processor: init [3/23/04 15:58:10:512 EST] 26c486ff WebGroup I SRVE0091I: [Servlet LOG]: SimpleFileServlet: init [3/23/04 15:58:10:528 EST] 26c486ff WebGroup I SRVE0091I: [Servlet LOG]: InvokerServlet: init [3/23/04 15:58:10:684 EST] 26c486ff WebGroup I SRVE0091I: [Servlet LOG]: action: init [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.action.ActionResources', returnNull=true [INFO] PropertyMessageResources - -Initializing, config='ApplicationResources', returnNull=true [3/23/04 15:58:11:496 EST] 26c486ff HttpTransport A SRVE0171I: Transport http is listening on port 8,080. [3/23/04 15:58:11:496 EST] 26c486ff WSRegistryImp X Unable to initialize user registry class com.ibm.ejs.security.registry.nt.NTLocalDomainRegistryImpl for type Windows due to exception: Access is denied. [3/23/04 15:58:11:496 EST] 26c486ff StandardIniti W SECJ0007E: Error during security initialization. Exception com.ibm.ejs.security.registry.RegistryErrorException: Windows:Access is denied. I think Its not able to read any Property file in struts.jar file. Do we need to do any setting in web.xml ot struts-config.xml. The resoucebundle has already an entry in config.xml file. Please help, Jignesh Saul Q Yuan [EMAIL PROTECTED] wrote: From the error log, it seems it's looking for the default logger which comes with jdk1.4. Have you configured to use a logger like log4j, if you havn't configured one, then Struts will try to use the logger from jdk1.4. So, try to configure log4j, or use jdk1.4 to see how it goes. The following thread may be helpful. http://www.faqchest.com/prgm/tomcat-l/tmct-02/tmct-0209/tmct-020998/tmct 02092603_04404.html -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 10:34 PM To: Struts Users Mailing List Subject: Re: Error while upgrading from struts version 1.0 to 1.1 Well I think my struts-config.xml is proper except I dont know what to put for In web.xml file all parameters are proper Except following config/${module} and rulesets parameter . My aplication has only one module and I dont know what to put for RuleSet since I am using th e default one i.e. org.apache.commons.digester.RuleSet. Also I have moved the MessageResources has been moved from web.xml to struts-Config.xml. From the error I had set earlier. I think its failing in ActionServlet.init(). I am attaching the error file again. Thanks, Jignesh Saul Q Yuan wrote: Well, here is a bit longer version of the reply. There are many changes from Struts 1.0.1 to 1.1, you can find a full description below: http://jakarta.apache.org/struts/userGuide/release-notes.html and the configuration changes below. http://jakarta.apache.org/struts/userGuide/configuration.html Back to your particular questions, yes, you'll need to define your Message resouce like the following: in Struts-config.xml file. And Struts1.1 works with JDK1.2 and up. HTH, Saul - Original Message - From: Jignesh Kapadia To: Struts Users Mailing List Sent: Monday, March 22, 2004 7:52 PM Subject: RE: Error while upgrading from struts version 1.0 to 1.1 Well, All the jar files are compiled properly. do we need to add some special parameter in in Struts-Config.xml file? It seems its looking for some Message Resource Factory Information. Also does Struts 1.1 work with JDK 1.3.* or we need to have JDK 1.4*? I am struggling with this for almost 2 days now. I created a new application and copied this Struts1.1/jar file along with the set of Commons.jar file. It will a good if somebody can help out in this. Thanks, Jignesh Saul Q Yuan wrote: I think you need to recompile your application against the new Struts.jar file and other jar files it depends on. Saul -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED
Re: bean:message inside onclick javascript string?
Try move the onclick javascript function out, something like this: script language=javascript function verify() { var msg = beam:message key=confirm.paragraph.delete /; return confirm(msg); } /script html:submit property=command value=Delete onclick=return verify();/ Saul - Original Message - From: Craig Berry To: [EMAIL PROTECTED] Sent: Tuesday, March 23, 2004 9:46 PM Subject: bean:message inside onclick javascript string? I have a webpage on which I do a Javascript popup to confirm a deletion. The JSP fragment looks like this: html:submit property=command value=Delete onclick=return confirm('Are you sure you want to delete this paragraph permanently?')/ I would dearly love to replace that fixed text with bean:message key=confirm.paragraph.delete/, but all my experimentation has not succeeded in finding a relatively straightforward way to do this. I'm using the -el taglibs, if that matters. Anybody have ideas on an elegant solution? -- Craig Berry Principal Architect and Technical Manager PortBlue (310) 566-7546 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Error while upgrading from struts version 1.0 to 1.1
I think you need to recompile your application against the new Struts.jar file and other jar files it depends on. Saul -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 1:55 PM To: [EMAIL PROTECTED] Subject: Error while upgrading from struts version 1.0 to 1.1 Hi , I am upgrading my current application from Struts 1.0 to Struts 1.1. The application is working properly with version 1.0. I just copied the struts 1.1 realted jar files in my web-inf/lib directory. Now when I restart my application it gives meError while loading Action Servlet. its failing in Super.init(). Is there anything I need to do other that just realcing the war files when I upgrade the Struts version. The error file is attached in e-mail. Thanks and Regards, Jignesh Do you Yahoo!? http://taxes.yahoo.com/filing.html Yahoo! Finance Tax Center - File online. File on time.
RE: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert
Like Mark suggested, it'll help if you post the rendered jsp code here, ie. View source, copy and paste here. Saul -Original Message- From: Just Fun 4 You [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 3:37 PM To: 'Struts Users Mailing List' Subject: AW: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert I am pretty sure that this is a javascript issue. I am just wondering why it all works when I remove the \n character. What does it make the difference to javascript? Maybe others can jump in here. Again: having a string like \nsomeText\nAnotherText\n put in a ActionMessage object causes a javascript error (unterminated string constant). If I remove the \n character it works. When I code alert(\nsomeText\nAnotherText\n) directly into a html page, it also works. I am not sure what really goes on here. I cannot see any difference... -Ursprüngliche Nachricht- Von: Mark Lowe [mailto:[EMAIL PROTECTED] Gesendet: Montag, 22. März 2004 21:09 An: Struts Users Mailing List Betreff: Re: AW: AW: multiple lines in an ActionMessage object displayed via javascript alert Weird .. I thought it might be the accented characters but safari, msie mac and firefox all work. And mise 6 on windoze. If the message gets to your page then its a javascript issue, but i certainly cant recreate it. I assume that logic:messagesPresent /logic:messagesPresent doesn't appear in your rendered html.. On 22 Mar 2004, at 20:45, Just Fun 4 You wrote: Hi Mark, the properties file holds for critical.schedule.text: critical.schedule.text=Folgende Termine sind wg zeitlicher Überlastung für The rendered jsp looks like this: ... logic:messagesPresent script language=javascript alert(Folgende Termine sind wg zeitlicher Überlastung für Schmidt (SCHM05) kritisch: 16.03.2004: 11 PS Tagesaufwand) /script /logic:messagesPresent ... the following shows the source from the ActionClass: ActionMessages messages = new ActionMessages(); String noteText = + person.getPersonDataShort() + kritisch:\n; Iterator it = scheduleReportList.iterator(); while(it.hasNext()){ Object object = it.next(); if(object instanceof ScheduleModel){ ScheduleModel scheduleOversized = (ScheduleModel)object; noteText = noteText + scheduleOversized.formatSqlDateToDate(scheduleOversized.getStartDate() . toStr ing()) + : + scheduleOversized.getIntDailyManHour() + PS Tagesaufwand\n; } } if(messages != null){ System.out.println(Note: + noteText); messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(critical.schedule.text, noteText.trim())); saveMessages(request, messages); } thx, Dirk -Ursprüngliche Nachricht- Von: Mark Lowe [mailto:[EMAIL PROTECTED] Gesendet: Montag, 22. März 2004 18:25 An: Struts Users Mailing List Betreff: Re: AW: multiple lines in an ActionMessage object displayed via javascript alert Whats actually in your properties file..? Paste the rendered source into the reply, i think its a javascript problem. On 22 Mar 2004, at 18:04, Just Fun 4 You wrote: hm. In my ActionClass I have something like this: ActionMessages messages = new ActionMessages(); String text = \n: + getCriticalDate.toString() + --; text = text + getTotalHours() + hours.\n; messages.add(critical.schedule.text, text); saveMessages(request, messages); In my jsp: logic:messagesPresent script language=javascript html:messages id=message message=true alert(c:out value=${message} /) /html:messages /script logic:messagesPresent This does not work: I get a javascript error (unterminated string constant). However everything works and the text is being displayed when I remove the \n from the text. the evaluated text string looks something like this if I print the text string to the console (seems ok): The following dates are critical: 20.03.2004: 5 hours. I want this format exactly being displayed using the alert function. I cannot see where the problem is. any idea? thx, Dirk -Ursprüngliche Nachricht- Von: Mark Lowe [mailto:[EMAIL PROTECTED] Gesendet: Montag, 22. März 2004 00:46 An: Struts Users Mailing List Betreff: Re: multiple lines in an ActionMessage object displayed via javascript
Re: Error while upgrading from struts version 1.0 to 1.1
Well, here is a bit longer version of the reply. There are many changes from Struts 1.0.1 to 1.1, you can find a full description below: http://jakarta.apache.org/struts/userGuide/release-notes.html and the configuration changes below. http://jakarta.apache.org/struts/userGuide/configuration.html Back to your particular questions, yes, you'll need to define your Message resouce like the following: message-resources parameter=package.MyWebAppResources / in Struts-config.xml file. And Struts1.1 works with JDK1.2 and up. HTH, Saul - Original Message - From: Jignesh Kapadia To: Struts Users Mailing List Sent: Monday, March 22, 2004 7:52 PM Subject: RE: Error while upgrading from struts version 1.0 to 1.1 Well, All the jar files are compiled properly. do we need to add some special parameter in in Struts-Config.xml file? It seems its looking for some Message Resource Factory Information. Also does Struts 1.1 work with JDK 1.3.* or we need to have JDK 1.4*? I am struggling with this for almost 2 days now. I created a new application and copied this Struts1.1/jar file along with the set of Commons.jar file. It will a good if somebody can help out in this. Thanks, Jignesh Saul Q Yuan [EMAIL PROTECTED] wrote: I think you need to recompile your application against the new Struts.jar file and other jar files it depends on. Saul -Original Message- From: Jignesh Kapadia [mailto:[EMAIL PROTECTED] Sent: Monday, March 22, 2004 1:55 PM To: [EMAIL PROTECTED] Subject: Error while upgrading from struts version 1.0 to 1.1 Hi , I am upgrading my current application from Struts 1.0 to Struts 1.1. The application is working properly with version 1.0. I just copied the struts 1.1 realted jar files in my web-inf/lib directory. Now when I restart my application it gives meError while loading Action Servlet. its failing in Super.init(). Is there anything I need to do other that just realcing the war files when I upgrade the Struts version. The error file is attached in e-mail. Thanks and Regards, Jignesh Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time.
Re: Using struts-config to configure properties in action form
set-property is not a sub-tag of form-bean, form-property is though. If you're not using dynamic form bean, you don't need to define the properties in the form-bean tag. HTH, Saul - Original Message - From: Chan, Jim To: '[EMAIL PROTECTED]' Sent: Monday, March 22, 2004 8:27 PM Subject: Using struts-config to configure properties in action form I am trying to configure properties in my ActionForm using the struts-config file as follows. form-bean name=myForm type=com.myCompany.MyForm set-property property=foo value=bar / /form-bean public Class MyForm extends ActionForm { private String foo; public void setFoo(String foo) { this.foo = foo; } public String getFoo() { return foo; } } However, I am getting an error as follows. Anyone know if I am missing any steps? Any help is greatly appreciated. java.lang.NoSuchMethodException: Bean has no property named foo at org.apache.commons.digester.SetPropertyRule.begin(SetPropertyRule.java:192) at org.apache.commons.digester.Rule.begin(Rule.java:200) at org.apache.commons.digester.Digester.startElement(Digester.java:1273) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc her.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.commons.digester.Digester.parse(Digester.java:1548) at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.j ava:1006) at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:9 55) at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470) at javax.servlet.GenericServlet.init(GenericServlet.java:256) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:93 5) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:823) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java: 3422) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3623) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8 21) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j ava:307) at org.apache.catalina.core.StandardHost.install(StandardHost.java:788) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:559 ) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:401) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:718) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:358) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor t.java:166) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1196) at org.apache.catalina.core.StandardHost.start(StandardHost.java:754) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:363) at org.apache.catalina.core.StandardService.start(StandardService.java:497) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2190) at org.apache.catalina.startup.Catalina.start(Catalina.java:512) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 ) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl .java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
RE: Mapping Forward to new form
You can call ((UserForm) form).reset() before forwarding. Saul -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Friday, March 19, 2004 1:52 PM To: Struts User Mailing List Subject: Mapping Forward to new form Hey, I am adding user details to the DB through a form, on a successful insert I would like to map forward to the same form. The problem is when I use the action forward the form on the forwarded page is filled with the details from the user I just added. if(addUser((UserForm) form, request, response)) { return (mapping.findForward(adduser)); } I would like to map to a new blank form, how do I do this? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox and selected values
I am not sure you can get the session directly in the form bean, however, you can get the current session in your action class, and in your action class, try get the current user and set it in the form bean. -Original Message- From: Amish Patel [mailto:[EMAIL PROTECTED] Sent: Sunday, March 14, 2004 11:13 PM To: [EMAIL PROTECTED] Subject: Re: Multibox and selected values Saul, How can I access the current user from the form bean? The current user is in the session. So in other words my question is how can I access the session from the form bean? Thanks in advance for your help! From: Saul Q Yuan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Multibox and selected values Date: Sun, 14 Mar 2004 20:42:31 -0500 If I understand your questions correctly, you can define two String arrays in your form bean, one for allRoles, and the other for selectedRoles, which is the array of roles of the current user. Before forwarding to your jsp, in your action class, you can retrive all the roles of the currently user, and set the roles to the selectedRoles in the form bean. HTH, Saul - Original Message - From: Amish Patel To: [EMAIL PROTECTED] Sent: Sunday, March 14, 2004 11:59 AM Subject: Multibox and selected values Hello All, I am running into this problem, that I am not able figure out how to do it properly. I have searched the web and have not found a decent example. What I am trying to do is use html:multibox taglib to display a set of checkboxes. These check boxes represent the user's security preferences. So if the user has a particular security token, then the respective check box should be checked. In order for this to work properly, I have to get two things, all the security tokens that exits in the system. And I have to get the security tokens that the user already has. In my ActionForm, I have two methods: one that gets all the security tokens in the system and second that gets only the tokens that the user has. The following is what I am using in my jsp to display checkboxes. logic:iterate name=associateUserRoleForm property=allRoles id=element html:multibox property=selectedRoles bean:write name=element / /html:multibox bean:write name=element / br / /logic:iterate Right now I am able to get allRoles successfully, but in order to retrieve the selectedRoles, I need a way such that my ActionForm (associateUserRoleForm) can get hold of this user or this user's id, which is already in the session. Once I get this I can then display all the security tokens and check those tokens that the user already has. How can I do this? Am I on the right track or is there a better way to do this? Thank You very much for your help! -Semplice _ Get business advice and resources to improve your work life, from bCentral. http://special.msn.com/bcentral/loudclear.armx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Find things fast with the new MSN Toolbar - includes FREE pop-up blocking! http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/ - 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: Multibox and selected values
Well the idea is rather than accessing this jsp page directly, try accessing it through an action mapping, say /userInfo.do, so it goes through an Action first before landing on the jsp page. In the Action class, you can do all the data preparation work as discussed in previous emails. -Original Message- From: Amish Patel [mailto:[EMAIL PROTECTED] Sent: Monday, March 15, 2004 11:05 AM To: [EMAIL PROTECTED] Subject: RE: Multibox and selected values How can I do what you are telling me do. Look at my code logic:iterate name=associateUserRoleForm property=allRoles id=element html:multibox property=selectedRoles bean:write name=element / /html:multibox bean:write name=element / br / /logic:iterate How can I pass the user object to my associateUserRoleForm when there is no action invoked when the page is loaded. Lets say that when the page is loaded an action is invoked, how do I get the associateUserRoleForm and make sure that when the taglib is invoked on my page that same instance of associateUserRoleForm is used. Thanks in advance for your help! From: Saul Q Yuan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Subject: RE: Multibox and selected values Date: Mon, 15 Mar 2004 10:40:09 -0500 I am not sure you can get the session directly in the form bean, however, you can get the current session in your action class, and in your action class, try get the current user and set it in the form bean. -Original Message- From: Amish Patel [mailto:[EMAIL PROTECTED] Sent: Sunday, March 14, 2004 11:13 PM To: [EMAIL PROTECTED] Subject: Re: Multibox and selected values Saul, How can I access the current user from the form bean? The current user is in the session. So in other words my question is how can I access the session from the form bean? Thanks in advance for your help! From: Saul Q Yuan [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: Re: Multibox and selected values Date: Sun, 14 Mar 2004 20:42:31 -0500 If I understand your questions correctly, you can define two String arrays in your form bean, one for allRoles, and the other for selectedRoles, which is the array of roles of the current user. Before forwarding to your jsp, in your action class, you can retrive all the roles of the currently user, and set the roles to the selectedRoles in the form bean. HTH, Saul - Original Message - From: Amish Patel To: [EMAIL PROTECTED] Sent: Sunday, March 14, 2004 11:59 AM Subject: Multibox and selected values Hello All, I am running into this problem, that I am not able figure out how to do it properly. I have searched the web and have not found a decent example. What I am trying to do is use html:multibox taglib to display a set of checkboxes. These check boxes represent the user's security preferences. So if the user has a particular security token, then the respective check box should be checked. In order for this to work properly, I have to get two things, all the security tokens that exits in the system. And I have to get the security tokens that the user already has. In my ActionForm, I have two methods: one that gets all the security tokens in the system and second that gets only the tokens that the user has. The following is what I am using in my jsp to display checkboxes. logic:iterate name=associateUserRoleForm property=allRoles id=element html:multibox property=selectedRoles bean:write name=element / /html:multibox bean:write name=element / br / /logic:iterate Right now I am able to get allRoles successfully, but in order to retrieve the selectedRoles, I need a way such that my ActionForm (associateUserRoleForm) can get hold of this user or this user's id, which is already in the session. Once I get this I can then display all the security tokens and check those tokens that the user already has. How can I do this? Am I on the right track or is there a better way to do this? Thank You very much for your help! -Semplice _ Get business advice and resources to improve your work life, from bCentral. http://special.msn.com/bcentral/loudclear.armx - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: urgent:multibox client side validation
If you havn't done so, I'd suggest you view souce and see if you have the correct javascript code rendered in you jsp. If you set staticJavascript=true in your html:javascript ... tag, then the javascript should be rendered inside your jsp. You can even put in some alert box in your validator-rules.xml file to see if the required method actually gets called. BTW, do you have javascript validation working for other type of form fields? Saul - Original Message - From: Jignesh Patel To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] ; [EMAIL PROTECTED] Sent: Sunday, March 14, 2004 9:43 AM Subject: urgent:multibox client side validation Dear Friends, I have implemented multibox, everything is working fine. But I would like to validate the checkboxes, my purpose is atleast one checkbox will be selected from the user while submitting, if not message will be pop up. I am implementing javascript(client side) validation, My validation.xml contains following code field property=selectedMagazines depends=required arg0 key=interestsForm.selectedMagazines/ /field I have tried the code, which is posted by Yuan as follows in validator-rule.xml, but it didn't worked out. function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRequired = new required(); for (x in oRequired) { var field = form[oRequired[x][0]]; if (field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'select-one' || field.type == 'radio' || // -- true for single radio button, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'checkbox' || // -- true for single checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'password') { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } // -- get value for checked single radio button or checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 } else if (field.type == radio || field.type == checkbox) { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop].selected) { lastSelected = loop; value = field.options[loop].value; break; } } if(lastSelected 0 || trim(value).length == 0) { if(i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid=false; } } else if ((field.length 0) (field[0].type == 'radio' || field[0].type == 'checkbox')) { isChecked=-1; for (loop=0;loop field.length;loop++) { if (field[loop].checked) { isChecked=loop; break; // only one needs to be checked } } if (isChecked 0
Re: Multibox and selected values
If I understand your questions correctly, you can define two String arrays in your form bean, one for allRoles, and the other for selectedRoles, which is the array of roles of the current user. Before forwarding to your jsp, in your action class, you can retrive all the roles of the currently user, and set the roles to the selectedRoles in the form bean. HTH, Saul - Original Message - From: Amish Patel To: [EMAIL PROTECTED] Sent: Sunday, March 14, 2004 11:59 AM Subject: Multibox and selected values Hello All, I am running into this problem, that I am not able figure out how to do it properly. I have searched the web and have not found a decent example. What I am trying to do is use html:multibox taglib to display a set of checkboxes. These check boxes represent the user's security preferences. So if the user has a particular security token, then the respective check box should be checked. In order for this to work properly, I have to get two things, all the security tokens that exits in the system. And I have to get the security tokens that the user already has. In my ActionForm, I have two methods: one that gets all the security tokens in the system and second that gets only the tokens that the user has. The following is what I am using in my jsp to display checkboxes. logic:iterate name=associateUserRoleForm property=allRoles id=element html:multibox property=selectedRoles bean:write name=element / /html:multibox bean:write name=element / br / /logic:iterate Right now I am able to get allRoles successfully, but in order to retrieve the selectedRoles, I need a way such that my ActionForm (associateUserRoleForm) can get hold of this user or this user's id, which is already in the session. Once I get this I can then display all the security tokens and check those tokens that the user already has. How can I do this? Am I on the right track or is there a better way to do this? Thank You very much for your help! -Semplice _ Get business advice and resources to improve your work life, from bCentral. http://special.msn.com/bcentral/loudclear.armx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[OT] How to tell whether a HTML/JSP page is on the same machine as the Servlet it calls
Hi, I am trying to find out whether a HTML or JSP page in on the same machine as the Servlet it calls. The reason I want to do this is preventing a page not on the Servlet machine from posting to the Servlet. I tried comparing the Referer header info with the RemoteHost info, but unfortunately request.getRemoteHost() doesn't give me the real host name when the Servlet machine is behind the firewall. Any ideas about this? TIA, Saul
RE: client-side validation not working
Try to put some alerts in the validateDate javascript function in the validator-rules.xml file and see if the function is called. BTW, what version of Struts you are using? Saul -Original Message- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 10:12 AM To: Struts Users Mailing List Subject: RE: client-side validation not working To test the possibility of it being a problem with using html:image instead of html:submit, I replaced html:image by html:submit but got the same result, i.e., the client-side validation is not being invoked. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:42 AM To: Struts Users Mailing List Subject: Re: client-side validation not working Everything looks OK to me. Have you checked what javascript is being generated - use view source in your browser when you are looking at the page. is there a validateActivityViewForm() method and is that method doing the validations you expect? A second thought is how are you submitting your page - I had problems when I was using javascript with a link tag. If your doing that, then try putting an ordinary submit button on the page and see if that works. html:submitSave/html:submit Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 13, 2004 2:23 PM Subject: client-side validation not working Server-side validation is working fine, but I can't seem to get client-side working. I know I must be doing something wrong, but I can't figure out what it is :-( Here's a bit of the tile that uses validation: %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % html:form action=/SelectActivity onsubmit=return validateActivityViewForm(this) TABLE border=0 cellspacing=0 cellpadding=0 align=center ... html:text property=starting value= size=10/ ... html:text property=ending value= size=10/ ... logic:messagesPresent html:messages id=error TRTDFONT color=redSTRONGbean:write name=error//STRONG/FONTTDTR /html:messages /logic:messagesPresent /TABLE /html:form html:javascript formName=ActivityViewForm/ Here's the piece of validation.xml: formset form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ /field field property=ending depends=date arg0 key=ActivityViewForm.ending.displayname/ /field /form /formset Here's the Action entry from struts-config: action path=/SelectActivity name=ActivityViewForm type=portfolio.SelectActivityAction input=.activity.detail/ ActivityViewForm extends PortfolioForm which is declared thusly: public class PortfolioForm extends ValidatorForm implements Serializable { As I said, server-side validation is working fine, but the javascript on the client-side isn't getting activated. I hope someone can help me to resolve this quickly! Thanks very much, 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: client-side validation not working
So, did you find the validateDate function, and was it called? -Original Message- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 3:29 PM To: Struts Users Mailing List Subject: RE: client-side validation not working Struts 1.1 -Original Message- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 11:25 AM To: 'Struts Users Mailing List' Subject: RE: client-side validation not working Try to put some alerts in the validateDate javascript function in the validator-rules.xml file and see if the function is called. BTW, what version of Struts you are using? Saul -Original Message- From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 10:12 AM To: Struts Users Mailing List Subject: RE: client-side validation not working To test the possibility of it being a problem with using html:image instead of html:submit, I replaced html:image by html:submit but got the same result, i.e., the client-side validation is not being invoked. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED] Sent: Friday, February 13, 2004 9:42 AM To: Struts Users Mailing List Subject: Re: client-side validation not working Everything looks OK to me. Have you checked what javascript is being generated - use view source in your browser when you are looking at the page. is there a validateActivityViewForm() method and is that method doing the validations you expect? A second thought is how are you submitting your page - I had problems when I was using javascript with a link tag. If your doing that, then try putting an ordinary submit button on the page and see if that works. html:submitSave/html:submit Niall - Original Message - From: Anderson, James H [IT] [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 13, 2004 2:23 PM Subject: client-side validation not working Server-side validation is working fine, but I can't seem to get client-side working. I know I must be doing something wrong, but I can't figure out what it is :-( Here's a bit of the tile that uses validation: %@ taglib uri=/tags/struts-bean prefix=bean % %@ taglib uri=/tags/struts-html prefix=html % %@ taglib uri=/tags/struts-logic prefix=logic % html:form action=/SelectActivity onsubmit=return validateActivityViewForm(this) TABLE border=0 cellspacing=0 cellpadding=0 align=center ... html:text property=starting value= size=10/ ... html:text property=ending value= size=10/ ... logic:messagesPresent html:messages id=error TRTDFONT color=redSTRONGbean:write name=error//STRONG/FONTTDTR /html:messages /logic:messagesPresent /TABLE /html:form html:javascript formName=ActivityViewForm/ Here's the piece of validation.xml: formset form name=ActivityViewForm field property=starting depends=date arg0 key=ActivityViewForm.starting.displayname/ /field field property=ending depends=date arg0 key=ActivityViewForm.ending.displayname/ /field /form /formset Here's the Action entry from struts-config: action path=/SelectActivity name=ActivityViewForm type=portfolio.SelectActivityAction input=.activity.detail/ ActivityViewForm extends PortfolioForm which is declared thusly: public class PortfolioForm extends ValidatorForm implements Serializable { As I said, server-side validation is working fine, but the javascript on the client-side isn't getting activated. I hope someone can help me to resolve this quickly! Thanks very much, 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] - 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: messages/errors 2 form's 1 page
Do the two action mappings share the same form bean? If yes, that might be the problem. Try to use two separate form beans, see how it goes. Saul -Original Message- From: Mark Lowe [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 8:52 AM To: Struts Users Mailing List Subject: messages/errors 2 form's 1 page Hello I'm sure this has been answered before but I'm sick of googling for the answer. Using tiles I've 2 forms in one page. tiles:insert page=loginForm.jsp / tile:insert page=customerForm.jsp / Now both forms have some properties with the same names e.g. html:form action=/login.do html:text property=email / html:errors property=email / .. html:form action=/register.do html:text property=email / html:errors property=email / When i submit either form the errors are displayed in both forms. The only solution I can think of is to extend TileAction and validate in there, but I usuall just use tiles defs as forwards and don't bother with TileAction. Do i go down the TileAction route or something else? Cheers Mark - 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: accessing application.properties from JSP
Using bean:message inside a javascript should work, cause bean:message is processed first on the server. It works for me. It may help if you post your code here. Saul -Original Message- From: Marco Mistroni [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 12:02 PM To: 'Struts Users Mailing List' Subject: RE: accessing application.properties from JSP Hi, Actually my problem is that I have to make so that a javascript message can be internationalized, so I must get it from application.properties. But it looks like writing a bean:message inside a javascript method Does not work. Any workarounds? I assume that message resources are stored in servlet context.. if so, under Which name? Thanx and regards marco -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 03 February 2004 15:09 To: Struts Users Mailing List Subject: Re: accessing application.properties from JSP The same way it is done in the struts-example. -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 (cell) AIM: jmitchtx MSN: [EMAIL PROTECTED] - Original Message - From: Marco Mistroni [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 10:06 AM Subject: accessing application.properties from JSP Hi all, Does anyone know how to access application.resources from a JSP? With best regards Marco - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Multibox and Validation
This is a known issue for the release version of Struts1.1, but if you download a nightly build after Sep 24 2003, the required validation will work. Saul -Original Message- From: Justin Miller [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 9:43 AM To: [EMAIL PROTECTED] Subject: Multibox and Validation Hi all Is there an out of the box struts-validator way to check to see if at least one of x number of checkboxes has been checked using the html:multibox? I have been attempting to use the required and requiredif rules to no avail. Background: Struts 1.1 DynaValidatorActionForm Tomcat 4.1 Thanks in advance Justin - 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: Urgent: Call ActionClass from link
I guess you're missing the web context in the action, try use html:rewrite page=InfoAction.do / instead of InfoAction.do in the open function, that way it'll prefix the web context in the action. Saul -Original Message- From: Manuel Lenz [mailto:[EMAIL PROTECTED] Sent: Thursday, January 22, 2004 9:54 AM To: Struts Users Mailing List Subject: Urgent: Call ActionClass from link Hi to all, I still have the same problem and didn´t find any hint in the list archive. I want to call an ActionClass from a Link. This code should be run (I copied it from an archive topic): a class=leftnav href=javascript:window.open('InfoAction.do','windowName', 'status=no') But if I deploy this code my appServer returns an error: [INFO] RequestProcessor - -Processing a 'GET' for path '/InfoAction' [22.01.04 15:46:04:696 CET] 43b8e552 WebGroup X Servlet Error: : java.lang.NullPointerException at org.apache.struts.util.RequestUtils.forwardURL(RequestUtils.java:1223) But there exists an Action which has this name? Any idea why this doesn´t work? Manuel - 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: Radio button CHECKED ???
In your form bean, just initialize your radio property with the value of the radio button you want to be checked by default, then you're done. Saul -Original Message- From: Mauricio T. Ferraz [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 20, 2004 11:18 AM To: Struts Users Mailing List Subject: Radio button CHECKED ??? How to use the html:radio tag and define a specific radio with CHECKED by default ? p.e input type=radio name=radiobutton value=1 checked thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: action-path question
I don't think input accepts dynamcic values, but you can do the following to accomplish the same thing. You can define two forwards instead inside your action mapping, say, forward name=addInput path=/addUser.jsp / forward name=updateInput path=/updateUser.jsp / And in your action class, check for the existence of errors, and based on which page you're from, forward to the corresponding input page as defined above. Hope this helps. Saul -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Thursday, January 15, 2004 4:02 PM To: Struts User Mailing List Subject: action-path question Hey, Is it possible to use the same action path for two different inputs action path=/user type=com.myweb.application.actions.UserAction name=userForm scope=request input=? attribute=userForm / Id like the input to come from addUser.jsp if its an add and updateUser if its an update. input=/addUser.jsp or input=/updateUser.jsp Is there anyway to accomplish this? Thanks, Ciaran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
? File Upload bug for uploading files with French Character
Hi, I am trying to upload files with French characters, but all the French characters are replaced as ? in the file. The enviroment is: Tomcat4.0.3, Linux. I wonder if this is a bug with the version of Tomcat4.0.3 for Linux. thanks advance for any help. Saul
Re: Need some Multibox help.
It could be the form bean wfsContentForm or it's features property doesn't exist at the time you call the logic:iterate tag. Do you have your logic:iterate tag inside a html:form tag and defined the approprite mappings in struts-config?, the wfsContentForm bean will be created if yes. Otherwise, make sure wfsContentForm exists in one of the scopes, request, session etc. Saul - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, January 06, 2004 8:16 PM Subject: Need some Multibox help. Hi everyone. I need some simple multibox help here. I've gone through the example in the O Reilly book, and have thoroughly torn apart the example at http://j2ee.lagnada.com/struts/multibox-example1.htm and I cannot get mine to work. The problem lies in the logic:iterate's id tag. error: [ServletException in:/WEB-INF/pages/WFSConfigContent.jsp] Cannot find bean feature in any scope' Where id=feature Here's my code, which is mostly copied from the OReilly book. logic:iterate id=feature name=wfsContentForm property=features html:multibox property=selectedFeatures bean:write name=feature/ /html:multibox bean:write name=feature/ /logic:iterate Is there something I have to do to instantiate a bean named 'feature'? in the above example link, I can't find '_bean' referenced anywhere else. Thanks! Richard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to perform validation and then call another javascript function?
I think you can define a new Javascript function, and call the validateSubscriptionForm(this) first in the new function, and inside onsubmit call this new function instead. Something like the following: newFunction(form) { validate = validateSubscriptionForm(form); if(!validate) return false; // do other stuff you want; // return true of false based on your logic } and onsubmit=return newFunction(this) Saul - Original Message - From: Clark Kent [EMAIL PROTECTED] To: usergroup [EMAIL PROTECTED] Sent: Monday, December 29, 2003 6:49 PM Subject: How to perform validation and then call another javascript function? I have a form in which upon submit, depending on whether a certain checkbox is checked or not, it is directed to a certain action (if checked, then action 1, if unchecked, then action 2). With the following code, I am trying to validate the form. Now I need to perform the validation and also depending upon the checkbox condition (checked or not) I need to redirect it to one of 2 actions. UpdateSubscription() is a javascript function which directs to a certain action and then submits it. How can I do both the validation and also call this javascript function to redirect to different actions. Can I use any condition within the onsubmit= ? Any help would be appreciated? html:errors / html:javascript formName=subscriptionForm / html:form name=subscriptionForm onsubmit=return validateSubscriptionForm(this); html:submit property=submitEnrollment value=Submit onclick=updateSubscription();/ /html:form - Do you Yahoo!? Yahoo! Photos - Get your photo on the big screen in Times Square - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ApplicationResources.properties
Is the property file in the right place and in the class path after your War file expanded by Tomcat? If not, the War file was not deployed correctly. Saul - Original Message - From: Mark Nichols [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, December 20, 2003 5:38 PM Subject: ApplicationResources.properties Good Afternoon, My application works fine until I create a WAR file out of it and deploy it to Tomat. Once there I get a Missing message key for index.title error. This error doesn't occur when running the development copy of the application. I have made sure that the ApplicationResources.properties file is the correct place in the WAR file. I'm sure that I have overlooked something obvious, and I would be grateful for someone pointing it out. Thanks Mark -- The Difference Between Smart and Stupid is the Depth of the Hole You Make When You Screw Up. - 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: Object expected
Assuming it's not a typo, inside your onsubmit it should be return validateClientForm(this). Saul -Original Message- From: Ciaran Hanley [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 09, 2003 2:54 PM To: [EMAIL PROTECTED] Subject: Error: Object expected Hi, I'm trying to get use struts validator with my application. I am currently working with a very simple example, only checking that the required field has been filled but keep getting an Error: Object expected error I think the error is on the html:form action line Here is my JSP file: %@ page language=java % %@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean % %@ taglib uri=/WEB-INF/struts-html.tld prefix=html % %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic % html:html locale=true head titlebean:message key=form.title //title html:base/ /head centerh3bean:message key=form.heading /h3/centerhr center html:form action=/addclient focus=clientName onsubmit=return validateClient(this) table tr tdbean:message key=formdata.name //td tdhtml:text property=clientName //td /tr /table html:submit property=submit value=Submit / /html:form /center html:javascript formName=clientForm / /body /html:html Any help? Thanks in advance, Ciaran - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple design question
Then a simple answer, one solution would be, use a single form, two actions, and use action (path) based validation. Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:02 PM To: [EMAIL PROTECTED] Subject: simple design question I have a simple design question.. I have to forms. first form is one simple select box that needs to have the values populated from a db. This form needs to have validation and the submit to the second form. The second form need to populate a select box based on the value from the first form. This form also need to be validated and then forward on to the display jsp. How many form beans and actions will I need? I would like to use dynavalidatorforms as well. Current setup is an action that places an arraylist into an attribute of the request then forward to the first form. I dont know how to get the first form to auto validate and forward to the second form. nathan - 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: simple design question
Ok, then, 1. Let's say you declare your form as MyForm, which is of type DynaValidatorActionForm in Struts-config.xml. 2. And you declare your actions as /myAction1 and /myAction2 respectively. 3. Then in validation.xml, declare your validation as: form name=/myAction1 field ... arg0 ... / /field /form form name=/myAction2 field ... arg0 ... / /field /form 4. Add necessary codes in your jsp files to support client side JS validation. a. html:form action=/myAction1.do onsubmit=return validateMyForm(this); b. html:javascript formName=/myAction1 method=validateMyForm dynamicJavascript=true staticJavascript=false / script language=Javascript1.1 src=staticJavascript.jsp/script same for the other jsp page. Hope this helps Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:23 PM To: Struts Users Mailing List Subject: Re: simple design question This sounds like what I need! Can you explain a little more.. :) Thanks in advance, nathan On Nov 13, 2003, at 10:10 AM, Saul Q Yuan wrote: Then a simple answer, one solution would be, use a single form, two actions, and use action (path) based validation. Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:02 PM To: [EMAIL PROTECTED] Subject: simple design question I have a simple design question.. I have to forms. first form is one simple select box that needs to have the values populated from a db. This form needs to have validation and the submit to the second form. The second form need to populate a select box based on the value from the first form. This form also need to be validated and then forward on to the display jsp. How many form beans and actions will I need? I would like to use dynavalidatorforms as well. Current setup is an action that places an arraylist into an attribute of the request then forward to the first form. I dont know how to get the first form to auto validate and forward to the second form. nathan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: simple design question
It should work if the two html forms are on the same page, if that's what you want. Populating your selection box is another question, you probably need to prepare the data as collections in your action and send that to the request. There are tons of threads in the archive on this, so I'm not getting into the details. Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 3:05 PM To: Struts Users Mailing List Subject: Re: simple design question Sweet Now are you telling me that the two html form can be on the same page? What about pre-loading the select boxes with information? On Nov 13, 2003, at 10:43 AM, Saul Q Yuan wrote: Ok, then, 1. Let's say you declare your form as MyForm, which is of type DynaValidatorActionForm in Struts-config.xml. 2. And you declare your actions as /myAction1 and /myAction2 respectively. 3. Then in validation.xml, declare your validation as: form name=/myAction1 field ... arg0 ... / /field /form form name=/myAction2 field ... arg0 ... / /field /form 4. Add necessary codes in your jsp files to support client side JS validation. a. html:form action=/myAction1.do onsubmit=return validateMyForm(this); b. html:javascript formName=/myAction1 method=validateMyForm dynamicJavascript=true staticJavascript=false / script language=Javascript1.1 src=staticJavascript.jsp/script same for the other jsp page. Hope this helps Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:23 PM To: Struts Users Mailing List Subject: Re: simple design question This sounds like what I need! Can you explain a little more.. :) Thanks in advance, nathan On Nov 13, 2003, at 10:10 AM, Saul Q Yuan wrote: Then a simple answer, one solution would be, use a single form, two actions, and use action (path) based validation. Saul -Original Message- From: Nathan Maves [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 12:02 PM To: [EMAIL PROTECTED] Subject: simple design question I have a simple design question.. I have to forms. first form is one simple select box that needs to have the values populated from a db. This form needs to have validation and the submit to the second form. The second form need to populate a select box based on the value from the first form. This form also need to be validated and then forward on to the display jsp. How many form beans and actions will I need? I would like to use dynavalidatorforms as well. Current setup is an action that places an arraylist into an attribute of the request then forward to the first form. I dont know how to get the first form to auto validate and forward to the second form. nathan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Validation using mask
Try take out the - before \., ie. Use: ^[0-9a-zA-Z\.]*$ Saul -Original Message- From: Ramadoss Chinnakuzhandai [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 3:09 PM To: Struts Users Mailing List Subject: RE: Validation using mask Any suggestions or ideas for the below mail would be greatly appreciated. Tnx in advance, -Ram -Original Message- From: Ramadoss Chinnakuzhandai Sent: Wednesday, November 12, 2003 10:18 AM To: [EMAIL PROTECTED] Subject: Validation using mask Sorry for posting my prev question again... In my form I'm validating a TextField hostname in order to accept only ^[0-9a-zA-Z-\.]*$ in its input value using mask pattern in validation.xml. field property=hostname depends=required,mask,minlength,maxlength arg0 key=form.hostname/ arg1 key=${var:minlength} name=minlength resource=false/ arg2 key=${var:maxlength} name=maxlength resource=false/ msg name=mask key=errors.hostname.invalid/ var var-namemaxlength/var-name var-value63/var-value /var var var-nameminlength/var-name var-value1/var-value /var var var-namemask/var-name var-value^[0-9a-zA-Z-\.]*$/var-value /var /field The problem is that it DOES NOT accepting . character as part its input value. The same time I tested the same pattern for different TextField called ccID on the other page and I found it accepting . character as part of its input value field property=ccID depends=requiredif,mask arg0 key=form.creditcard.cid/ msg name=mask key=errors.hostname.invalid/ var var-namefield[0]/var-name var-valueccNoID/var-value /var var var-namefieldTest[0]/var-name var-valueEQUAL/var-value /var var var-namefieldValue[0]/var-name var-valuefalse/var-value /var var var-namemask/var-name var-value^[0-9a-zA-Z-\.]*$/var-value /var /field I'm just wondering why it does accepting the first field and why it does not for the second field? Please correct me where I'm going wrong or do I hv to modify the mask pattern in such a way that it accepts . character...?? -Ram - 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: Need a RegExp mask for: all charactors except for \, / and ?
Try this, ^[\\|\/|\?] or (^[\\|\/|\?])* for 0 or more matches Saul -Original Message- From: Kevin Wang [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 12, 2003 4:54 PM To: Struts Users Mailing List Subject: Need a RegExp mask for: all charactors except for \, / and ? Thanks in advance! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Redirect to a status Page on HTTP status 403
How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Redirect to a status Page on HTTP status 403
I think you can configure that in the web.xml file, something like befow: error-page error-code403/error-code location/http403.jsp/location /error-page you may need to check the dtd to see it's exact location in web.xml. Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 10:52 AM To: Struts Users Mailing List Subject: RE: How to Redirect to a status Page on HTTP status 403 Hi Saul, Thanks for your replay. I knew this is one solution. But in my case the user is redirected to status message from Struts controller or tomcat authenticator. I would prefer to redirect the user to a jsp page with a descriptive message. It would be fine , if I can define some how in a config file that, on HTTP status 403, redirect to the http403.jsp or so? is this possible? Thanks Alvin n [EMAIL PROTECTED] wrote: How about this: Call response.sendError(HttpServletResponse.SC_FORBIDDEN, some description msg) in your action if the user is not in the role; Saul -Original Message- From: alvin antony [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 9:49 AM To: Struts Users Mailing List Subject: How to Redirect to a status Page on HTTP status 403 Hi there, I have restricted the access to my actions with user Roles (in struts-config.xml and WEB.xml) and it works fine.. Thanks to JAAS. I couldn't't find the way to redirect user request to a status error page, in case he is not in the Role for requesting a page. any help? I am using... Struts1.1 Tomcat 4.1.27 any help would be appreciated! Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: OT - parsing a TSV file in java
Just a thought, another way to do it is, you can setup a odbc datasource to the file, and using jdbc-odbc bridge to read the file like from a database. Saul. - Original Message - From: rickchev [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 11, 2003 10:37 PM Subject: OT - parsing a TSV file in java All, I know this is off topic, but I'm stuck. I'm trying to read a TSV file in java for use in a struts application but the java buffered reader skips the first row of the data with the column headings and the StringTokenizer skips the fields that are separated by tabs but don't contain any data. I know I'm not the first to struggle with this. Any suggestions would help. Rick Chevalier - 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: Multiplying 2 columns on JSP page
You can do the multiplication in your bean WBConttBO, rather than in the jsp. Or you can use jstl in your jsp, which supports multiplication of two bean properties. Like: c:out value=${x*y} / Saul -Original Message- From: Srinivas Kusunam [mailto:[EMAIL PROTECTED] Sent: Friday, November 07, 2003 2:12 PM To: Struts Users Mailing List Subject: Multiplying 2 columns on JSP page I have a Collection Object (collection of OWBOReadFacade objects) in my session scope. For every object in the collection I have to multiply fld1 * fld2 and display on JSP. What is the best way or ways to do this??? Here is the sample code: logic:iterate id=contAList name=WBConttBO scope=session indexId=index bean:define id=wbpBRFacade name=contAList scope=page type=com.proj.OWBOReadFacade/ tr td class=text align=left bean:write name=wbpBRFacade property=wbpAgreementNumber/ /td td class=text align=right bean:write name=wbpBRFacade property=wbpAcreage/ /td td class=text align=right bean:write name=wbpBRFacade property=wbpRentalRatePerAcre/ /td td align=right FIELD1 * FIELD 2 I.e. (wbpAgreementNumber * wbpRentalRatePerAcre) /td /tr /logic:iterate I appreciate any suggestions. Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Sample Struts app, LogonAction.java, missing UserDatabase
The magic is they're all in the same package :-) Saul - Original Message - From: Mohammed Bustany [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, November 07, 2003 10:04 PM Subject: Sample Struts app, LogonAction.java, missing UserDatabase Hi all I just started learning about struts. I have a simple question about LogonAction.java. Maybe someone can shed some light on it. The source file uses 'UserDatabase ' as in: UserDatabase database = (UserDatabase) servlet.getServletContext(). getAttribute(Constants.DATABASE_KEY); but there is no import stmt for UserDatabase!!! I haven't tried compiling it yet, but how is that possible??? Thank you Mo __ Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard http://antispam.yahoo.com/whatsnewfree - 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: Phone Mask
I think it's like this: \d{3}\-\d{3}\-\d{4} Saul - Original Message - From: Rhet Behler [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Thursday, October 30, 2003 8:56 PM Subject: Phone Mask Does anyone know how to set the phone mask in the validation to only accept 3 integers then a dash 3 integers a dash then 4 integers? example: 123-456-7890 would be valid 123-a34-5780 would not be valid right now my phone mask look like this: constant constant-namephone/constant-name constant-value^\(?(\d{3})\)?[-| ]?(\d{3})[-| ]?(\d{4})$/constant-value /constant but it accepts letters and numbers. TIA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: validator for check box
I just submitted a bug and submitted a patch as well for this problem. Basically, the validator (javascript part) works fine for multiple checkboxes and radio buttons, but doesn't for a single checkbox or a single radio button. I modified the validateRequired method as below, you'll need to replace this method in the validator-rules.xml file. Works fine for me. Saul - function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRequired = new required(); for (x in oRequired) { var field = form[oRequired[x][0]]; if (field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'select-one' || field.type == 'radio' || // -- true for single radio button, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'checkbox' || // -- true for single checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'password') { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } // -- get value for checked single radio button or checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 } else if (field.type == radio || field.type == checkbox) { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop].selected) { lastSelected = loop; value = field.options[loop].value; break; } } if(lastSelected 0 || trim(value).length == 0) { if(i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid=false; } } else if ((field.length 0) (field[0].type == 'radio' || field[0].type == 'checkbox')) { isChecked=-1; for (loop=0;loop field.length;loop++) { if (field[loop].checked) { isChecked=loop; break; // only one needs to be checked } } if (isChecked 0) { if (i == 0) { focusField = field[0]; } fields[i++] = oRequired[x][1]; isValid=false; } } } if (fields.length 0) { focusField.focus(); alert(fields.join('\n')); } return isValid; } -Original Message- From: Jayaraman Dorai [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 12:49 PM To: Struts Users Mailing List Subject: RE: validator for check box Does any one have any ideas or have written code to validate that at least one item is selected on the check box? Would be interested in the javascript code for the same. On the server side, I can do that validation on the action form, though doing it through struts validator will be the ideal. Wondering why struts doesn't have it? Again, am I missing
RE: validator for check box
This situation happens when the checkboxes and/or radio buttons are dynamically generated from a database or somewhere. You won't know for sure that there are going to be more than one checkboxes and radio buttons, sometimes, you just get one. But in your application, you want to have a consistent implementation and make them required regardless. I just ran into this situation. Saul -Original Message- From: Jayaraman Dorai [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 2:00 PM To: Struts Users Mailing List Subject: RE: validator for check box Been using an older version of validator-rules, which I had customized and so the multi-check box wasn't working. Required for a single-checkbox is not need for an application, since you are compelling the user to have that one choice selected. If you have only one check box and that too is required, you need not ask an user to enter them. -Original Message- From: Saul Q Yuan [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 29, 2003 1:06 PM To: 'Struts Users Mailing List' Subject: RE: validator for check box I just submitted a bug and submitted a patch as well for this problem. Basically, the validator (javascript part) works fine for multiple checkboxes and radio buttons, but doesn't for a single checkbox or a single radio button. I modified the validateRequired method as below, you'll need to replace this method in the validator-rules.xml file. Works fine for me. Saul - function validateRequired(form) { var isValid = true; var focusField = null; var i = 0; var fields = new Array(); oRequired = new required(); for (x in oRequired) { var field = form[oRequired[x][0]]; if (field.type == 'text' || field.type == 'textarea' || field.type == 'file' || field.type == 'select-one' || field.type == 'radio' || // -- true for single radio button, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'checkbox' || // -- true for single checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 field.type == 'password') { var value = ''; // get field's value if (field.type == select-one) { var si = field.selectedIndex; if (si = 0) { value = field.options[si].value; } // -- get value for checked single radio button or checkbox, Saul Q Yuan ([EMAIL PROTECTED]) 10/28/03 } else if (field.type == radio || field.type == checkbox) { if (field.checked) { value = field.value; } } else { value = field.value; } if (trim(value).length == 0) { if (i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid = false; } } else if (field.type == select-multiple) { var numOptions = field.options.length; lastSelected=-1; for(loop=numOptions-1;loop=0;loop--) { if(field.options[loop].selected) { lastSelected = loop; value = field.options[loop].value; break; } } if(lastSelected 0 || trim(value).length == 0) { if(i == 0) { focusField = field; } fields[i++] = oRequired[x][1]; isValid=false; } } else if ((field.length 0) (field[0].type == 'radio' || field[0].type == 'checkbox')) { isChecked=-1; for (loop=0;loop field.length;loop++) { if (field[loop].checked) { isChecked=loop; break; // only one needs to be checked
RE: how to disable (or work around) jsessionid in html:img sources
-Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:32 AM To: Struts Users Mailing List Subject: Re: how to disable (or work around) jsessionid in html:img sources James Mitchell wrote: A bit of history on this subject: * From: Craig R. McClanahan * Subject: Re: Why would jsessionid not appear? * Date: Wed, 08 Aug 2001 12:09:26 -0700 The jsessionid path parameter will only be added if the servlet container does not know whether your client supports cookies. How Tomcat handles this (probably typical of others): * On the first response in a session, send the session id both ways (cookie and encoding). * If the subsequent request comes back with a cookie, turn of URL rewriting for the remainder of this session. * If the subsequent request comes back without a cookie, keep on rewriting. Craig So, with that having been said, all you have to do is tell all your users to hit refresh whenever they access your site. That way, all external links and images will work. If you find that unacceptable, you could: Move the contents of index.jsp to index2.jsp, then: Put a meta refresh tag as your initial page (index.jsp). META HTTP-EQUIV=refresh content=2;URL=http://www.yoursite.com/index2.jsp; or Add some javascript that sends the user to index2.jsp. (similar to above) or Use logic:redirect or any number of ways in a scriptlet to redirect to index2.jsp On the Struts-Atlanta web site (http://www.struts-atlanta.org), I take a slightly different approach. At the top of my index.jsp, I do this: logic:present parameter=refresh bean:parameter id=refreshed name=refresh/ /logic:present logic:notEqual name=refreshed value=true logic:redirect page=/index.jsp?refresh=true/ /logic:notEqual What this does is refresh the page one time only. This method works for me because I am not posting or processing any forms with this page which would not work correctly if I had. Hope that helps. Thanks, James. Ignoring for the moment how these workarounds smack of hack, this doesn't solve the problem of people visiting the site w/o cookies enabled. What I don't understand is why the delimiter ';' is being used, instead of the traditional '?' - which Apache wouldn't have a problem stripping off and serving up the proper file with ... That seems to be a rule in the Servlet specification on URL rewriting for passing session info. http://www.jcp.org/aboutJava/communityprocess/first/jsr053/servlet23_PFD .pdf Saul Just to clarify - by calling these workarounds hacks - I mean no disrespect - I am just looking for a cleaner method of handling this. That's all. Brice -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: how to disable (or work around) jsessionid in html:img sources
-Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 11:27 AM To: Struts Users Mailing List Subject: Re: how to disable (or work around) jsessionid in html:img sources Saul Q Yuan wrote: -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Thursday, October 23, 2003 9:32 AM To: Struts Users Mailing List Subject: Re: how to disable (or work around) jsessionid in html:img sources James Mitchell wrote: A bit of history on this subject: * From: Craig R. McClanahan * Subject: Re: Why would jsessionid not appear? * Date: Wed, 08 Aug 2001 12:09:26 -0700 The jsessionid path parameter will only be added if the servlet container does not know whether your client supports cookies. How Tomcat handles this (probably typical of others): * On the first response in a session, send the session id both ways (cookie and encoding). * If the subsequent request comes back with a cookie, turn of URL rewriting for the remainder of this session. * If the subsequent request comes back without a cookie, keep on rewriting. Craig So, with that having been said, all you have to do is tell all your users to hit refresh whenever they access your site. That way, all external links and images will work. If you find that unacceptable, you could: Move the contents of index.jsp to index2.jsp, then: Put a meta refresh tag as your initial page (index.jsp). META HTTP-EQUIV=refresh content=2;URL=http://www.yoursite.com/index2.jsp; or Add some javascript that sends the user to index2.jsp. (similar to above) or Use logic:redirect or any number of ways in a scriptlet to redirect to index2.jsp On the Struts-Atlanta web site (http://www.struts-atlanta.org), I take a slightly different approach. At the top of my index.jsp, I do this: logic:present parameter=refresh bean:parameter id=refreshed name=refresh/ /logic:present logic:notEqual name=refreshed value=true logic:redirect page=/index.jsp?refresh=true/ /logic:notEqual What this does is refresh the page one time only. This method works for me because I am not posting or processing any forms with this page which would not work correctly if I had. Hope that helps. Thanks, James. Ignoring for the moment how these workarounds smack of hack, this doesn't solve the problem of people visiting the site w/o cookies enabled. What I don't understand is why the delimiter ';' is being used, instead of the traditional '?' - which Apache wouldn't have a problem stripping off and serving up the proper file with ... That seems to be a rule in the Servlet specification on URL rewriting for passing session info. http://www.jcp.org/aboutJava/communityprocess/first/jsr053/servlet23_PF D .pdf Saul Seems strange that a rule would be set that breaks IETF standards, doesn't it? Or am I seeing this totally wrong? Not sure what's the rational why it's not using ? instead of :, I guess it has to do with security or something. Using ?jsessionid makes it looks like a general request parameter and can be easily accessed and modified by the applications. Just my thoughts. Saul -- Brice D. Ruth Sr. IT Analyst Fiskars Brands, Inc. - 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: Re-used Action class
You can use multi-page based validation as demonstrated in the Validator example in the Struts source. Basically it's like this: 1. set validate=false in your action mapping 2. set multiple input path for each page in your action mapping in case of validation errors 3. in your action, call the validation() method of your form bean, and forward to the input corresponding to the page you're validating on. Saul -Original Message- From: Chadha, Deepak (BLM) [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2003 10:14 AM To: [EMAIL PROTECTED] Subject: Re-used Action class Hi, I have a (hopefully) simple question. I have a ActionForm / Action pair invoked from several JSP pages (actually the JSP fragment is included into several JSP pages). I am trying to use the ActionForm.validate method in combination with the html:errors/ tag. The problem is that when there is a Form validation error, the INPUT property of the mapping is used to send the user back where he came from. However, there can only be 1 INPUT specified for a given mapping. In my case, I want to invoke the same action from several pages, and want the user to be sent back to correct errors on the page they were on. Any ideas? Thanks Deepak *** Confidentiality Notice *** This email, its electronic document attachments, and the contents of its website linkages may contain confidential health information. This information is intended solely for use by the individual or entity to whom it is addressed. If you have received this information in error, please notify the sender immediately and arrange for the prompt destruction of the material and any accompanying attachments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: exception handler
Yes, if you mean the Struts declarative exception handling. Better yet, it can catch any kind of exception of type Exception and it's subclasses, because the execute method in an Action class now throws an exception of Type Exception. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 10:21 AM To: [EMAIL PROTECTED] Subject: exception handler could struts exception handler catch ServletExceptions thrown from a servlet? thx - 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: exception handler
How do you configure that, it'd help if you post your configuration here. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 1:41 PM To: Struts Users Mailing List Subject: Re: exception handler I tried to configure that in struts.config, but the exceptions thrown out by servelts still go to the container. :( Saul Q Yuan wrote: Yes, if you mean the Struts declarative exception handling. Better yet, it can catch any kind of exception of type Exception and it's subclasses, because the execute method in an Action class now throws an exception of Type Exception. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 10:21 AM To: [EMAIL PROTECTED] Subject: exception handler could struts exception handler catch ServletExceptions thrown from a servlet? thx - 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: exception handler
Not sure what those exception handlers will do, but if you specify a path (pointing to a page) in the exception tags, you'll land in that page rather than an exception screen once an exception is caught. Another thought, I guess the order of those exceptions tag matters, the first one suppose to catch all the exceptions??? (Anyone please chime in with your ideas, I havn't found an answer in the source code), And try to throw any other type of exceptions in your action code, and see if it's caught by either your handler and/or the page specified in the path. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 2:49 PM To: Struts Users Mailing List Subject: Re: exception handler something like this: ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.1//EN http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd; struts-config !-- == Form Bean Definitions === -- form-beans !-- Logon form bean -- form-bean name=logonForm type=org.apache.struts.action.DynaActionForm form-property name=username type=java.lang.String / form-property name=password type=java.lang.String / /form-bean form-bean name=roleChoiceForm type=org.apache.struts.action.DynaActionForm form-property name=roleChoice type=java.lang.String / /form-bean /form-beans !-- == Exception Handlers == -- global-exceptions exception key=errors.general type=java.lang.Exception handler=reflex.exceptionHandler.GeneralExceptionHandler / exception key=errors.system type=com.infinity.framework.reflex2.exception.ReflexSystemException handler=reflex.exceptionHandle$ exception key=errors.application type=com.infinity.framework.reflex2.exception.ReflexAppException handler=reflex.exceptionHand$ exception key=errors.sessionExpired type=com.infinity.framework.reflex2.exception.ReflexSessionExpiredExcep ti on handler=reflex$ exception key=errors.unexpected type=com.infinity.framework.reflex2.exception.ReflexUnexpectedException handler=reflex.excepti$ exception key=errors.servlet type=javax.servlet.ServletException handler=reflex.exceptionHandler.GeneralExceptionHandler / /global-exceptions Saul Q Yuan wrote: How do you configure that, it'd help if you post your configuration here. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 1:41 PM To: Struts Users Mailing List Subject: Re: exception handler I tried to configure that in struts.config, but the exceptions thrown out by servelts still go to the container. :( Saul Q Yuan wrote: Yes, if you mean the Struts declarative exception handling. Better yet, it can catch any kind of exception of type Exception and it's subclasses, because the execute method in an Action class now throws an exception of Type Exception. Saul -Original Message- From: Yan Zhu [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 10:21 AM To: [EMAIL PROTECTED] Subject: exception handler could struts exception handler catch ServletExceptions thrown from a servlet? thx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Deprecating ActionError/ActionErrors
- Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, October 17, 2003 6:42 PM Subject: Deprecating ActionError/ActionErrors I don't know if this work is still ongoing, but I notice that ActionError and ActionErrors are deprecated, yet the validate method of DynaValidatorForm still returns an ActionErrors object. I looked at the validate method of DynaValidatorForm, and I'm confused. It doesn't seem to do what it says it does. AFAICT, this method *always* returns the empty ActionErrors object that's created with: ActionErrors errors = new ActionErrors(); Well, this is not true. According to the code, the errors object gets passed to the initValidator( ) method which returns a Validator object, and the validator object than calls the validate() method. Since Java pass by reference, the error object could be changed in the initValidator() method as well as in the subsequent validate() method. Saul If errors ARE found, they're never put into that ActionErrors object, they're stored in the protected ValidatorResults object. /** * Validate the properties that have been set from this HTTP request, * and return an codeActionErrors/code object that encapsulates any * validation errors that have been found. If no errors are found, return * codenull/code or an codeActionErrors/code object with no * recorded error messages. * * @param mapping The mapping used to select this instance. * @param request The servlet request we are processing. * @return codeActionErrors/code object that encapsulates any validation errors. */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { this.setPageFromDynaProperty(); ServletContext application = getServlet().getServletContext(); ActionErrors errors = new ActionErrors(); Validator validator = Resources.initValidator(mapping.getAttribute(), this, application, request, errors, page); try { validatorResults = validator.validate(); } catch (ValidatorException e) { log.error(e.getMessage(), e); } return errors; } Can someone who knows what's happening with ActionError/ActionErrors please post a summary? -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - 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 question for radio buttons.
Well, some thoughts, do you have a page parameter in your jsp? Something like: input type=hidden name=page value=2 / and did you set validate=true in your action mapping? Saul -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2003 10:35 AM To: [EMAIL PROTECTED] Subject: Validator question for radio buttons. I have 3 radio buttons representing a property called paymentdetail.paymentTypeId, like this table width=80% border=0 cellspacing=4 cellpadding=4 name=paymentOptions align=center tr bgcolor=#CC td bgcolor=#efefef html:radio property=paymentdetail.paymentTypeId value=1 / Check/Money Order/td td bgcolor=#efefef html:radio property=paymentdetail.paymentTypeId value=2 / Please Waive Fee/td /tr tr bgcolor=#CC td colspan=2 bgcolor=#efefef html:radio property=paymentdetail.paymentTypeId value=3 /Purchase Order Numberhtml:text property=paymentdetail.paymentTypeNumber size=10 //td /tr and in the validation.xml i am doing this fieldproperty=paymentdetail.paymentTypeId depends=required page=2 arg0 key=registrationForm.payment.displayname/ /field The validator does not check if the field has been chosen or not. Please let me know if any one knows about this problem Thanxs --Mohan - 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]