wood burning stoves 2.0*
The moose likes Struts and the fly likes Cannot retrieve mapping for action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cannot retrieve mapping for action" Watch "Cannot retrieve mapping for action" New topic
Author

Cannot retrieve mapping for action

Shan Lyons
Greenhorn

Joined: May 31, 2006
Posts: 2
I have been staring at this error for a while now and can't see what I am doing wrong. I am new to struts so beware of obivious mistakes.

Here is the error:

javax.servlet.jsp.JspException: Cannot retrieve mapping for action /common/signup
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:784)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
at jsp_servlet._common.__signup._jspService(__signup.java:203)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:446)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

Here is my struts config:

<struts-config>


<!-- ========== Data Source Configuration =============================== -->
<!--
<data-sources>
<data-source>
<set-property property="autoCommit"
value="false"/>
<set-property property="description"
value="Example Data Source Configuration"/>
<set-property property="driverClass"
value="org.postgresql.Driver"/>
<set-property property="maxCount"
value="4"/>
<set-property property="minCount"
value="2"/>
<set-property property="password"
value="mypassword"/>
<set-property property="url"
value="jdbc ostgresql://localhost/mydatabase"/>
<set-property property="user"
value="myusername"/>
</data-source>
</data-sources>
-->

<!-- ========== Form Bean Definitions =================================== -->
<form-beans>
<!-- Subscription form bean -->
<form-bean name="emailForm"
type="herceptin.forms.EmailForm"/>

<form-bean name="unsubForm"
type="herceptin.forms.UnsubForm"/>

<form-bean name="SignupForm"
type="herceptin.forms.SignupForm"/>

<form-bean name="ProRegForm1"
type="herceptin.forms.ProRegForm1" />

<form-bean name="PatRegForm1"
type="herceptin.forms.PatRegForm1" />

<form-bean name="PatRegForm2"
type="herceptin.forms.PatRegForm2" />

</form-beans>

<!-- ========== Global Forward Definitions ============================== -->
<global-forwards>
<forward name="logoff" path="/logoff.do"/>
<forward name="logon" path="/logon.jsp"/>
<forward name="error" path="/common/error.jsp"/>
</global-forwards>


<!-- ========== Action Mapping Definitions ============================== -->

<action-mappings>
<action path="/TestNewMember"
type="herceptin.actions.TestNewMemberAction"
scope="request"
validate="false">
<forward name="success" path="/test_new_member_results.jsp"/>
</action>

<action path="/TestNewQuestion"
type="herceptin.actions.TestNewQuestionAction"
scope="request"
validate="false">
<forward name="success" path="/test_new_question_results.jsp"/>
</action>

<action path="/common/Signup"
type="herceptin.actions.SignupAction"
name="SignupForm"
scope="request"
validate="true"
input="/common/signup.jsp" >
<forward name="success" path="/common/signup_thankyou.jsp"/>
<forward name="debug" path="/debug.jsp"/>
</action>

<action path="/professional/Registration1"
type="herceptin.actions.ProRegAction1"
name="ProRegForm1"
scope="request"
validate="true"
input="/professional/registration1.jsp" >
<forward name="success" path="/professional/confirmation.jsp"/>
<forward name="debug" path="/debug.jsp"/>
</action>

<action path="/professional/unsubscribe"
type="herceptin.actions.UnsubAction"
name="unsubForm"
scope="request"
validate="true"
input="/professional/email_unsubscribe.jsp" >
<forward name="all" path="/professional/unsubscribe_confirmation.jsp"/>
<forward name="email" path="/professional/unsubscribe_confirmation_email.jsp"/>
<forward name="mail" path="/professional/unsubscribe_confirmation_mail.jsp"/>
<forward name="debug" path="/debug.jsp"/>
</action>

<action path="/goToEmailPagePatient"
type="herceptin.actions.EmailAction"
name="emailForm"
scope="request"
validate="false">
<forward name="success" path="/patient/email.jsp"/>
</action>

<action path="/goToEmailPageProfessional"
type="herceptin.actions.EmailAction"
name="emailForm"
scope="request"
validate="false">
<forward name="success" path="/professional/email.jsp"/>
</action>


<action path="/submitEmailPatient"
type="herceptin.actions.EmailAction"
name="emailForm"
scope="request"
validate="false">
<forward name="success" path="/patient/email_thankyou_friend.jsp"/>
<forward name="failed"path="/patient/email.jsp"/>
</action>

<action path="/submitEmailProfessional"
type="herceptin.actions.EmailAction"
name="emailForm"
scope="request"
validate="false">
<forward name="success" path="/professional/email_thankyou_friend.jsp"/>
<forward name="failed"path="/professional/email.jsp"/>
</action>


</action-mappings>

</struts-config>

Here is the Form:

package herceptin.forms;

