Hi,
I've a problem with Struts 1.1 Beta, to read properties, which are set 
in the struts-config.xml
This code works with an old version from Struts but not with Struts 1.1 
Beta.
Can anybody help me?

Here are the sources:

The web.xml :

...
 <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

    <init-param>
      <param-name>mapping</param-name>
      <param-value>test.myMapping</param-value>
    </init-param>
...
</servlet>
...


The struts-config.xml:


...
   
    <action    path="/test"
               name="testForm"
               type="testAction"
               scope="request"
               validate="false"
               input="/index.jsp">
           <set-property property="myProperty" value="This is property 
:)" />           
           <forward name="success"              path="/start.do"/>   
        
           <forward name="failure"              path="/index.jsp"/>   
        
    </action>
...



The myMapping.java:

package test.myMapping;
import org.apache.struts.action.ActionMapping;

public class myMapping extends ActionMapping {
    
    protected String myProperty;

    public void setMyProperty(String myProperty) {
        this.myProperty = myProperty;
    }

    public String getMyProperty() {
        return myProperty;
    }
}


The testAction.java:


public final class testAction extends Action {

   public ActionForward execute(ActionMapping mapping,
                 ActionForm form,
                 HttpServletRequest request,
                 HttpServletResponse response)
    throws IOException, ServletException {
    String myProperty=null;
    

    if (mapping instanceof myMapping)   // this doesn't work with struts 
1.1   what is the cause ?
    {
        //cast the mapping class into our custom
        //mapping class
        myMapping mp = (myMapping) mapping;

        myProperty=mp.getMyProperty();
        
    }    
    
...    


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to