You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Fred Tsang <Fr...@t-mi.com> on 2003/10/20 17:59:44 UTC

RE: Need help to create owm Custom Action Mapping to read the pro pertys

Archana,

afaik, your struts config.xml should look like:

<action path="/Support"
type="com.diginet.digichat.webapp.action.MailActionMapping" 
name="supportForm" input="/support.jsp" scope="request">
  <set-property property="mailserver" value="mail.digi-net.com" />
</action> 

where your type is your qualified class name.  try that.

cheers,
Fred

-----Original Message-----
From: Archana Annamaneni [mailto:annamaneni@digi-net.com]
Sent: 20 October 2003 17:00
To: struts-user@jakarta.apache.org
Subject: 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:2
54)
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(PageContextImp
l.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:2
10)


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


*******************************************************************
Tokyo-Mitsubishi International plc ('TMI') is registered in
England, company number 1698498. TMI's registered
office is 6 Broadgate, London EC2M 2AA. TMI is a wholly
owned subsidiary of The Bank of Tokyo-Mitsubishi, Ltd
and is regulated by the Financial Services Authority.

This message is intended solely for the individual addressee
named above. The information contained in this E-Mail is
confidential and may be legally privileged. If you are not the
intended recipient please delete in its entirety. Messages
sent via this medium may be subject to delays, non-delivery
and unauthorised alteration.

The information contained herein or attached hereto has been obtained 
from sources we believe to be reliable but we do not represent 
that it is accurate or complete. Any reference to past performance 
should not be taken as an indication of future performance.  
The information contained herein or attached hereto is not to 
be construed as an offer or solicitation to buy or sell any security, 
instrument or investment.

TMI or any affiliated company, may have an interest, position,
or effect transactions, in any investment mentioned herein.
Any opinions or recommendations expressed herein are
solely those of the author or analyst and are subject to
change without notice.
********************************************************************


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


RE: Need help to create owm Custom Action Mapping to read the pro pertys

Posted by Archana Annamaneni <an...@digi-net.com>.
Thank you Fred for the reply.But i am still getting the same error.

<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> 

But I also think I need both the type and className because in
SuuportAction class a I am using the MailActionMapping which has the
mailserver property defined.This I got from the book Mastering jakartha
Struts and also on the web.

I don't know somehow that set-property is causing the problem , because
if I delete that line from action everything works fine though I can not
read the property. 



Thank you 
Archana
On Mon, 2003-10-20 at 11:59, Fred Tsang wrote:
> Archana,
> 
> afaik, your struts config.xml should look like:
> 
> <action path="/Support"
> type="com.diginet.digichat.webapp.action.MailActionMapping" 
> name="supportForm" input="/support.jsp" scope="request">
>   <set-property property="mailserver" value="mail.digi-net.com" />
> </action> 
> 
> where your type is your qualified class name.  try that.
> 
> cheers,
> Fred
> 
> -----Original Message-----
> From: Archana Annamaneni [mailto:annamaneni@digi-net.com]
> Sent: 20 October 2003 17:00
> To: struts-user@jakarta.apache.org
> Subject: 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:2
> 54)
> 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(PageContextImp
> l.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:2
> 10)
> 
> 
> 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
> 
> 
> *******************************************************************
> Tokyo-Mitsubishi International plc ('TMI') is registered in
> England, company number 1698498. TMI's registered
> office is 6 Broadgate, London EC2M 2AA. TMI is a wholly
> owned subsidiary of The Bank of Tokyo-Mitsubishi, Ltd
> and is regulated by the Financial Services Authority.
> 
> This message is intended solely for the individual addressee
> named above. The information contained in this E-Mail is
> confidential and may be legally privileged. If you are not the
> intended recipient please delete in its entirety. Messages
> sent via this medium may be subject to delays, non-delivery
> and unauthorised alteration.
> 
> The information contained herein or attached hereto has been obtained 
> from sources we believe to be reliable but we do not represent 
> that it is accurate or complete. Any reference to past performance 
> should not be taken as an indication of future performance.  
> The information contained herein or attached hereto is not to 
> be construed as an offer or solicitation to buy or sell any security, 
> instrument or investment.
> 
> TMI or any affiliated company, may have an interest, position,
> or effect transactions, in any investment mentioned herein.
> Any opinions or recommendations expressed herein are
> solely those of the author or analyst and are subject to
> change without notice.
> ********************************************************************
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


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