You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Archana Annamaneni <an...@digi-net.com> on 2003/10/20 18:00:03 UTC

Need help to create owm Custom Action Mapping to read the propertys

Hello everyone,

I have to read a property when certain action is called.

for simple mail application i want to read the smtp mailserver value
from outside , i don't want to hard code it, for that I am creating my
ActionMapping.And adding new tag called set-property for the action.but
i am getting error when i start up the application.

Here is my ActionMapping class

package com.diginet.digichat.webapp.action;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionServlet;
import org.apache.struts.config.ModuleConfig;
import javax.servlet.ServletException;

public class MailActionMapping extends ActionMapping
{

protected String mailserver;

public MailActionMapping()
{
super();
}

public void setMailServer(String mailserver)
{
this.mailserver = mailserver;
}

public String getMailServer()
{
return mailserver;
}
}

The following are the changes i made to struts-config.xml

<action path="/Support"
type="com.diginet.digichat.webapp.action.SupportAction" 
name="supportForm" input="/support.jsp" scope="request"
className="com.diginet.digichat.webapp.action.MailActionMapping">

<set-property property="mailserver" value="mail.digi-net.com" />
</action> 


This is how i am using it in one of my classes

MailActionMapping mailMapping = (MailActionMapping)mapping;
smtpServerName = mailMapping.getMailServer();

These are the errors i am when i restart the Tomcat and goto the
application


org.apache.jasper.JasperException: Cannot find ActionMappings or
ActionFormBeans collection
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


root cause

javax.servlet.ServletException: Cannot find ActionMappings or
ActionFormBeans collection
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.logon_jsp._jspService(logon_jsp.java:81)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)


I also tried using the PlugIn but it is not working with that too.
I been trying this from last two days please someone advice me what i am
doing wrong.

Thank you



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org