Problem: JavaScript in StrutsForm
Hello there, may someone help me please? I tried to call a javascriptfunction from a Struts-Form. I need to do this because I want to calculate values in another SELECT box depending on the choice of this one ... and because a value changed event in a form doesn´t cause a submit ... i need this?! And i can´t get it to work: html:form action=assignDocument.do table tr tdChoose:/td td html:select property=typeId size=1 onchange='document.forms[0].submit()' html:options collection=typeRefCodes property=refC labelProperty=refT/ /html:select /td /tr /html:form I get an javascript error that submit is not a function. Does anybody have an idea. It works fine without the javascript and everything seems to be configured properly. Thanks in advance Wolfgang Herr Dipl. Math. Wolfgang Frank Email: [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Problem: JavaScript in StrutsForm
Hi David and Rob everybody ! Thanks for your help! Your ideas were right. The problem is caused by the html:submit tag at the end of the form. I can still use this strus submit tag, when i give it a different 'propertyname' than 'submit' - which ist the default value. Here ist the code that works: html:form action=assignDocument.do html:select property=typeId size=1 onchange=submitForm() html:options collection=typeRefCodes property=refC labelProperty=refT/ /html:select html:submit property=newbean:message key=FORM_global.button_new//html:submit /html:form Thanks once again and bye Wolfgang Herr Dipl. Math. Wolfgang Frank Email: [EMAIL PROTECTED] ## Wolfgang You probably have a html:submit tag? Struts generates a button with a name of 'submit' so JavaScript gets confused. It wasted so much of my time! You need to give your submit button a different name - can't recall how to do that right now because I stopped using the submit buttons and used links instead Rob Breeds David Lauta wrote: Here is what I have found to work: I think there might be a bug though script language=javascript function submitForm() { document.forms[0].submit(); return ( true ); } /script form:select property=firmId ondblclick=javascript:submitForm() onchange=javascript:submitForm() BR form:options collection=firms property=value labelProperty=label / /form:select Populating the options was a little tricky. The bug comes from the use of: html:submit bean:message key=button.insert/ /html:submit This tag adds a submit object to the document.forms[0] this causes (netscape at least) to report document.forms[0].submit() no such method To fix this use input type=submit instead of html:submit bean:message key=button.insert/ /html:submit There might be another way around this problem. Has any one else seen this? -Dave Wolfgang Frank wrote: Hello there, may someone help me please? I tried to call a javascriptfunction from a Struts-Form. I need to do this because I want to calculate values in another SELECT box depending on the choice of this one ... and because a value changed event in a form doesn´t cause a submit ... i need this?! And i can´t get it to work: html:form action=assignDocument.do table tr tdChoose:/td td html:select property=typeId size=1 onchange='document.forms[0].submit()' html:options collection=typeRefCodes property=refC labelProperty=refT/ /html:select /td /tr /html:form I get an javascript error that submit is not a function. Does anybody have an idea. It works fine without the javascript and everything seems to be configured properly. Thanks in advance Wolfgang Herr Dipl. Math. Wolfgang Frank Email: [EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- Thank you, David Lauta [EMAIL PROTECTED] (561)272-2698 (561)289-0502 cell -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
ActionForward to ActionClass
Hello there, i am currently trying to find a way to call another action (ActionB) from within an action (ActionA). as and ActionForeward object should be returned from an action i cerated a new ActionForward with the path of the URL, or the action i wanted to call, but it doesn´t seem to work. The problem is that i want to call ActionB with parameters: actionB.do?command=XY The parameters are calculated in ActionA . This is what I tried: ... ActionA extends Action { ActionForward perform(...) { return new ActionForward(actionB.do?command=XY); } } I can foreward directly with a requestdispatcher but browser doesn´t stop properly and continues loading. I think there should be a way using the STRUTS calsses .. Can anybody help please? I think I made some mistake .. Thank you Wolfgang
Re: submit button internationalization.
Have you tried: html:submit property=xmit styleClass=formField bean:message key=button.save/ /html:submit Where the key is defined in your ApplicationRessources. I guess that should do it ... Wolfgang Mark Gordon wrote: Has anyone come up with a cool way to internationalize a submit button using the html:submit tag? html:submit property=xmit value=%=org.apache.struts.util.RequestUtils.message(pageContext, org.apache.struts.action.Action.MESSAGES_KEY, org.apache.struts.action.Action.LOCALE_KEY,button.save)% styleClass=formField/ I was thinking about extending the html:submit tag to include an attribute valueKey and have that set the value. -Mark
Re: Thanks ....... AgStream Struts
it was the dtd that couldn't be found by silverstream . i had to put it in the installation bin directory .. thanks for your support ! Wolfgang
Struts with SilverStream
Hi there, does anybody have experienece how to integrate STRUTS in the SilverStream J2EE Server? I uploaded my struts WAR ... i can see the jsp if i directly link up to them but i get an bad request error when i call an action. The same application ran without failure on tomcat ... Any ideas? thanks and greets Wolfgang
Thanks ....... AgStream Struts
Hello joey, thanks for your fast reply in the struts-user group. I made a very minimal example maybe you can figure out with you knowledge where I went wrong . I just have to jsps and one Action the link on the first jsp fires the action, which simply forwards to the second jsp. I deploy with the command: silvercmd deploywar localhost eTest TestWar.war -f deployWAR.xml -o Deployment looks good and there are no exceptions. :-) Afterwards i go to: http://localhost/eTest/testapp/index.jsp So far so good .. i can see the Link and if i move my mouse over the link i see in the statusbar that: http://localhost/eTest/testapp/testAction.do is to be fired ok i do it and then .. 1. IExplorer : Error 400 Bad Request 2. Netscape: Invalid path /testAction was requested Maybe it´s a bug in the Ag373 version? ok . Thanks in advance if you find the time to look at my problem or if you can help me further ... Greets from germany Wolfgang The Deploymentplan deployWAR.xml ... ?xml version=1.0 encoding=UTF-8? !DOCTYPE warJarOptions PUBLIC -//SilverStream Software, Inc.//DTD J2EE WAR Deployment Plan//EN deploy_war.dtd ?AgMetaXML 1.0? warJarOptions isObject=true warJar isObject=true isEnabled type=BooleanTrue/isEnabled warJarNameexamples.war/warJarName deployToFilesystem type=Booleanfalse/deployToFilesystem sessionTimeout type=String25/sessionTimeout urls type=StringArray eltestapp/el /urls deployedObject type=StringTestAppDeployed/deployedObject /warJar /warJarOptions index.jsp --- HTML a href=testAction.doDo Test!/a /HTML perform.jsp --- HTML Action was performed ... /HTML web.xml . looks about - ... servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param load-on-startup1/load-on-startup /servlet !-- Struts Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping ... etc ... struts-config ... - action-mappings actionpath=testAction actionClass=de.test.actions.TestAction forward name=successpath=/performed.jsp/ /action /action-mappings classes: de.test.actions.TestAction.java package de.test.actions; import java.io.IOException; import org.apache.struts.action.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.*; import org.apache.struts.util.PropertyUtils; public class TestAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(TestAction ...); return mapping.findForward(success); } }
Re: Thanks ....... AgStream Struts
Hello Barry, i tried different webengines and the same example runs with no problems on tomcat323 ... I tried also differend types of struts-config.xml . styles . also that version ...: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.0//EN http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd; struts-config action-mappings action path=/testAction type=de.test.actions.TestAction/ /action-mappings /struts-config but nothing worked on AgStream :-( And there shouldn't be changes in mappings depending on the server ? Someone from the silverstream support told me right know that he also couldn't get the struts-examples of silverstream (devcenter.silverstream.com, e.g. dataview.zip) to work with an other version than 371 he get´s the same strange errors ... AgStream not J2EE compliant??? ;-) peace Wolfgang Barry Glasco wrote: This would lead me to believe that your struts-config.xml is not configured properly. Deploy the example application and see how it works. Also 373 fixed allot of bugs related to j2ee in ss3 so that is not the problem. -Original Message- From: Wolfgang Frank [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 11:00 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Thanks ... AgStream Struts Hello joey, thanks for your fast reply in the struts-user group. I made a very minimal example maybe you can figure out with you knowledge where I went wrong . I just have to jsps and one Action the link on the first jsp fires the action, which simply forwards to the second jsp. I deploy with the command: silvercmd deploywar localhost eTest TestWar.war -f deployWAR.xml -o Deployment looks good and there are no exceptions. :-) Afterwards i go to: http://localhost/eTest/testapp/index.jsp So far so good .. i can see the Link and if i move my mouse over the link i see in the statusbar that: http://localhost/eTest/testapp/testAction.do is to be fired ok i do it and then .. 1. IExplorer : Error 400 Bad Request 2. Netscape: Invalid path /testAction was requested Maybe it´s a bug in the Ag373 version? ok . Thanks in advance if you find the time to look at my problem or if you can help me further ... Greets from germany Wolfgang The Deploymentplan deployWAR.xml ... ?xml version=1.0 encoding=UTF-8? !DOCTYPE warJarOptions PUBLIC -//SilverStream Software, Inc.//DTD J2EE WAR Deployment Plan//EN deploy_war.dtd ?AgMetaXML 1.0? warJarOptions isObject=true warJar isObject=true isEnabled type=BooleanTrue/isEnabled warJarNameexamples.war/warJarName deployToFilesystem type=Booleanfalse/deployToFilesystem sessionTimeout type=String25/sessionTimeout urls type=StringArray eltestapp/el /urls deployedObject type=StringTestAppDeployed/deployedObject /warJar /warJarOptions index.jsp --- HTML a href=testAction.doDo Test!/a /HTML perform.jsp --- HTML Action was performed ... /HTML web.xml . looks about - ... servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameconfig/param-name param-value/WEB-INF/struts-config.xml/param-value /init-param load-on-startup1/load-on-startup /servlet !-- Struts Action Servlet Mapping -- servlet-mapping servlet-nameaction/servlet-name url-pattern*.do/url-pattern /servlet-mapping ... etc ... struts-config ... - action-mappings actionpath=testAction actionClass=de.test.actions.TestAction forward name=successpath=/performed.jsp/ /action /action-mappings classes: de.test.actions.TestAction.java package de.test.actions; import java.io.IOException; import org.apache.struts.action.*; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.*; import org.apache.struts.util.PropertyUtils; public class TestAction extends Action { public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { System.out.println(TestAction ...); return mapping.findForward(success); } }