import herceptin.utils.Constants;
import herceptin.utils.EmailValidator;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public final class SignupForm extends ActionForm {
private String email = null;

private String confirmEmail = null;

private String description = null;

private String products = null;

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getConfirmEmail() {
return confirmEmail;
}

public void setConfirmEmail(String confirmEmail) {
this.confirmEmail = confirmEmail;
}

public String getDescription() {
return description;
}

public void getDescription(String description) {
this.description = description;
}

public String getProducts() {
return products;
}

public void setProducts(String products) {
this.products = products;
}

// --------------------------------------------------------- Public Methods

/**
* Reset all properties to their default values.
*
* @param mapping
* The mapping used to select this instance
* @param request
* The servlet request we are processing
*/

public void reset(ActionMapping mapping, HttpServletRequest request) {
this.email = null;
this.confirmEmail = null;
this.description = null;
this.products = null;
}

/**
* Validate the properties that have been set from this HTTP request, and
* return an <code>ActionErrors</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionErrors</code> object with no
* recorded error messages.
*
* @param mapping
* The mapping used to select this instance
*
* @param request
* The servlet request we are processing
*
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();

if (email == null || email.trim().length() == 0) {
errors.add("email", new ActionError("error.required"));
} else if (confirmEmail == null || !email.equals(confirmEmail)) {
errors.add("emailConfirm", new ActionError("error.missmatch"));
} else if (!email.matches(Constants.EMAIL_REGEX)) {
errors.add("email", new ActionError("error.invalid"));
} else if (!EmailValidator.isValidEmailAddress( email )) {
errors.add("email", new ActionError("error.invalid"));
}
if (description == null || description.trim().length() == 0) {
errors.add("description", new ActionError("error.required"));
}
if (products == null || products.trim().length() == 0) {
errors.add("product", new ActionError("error.required"));
}
if (errors.empty() == false) {
request.setAttribute("herceptin.errorsPresent", "true");
}

return errors;

}

}

Here is the Action:

package herceptin.actions;

import herceptin.forms.SignupForm;

import herceptin.utils.Constants;
import herceptin.utils.DBUtils;
import herceptin.utils.HerceptinException;
import herceptin.utils.ProcResults;

import java.io.IOException;
import java.io.StringWriter;
import java.io.PrintWriter;

import javax.naming.NamingException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public final class SignupAction extends Action
{
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param actionForm The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/

public ActionForward perform( ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
boolean success;
SignupForm signForm = (SignupForm)form;

try
{
success = DBUtils.insertSignupForm( signForm );

if( !success )
return mapping.findForward ( "error" );

} catch ( HerceptinException ex ) {

request.setAttribute ( "e_Exception_Message", ex.getMessage() );

StringWriter sw = new StringWriter();
Throwable cause = ex.getCause();

if ( cause != null ) {
cause.printStackTrace ( new PrintWriter ( sw ) );
} else {
ex.printStackTrace ( new PrintWriter ( sw ) );
}

request.setAttribute ( "e_Exception_StackTrace", sw.toString() );

request.setAttribute ( "debug.questionList", "n/a" );
return mapping.findForward ( "debug" );

}

return mapping.findForward ( "success" );
}

}

And finally, here is the HTML

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<!DOCTYPE HTML PUBLIC >

<html>
<head>
<title>Herceptin.com - Sign Up</title>

<link href="/herceptin/inc/css/global.css" media="screen, print" type="text/css" rel="stylesheet">
<link href="/herceptin/inc/css/global3.css" title="global3" media="screen, print" type="text/css" rel="alternate stylesheet">
</head>

<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" class="background">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td width="200" valign="top" background="/herceptin/i/left_side_bg.gif">
<table width="200" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="/herceptin/patient/index.jsp"><img src="/herceptin/i/her_logo_home.gif" alt="Herceptin Trastuzumab" width="200" height="96" border="0"></a></td>
</tr>
<tr>
<td>
<!--** START NAVSTUDIO MENU TAGS (955031) **-->
<div id="vqp_about" style="position:absolute;visibility:hidden;">****JavaScript based drop down DHTML menu generated by NavStudio. (OpenCube Inc. - http://www.opencube.com)****</div>
<script language="JavaScript" vqptag="doc_level_settings" is_vqp_html=1 vqp_datafile0=" email.js" vqp_uid0=955031>cdd__codebase = " /herceptin/inc/patient/nav/";cdd__codebase955031 = " includes/nav/";</script>
<script language="JavaScript" vqptag="datafile" src="/herceptin/inc/patient/nav/email.js"></script>
<script vqptag="placement" vqp_menuid="955031" language="JavaScript">create_menu(955031)</script>
<!--** END NAVSTUDIO MENU TAGS **-->
</td>
</tr>
</table>

<%@ include file="/inc/patient/left_side.jsp" %>

</td>
<td width="605" valign="top">

<%@ include file="/inc/patient/top_right.jsp" %>

<%@ include file="/inc/patient/search_bar.jsp" %>

<!--splash_image-->
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/herceptin/i/patient/splash_default_sm.jpg" alt="" width="600" height="71" border="0"></td>
</tr>
</table>
<!--splash_image-->

<!--header_bar-->
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="4"><img src="/herceptin/i/c.gif" alt="" width="1" height="5" border="0"></td>
</tr>
<tr>
<td><img src="/herceptin/i/c.gif" alt="" width="4" height="20" border="0"></td>
<td class="header_bar"><img src="/herceptin/i/c.gif" alt="" width="12" height="20" border="0"></td>
<td class="header_bar" width="100%">Request More Information</th>
<td><img src="/herceptin/i/c.gif" alt="" width="4" height="20" border="0"></td>
</tr>
<tr>
<td colspan="4"><img src="/herceptin/i/c.gif" alt="" width="1" height="10" border="0"></td>
</tr>
</table>

<!--body-->
<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="/herceptin/i/c.gif" alt="" width="15" height="1" border="0"></td>
<td valign="top">
<div id="printDiv" name="printDiv">
<!-- place all body content here -->
<p>By signing up with Herceptin.com you will receive helpful information about breast cancer and breast cancer treatments from Genentech. Also, Herceptin.com will be adding content, tools and other resources regularly to the site and will keep you informed.
<!-- place all form content here -->
<html:form action="/common/signup.do">
<html:errors property="errorsPresent"/><br>
<strong>
<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">Your E-mail:</td>
<td> </td>
<td><html:text maxlength="128" property="email" /></td>
</tr>
<tr>
<td>Confirm E-mail:</td>
<td> </td>
<td><html:text maxlength="128" property="confrimEmail" /></td>
</tr>
</table>

<br />
To help us provide you with the most useful information, choose one of the following that best describes you:
</strong>
<br />
<br />

<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><html:radio property="description" value="Patient"/></td>
<td class="body">Patient</td>
</tr>
<tr>
<td><html:radio property="description" value="Caregiver" /></td>
<td class="body">Caregiver</td>
</tr>
<tr>
<td><html:radio property="description" value="Oncologist" /></td>
<td class="body">Oncologist</td>
</tr>
<tr>
<td><html:radio property="description" value="Nurse" /></td>
<td class="body">Oncology Nurse</td>
</tr>
<tr>
<td><html:radio property="description" value="Professional" /></td>
<td class="body">Other Health Care Professional</td>
</tr><tr>
<td><html:radio property="description" value="Other" /></td>
<td class="body">Other</td>
</tr>
</table>

<br />
<strong>
Would you be interested in reveiving information about Herceptin or other Genentech products, services and programs?
</strong>
<br />
<br />

<table width="0" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><html:radio property="products" value="Yes" /></td>
<td class="body">Yes</td>
</tr>
<tr>
<td><html:radio property="products" value="No" /></td>
<td class="body">No</td>
</tr>
</table>

<html:image src="/herceptin/i/btn_signup.jpg" />
</html:form>
<!-- end all form content here -->
</p>
<a href="/herceptin/patient/email_unsubscribe.jsp">> Unsubscribe </a>
<a href="/herceptin/patient/privacy.jsp">> Privacy Poilicy</a>
<!-- end all body content here -->
</div>
</td>
<td valign="top"><img src="/herceptin/i/c.gif" width="10" height="1" alt="" border="0"></td>
</tr>
<tr>
<td colspan="4"><img src="/herceptin/i/c.gif" alt="" width="1" height="25" border="0"></td>
</tr>
<tr>
<td colspan="4"><img src="/herceptin/i/c.gif" alt="" width="1" height="25" border="0"></td>
</tr>
</table>
<!--body-->

</td>
<td valign="top"><img src="/herceptin/i/rt_side_shadow.gif" width="5" height="611" alt="" border="0"></td>
<td width="100%"><img src="/herceptin/i/c.gif" alt="" width="1" height="1" border="0"></td>
</tr>
</table>

<%@ include file="/inc/patient/footer.jsp" %>

</body>

</html>


I have already tries changing the presence of a .do for the form action. I have also restarted the server and my computer. My appologies for the long post. Please help.
Henry Lowell
Ranch Hand

Joined: May 29, 2006
Posts: 63
/common/signup

vs

/common/Signup

Struts is case sensative.


Hank
Shan Lyons
Greenhorn

Joined: May 31, 2006
Posts: 2
I assume you are reffering to the path in the config file... Changed that and still get the same error. Thank you for the look anyway.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot retrieve mapping for action
 
Similar Threads
Cannot find ActionMappings or ActionFormBeans collection
Error in deploying struts: Attribute name invalid according to the specified TLD
javax.servlet.jsp. JspException: Cannot find message resources under key
ClassCastException in struts - urgent! :(
JSP and XML