RE: Action class defined in action-mappings not being executed - without 2mb webapp source
Robbie, I see you are using Struts v1.1 (your included DTD lists it as such) so are you using execute() or perform()? What is your Action method's signature? Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Action class defined in action-mappings not being executed - without 2mb webapp source
I fixed the dtd to be struts 1.2 as thats the version of my struts.jar (Struts 1.2.4). ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; still doesnt work. I'm using an execute() method and the code (along with method signature) is below /* * AddContactUs.java * * Created on May 26, 2005, 10:24 AM */ package com.devfirm.actions; import org.apache.struts.action.*; import javax.servlet.*; import com.devfirm.services.*; import com.devfirm.formbeans.*; /** * * @author Robbie */ public class AddContactUs extends Action{ /** Creates a new instance of AddContactUs */ public AddContactUs() { } public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception { //Message.showInfo(Contact Us Action is Running); ActionForward forward = null; ContactUsService service = new ContactUsService(); try { service.add(form); return mapping.findForward(success); }catch(Exception e) { return mapping.findForward(failure); } } } struts-config.xml : ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config data-sources /data-sources form-beans form-bean name=contactUs type=com.devfirm.formbeans.ContactUs /form-bean /form-beans global-exceptions /global-exceptions global-forwards /global-forwards action-mappings action path=/addContactUs type=com.devfirm.actions.AddContactUs name=contactUs validate=false input=/contactUs.jsp forward name=failure path=/contactUs.jsp/ forward name=success path=/contactUs.jsp/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config ContactUs.java: * * ContactUs.java * * Created on May 25, 2005, 11:30 PM */ package com.devfirm.formbeans; import org.apache.struts.action.*; /** * * @author Robbie */ public class ContactUs extends ActionForm { /** Creates a new instance of ContactUs */ public ContactUs() { //Message.showInfo(Contact Us Instantaniated); } private String companyName; private String contactName; private int contactPhone; private String contactEmail; private String industry; private String message; private String foundUsVia; public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public int getContactPhone() { return contactPhone; } public void setContactPhone(int contactPhone) { this.contactPhone = contactPhone; } public String getContactEmail() { return contactEmail; } public void setContactEmail(String contactEmail) { this.contactEmail = contactEmail; } public String getIndustry() { return industry; } public void setIndustry(String industry) { this.industry = industry; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getFoundUsVia() { return foundUsVia; } public void setFoundUsVia(String foundUsVia) { this.foundUsVia = foundUsVia; } } - Original Message - From: David G. Friedman [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Subject: RE: Action class defined in action-mappings not being executed - without 2mb webapp source Date: Sun, 29 May 2005 03:15:07 -0400 Robbie, I see you are using Struts v1.1 (your included DTD lists it as such) so are you using execute() or perform()? What is your Action method's signature? Regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- ___ NEW! Lycos Dating Search. The only place to search multiple dating sites at once. http://datingsearch.lycos.com - To unsubscribe
RE: Action class defined in action-mappings not being executed - without 2mb webapp source
Robbie, Your execute() signature seems incorrect. You use ServletRequest and ServletResponse. Try using HttpServletRequest and HttpServletResponse as per the API. The one you are using is not the default execute() implementation for a web server. See the descriptions of both execute() methods on the Struts JavaDocs at: http://struts.apache.org/api/org/apache/struts/action/Action.html public ActionForward execute(ActionMapping mapping, ActionForm form, javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) throws java.lang.Exception The javadoc's note reads: The default implementation attempts to forward to the HTTP version of this method. As for your DTD issues: your DTD looks correct according to what is written in the top of the 1.2 DTD but my my copy of the Struts v1.2.4 blank/example webapp's WEB-INF/struts-config.xml, lists an alternative DTD for 1.2.4 of: !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd; Regards, David (off to work for the next 14 hours) -Original Message- From: Robbie Anonymous [mailto:[EMAIL PROTECTED] Sent: Sunday, May 29, 2005 6:52 AM To: Struts Users Mailing List Subject: RE: Action class defined in action-mappings not being executed - without 2mb webapp source I fixed the dtd to be struts 1.2 as thats the version of my struts.jar (Struts 1.2.4). ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; still doesnt work. I'm using an execute() method and the code (along with method signature) is below /* * AddContactUs.java * * Created on May 26, 2005, 10:24 AM */ package com.devfirm.actions; import org.apache.struts.action.*; import javax.servlet.*; import com.devfirm.services.*; import com.devfirm.formbeans.*; /** * * @author Robbie */ public class AddContactUs extends Action{ /** Creates a new instance of AddContactUs */ public AddContactUs() { } public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception { //Message.showInfo(Contact Us Action is Running); ActionForward forward = null; ContactUsService service = new ContactUsService(); try { service.add(form); return mapping.findForward(success); }catch(Exception e) { return mapping.findForward(failure); } } } struts-config.xml : ?xml version=1.0 encoding=ISO-8859-1 ? !DOCTYPE struts-config PUBLIC -//Apache Software Foundation//DTD Struts Configuration 1.2//EN http://struts.apache.org/dtds/struts-config_1_2.dtd; struts-config data-sources /data-sources form-beans form-bean name=contactUs type=com.devfirm.formbeans.ContactUs /form-bean /form-beans global-exceptions /global-exceptions global-forwards /global-forwards action-mappings action path=/addContactUs type=com.devfirm.actions.AddContactUs name=contactUs validate=false input=/contactUs.jsp forward name=failure path=/contactUs.jsp/ forward name=success path=/contactUs.jsp/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config ContactUs.java: * * ContactUs.java * * Created on May 25, 2005, 11:30 PM */ package com.devfirm.formbeans; import org.apache.struts.action.*; /** * * @author Robbie */ public class ContactUs extends ActionForm { /** Creates a new instance of ContactUs */ public ContactUs() { //Message.showInfo(Contact Us Instantaniated); } private String companyName; private String contactName; private int contactPhone; private String contactEmail; private String industry; private String message; private String foundUsVia; public String getCompanyName() { return companyName; } public void setCompanyName(String companyName) { this.companyName = companyName; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public int getContactPhone() { return contactPhone; } public void setContactPhone(int contactPhone) { this.contactPhone = contactPhone; } public String getContactEmail() { return contactEmail
Re: Action class defined in action-mappings not being executed - without 2mb webapp source
Rob validation would be my first guess but I see you have that set to false remember that you need to validate the form bean properties as needed and anything in the request then it finds the ActionForward Are you able to access the JSPs defined in 'success' and 'failure' independently What does the logs say? Martin- - Original Message - From: Robbie Anonymous [EMAIL PROTECTED] To: user@struts.apache.org Sent: Sunday, May 29, 2005 3:01 AM Subject: Action class defined in action-mappings not being executed - without 2mb webapp source Hi, The Action class defined in my action-mappings not being executed. I know its not being executed as I made the execute window pop up a swing window on the server and it did not. When I click submit on contactUs.jsp, instead of an object com.devfirm.actions.AddContactUs being instantaniated and having its execute() method called, nothing happens and I get sent to a blank page. I have attatched the full code of my web app. below is my struts-config.xml ?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 data-sources /data-sources form-beans form-bean name=contactUs type=com.devfirm.formbeans.ContactUs /form-bean /form-beans global-exceptions /global-exceptions global-forwards /global-forwards action-mappings action path=/addContactUs type=com.devfirm.actions.AddContactUs name=contactUs validate=false input=/contactUs.jsp forward name=failure path=/contactUs.jsp/ forward name=success path=/contactUs.jsp/ /action /action-mappings message-resources parameter=ApplicationResources/ /struts-config Regards, Robbie -- ___ NEW! Lycos Dating Search. The only place to search multiple dating sites at once. http://datingsearch.lycos.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]