I an trying to use LazyDynaction form but I am getting a classcastexception.
Here is the code that I have written ...
Please help I am also providing the code files as an attachment.


<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>

<html:form  action="/myActionPath1">

        <FIELDSET>
        <LEGEND></LEGEND>
        </FIELDSET>
        <hr/>
        <FIELDSET>
        <LEGEND>Module</LEGEND>
        <div id="frmContainer2">
                <div id="frmCol1">
                        <div class="odd">
                                   <tr>
                                        <td><html:text tabindex="2" value=""
property="foo" size="20" maxlength="20"/></td>
                                        <td><html:text  value=""
property="moduleDesc" size="60" tabindex="2" maxlength="40"/></td> 
                                        <td><img id="plus"
src="images/add_button.gif" alt="" width="13" height="13" border="0"
tabindex="2" onclick="addMore(this)" onKeyPress="addMore(this)"/><img
id="minus" src="images/del_button.gif" alt="" width="13" height="13"
border="0" tabindex="2" onclick="delMe(this)" onKeyPress="delMe(this)">
                                        </td>
                                </tr>
                   </div>
                </div>
        </div>
</FIELDSET>
        <html:submit styleClass="button" property="submitaction"
tabindex="11">Save</html:submit>
</html:form>

<script>
        if(document.forms[0].operation.value=="edit")
        {                               
                document.onload = disableAllControls(document.forms[0]);
        }
        function addMore(leafEL){
                var curr_node = leafEL.parentNode.parentNode;
                var new_node = curr_node.cloneNode( true );
                new_codeEl = new_node.getElementsByTagName("INPUT")[0];
                new_codeEl.value="";
                new_codeE2 = new_node.getElementsByTagName("INPUT")[1];
                new_codeE2.value="";

                var root_node = curr_node.parentNode;
                root_node.appendChild(new_node); 
        }
        function delMe(leafEL){         
                var root_node = leafEL.parentNode.parentNode.parentNode;

                if(confirm("Do you want to remove this record?")){
                        root_node.removeChild(leafEL.parentNode.parentNode);

                }
        }               
</script>

- <!--  ======================================== Form Bean Definitions 
  --> 
- <form-beans>
  <form-bean name="myForm"
type="org.apache.struts.validator.LazyValidatorActionForm" /> 
  </form-beans>
- <!--  ================================= Global Exception Definitions 
  --> 
- <global-exceptions>
- <!-- 
 sample exception handler

        <exception

            key="expired.password"

            type="app.ExpiredPasswordException"

            path="/changePassword.jsp"/>

        end sample 

  --> 
  </global-exceptions>
- <!--  =================================== Global Forward Definitions 
  --> 
- <global-forwards>
- <!--  Default forward to "Welcome" action 
  --> 
- <!--  Demonstrates using index.jsp to forward 
  --> 
  <forward name="welcome" path="/Welcome.do" /> 
  </global-forwards>
- <!--  =================================== Action Mapping Definitions 
  --> 
- <action-mappings>
- <!--  Default "Welcome" action 
  --> 
- <!--  Forwards to Welcome.jsp 
  --> 
  <action path="/Welcome" type="org.apache.struts.actions.ForwardAction"
parameter="/pages/Welcome.jsp" /> 
- <action path="/myActionPath1" type="myPackage.myActionType1" name="myForm"
input="ModuleDetails.jsp">
  <forward name="success" path="ModuleDetails.jsp" /> 
  </action>




SEVERE: No action instance for path /myActionPath1 could be created
java.lang.ClassCastException
        at
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcess
or.java:326)
        at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
        at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
        at
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
       at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:284)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:257)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:245)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:199)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:149)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:156)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:732)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:688)
        at java.lang.Thread.run(Thread.java:534)










-----Original Message-----
From: Niall Pemberton [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 02, 2004 7:09 PM
To: Struts Developers List
Subject: Re: LazyActionForm

I have submitted LazyDynaBean and LazyDynaClass to commons beanutils.

   http://issues.apache.org/bugzilla/show_bug.cgi?id=29879

The version of  LazyDynaBean posted on my web site only dealt with "simple"
properties, but the version submitted to commons now handles mapped and
indexed properties in a "Lazy" way.

Setting a 'mapped' property now adds the mapped property and instantiates a
Map if it doesn't exist.

Setting an 'indexed' property now adds a List property and instantiates a
List if it doesn't exist. Also automatically grows Lists or Arrays if they
are not big enough to accomodate the index being set.

Niall


----- Original Message ----- 
From: "Matthias Wessendorf" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 29, 2004 2:22 PM
Subject: LazyActionForm


> Hello,
>
> are there plans to integrate LazyActionForm form
> Nial Pemberton in to struts (or in contrib) ?
>
> since nial is a commiter and it is usefull
> to have that functionality *directly* in framework...
>
> regards,
> Matthias
>
>
> ---------------------------------------------------------------------
> 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]
SEVERE: No action instance for path /myActionPath1 could be created
java.lang.ClassCastException
        at 
org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:326)
        at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:268)
        at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
        at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
       at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at 
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
        at 
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
        at java.lang.Thread.run(Thread.java:534)
<?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";>



<!--

     This is a blank Struts configuration file with an example

     welcome action/page and other commented sample elements.



     Tiles and the Struts Validator are configured using the factory defaults

     and are ready-to-use.



     NOTE: If you have a generator tool to create the corresponding Java classes

     for you, you could include the details in the "form-bean" declarations.

     Otherwise, you would only define the "form-bean" element itself, with the

     corresponding "name" and "type" attributes, as shown here.

-->





<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:postgresql://localhost/mydatabase"/>

     <set-property

        property="user"

        value="myusername"/>

   </data-source>

 </data-sources>

-->



<!-- ======================================== Form Bean Definitions -->



    <form-beans>
		<form-bean name="myForm" type="org.apache.struts.validator.LazyValidatorActionForm"/> 
    </form-beans>





<!-- ================================= Global Exception Definitions -->



    <global-exceptions>

        <!-- sample exception handler

        <exception

            key="expired.password"

            type="app.ExpiredPasswordException"

            path="/changePassword.jsp"/>

        end sample -->

    </global-exceptions>





<!-- =================================== Global Forward Definitions -->



    <global-forwards>

        <!-- Default forward to "Welcome" action -->

        <!-- Demonstrates using index.jsp to forward -->

        <forward

            name="welcome"

            path="/Welcome.do"/>

    </global-forwards>





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



    <action-mappings>



            <!-- Default "Welcome" action -->

            <!-- Forwards to Welcome.jsp -->

        <action

            path="/Welcome"

            type="org.apache.struts.actions.ForwardAction"

            parameter="/pages/Welcome.jsp"/>

			<action path="/myActionPath1" type="myPackage.myActionType1" name="myForm" input="ModuleDetails.jsp">
			<forward name="success" path="ModuleDetails.jsp"/>
           </action>


	<action path="/myActionPath2" 
			type="org.apache.struts.actions.ForwardAction" 
			parameter="ModuleDetails.jsp"/>
    </action-mappings>





<!-- ===================================== Controller Configuration -->



    <controller

       processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>





<!-- ================================ Message Resources Definitions -->



    <message-resources parameter="resources.application"/>





<!-- ======================================= Plug Ins Configuration -->


  <!-- ========== Tiles plugin ===================  -->
  <!--												-->
  <!--
     This plugin initialize Tiles definition factory. This later can takes some
	 parameters explained here after. The plugin first read parameters from web.xml, then
	 overload them with parameters defined here. All parameters are optional.
	 The plugin should be declared in each struts-config file.
       - definitions-config: (optional) 
            Specify configuration file names. There can be several comma 
		    separated file names (default: ?? )
       - moduleAware: (optional - struts1.1) 
            Specify if the Tiles definition factory is module aware. If true (default), 
			there will be one factory for each Struts module. 
			If false, there will be one common factory for all module. In this later case, 
			it is still needed to declare one plugin per module. The factory will be 
			initialized with parameters found in the first initialized plugin (generally the
			one associated with the default module).
			  true : One factory per module. (default)
			  false : one single shared factory for all modules
	   - definitions-parser-validate: (optional)
	        Specify if xml parser should validate the Tiles configuration file.
			  true : validate. DTD should be specified in file header. (default)
			  false : no validation
			  
	  Paths found in Tiles definitions are relative to the main context.
  -->
  <!-- comment following if struts1.0.x -->
  <plug-in className="org.apache.struts.tiles.TilesPlugin" >
    <set-property property="definitions-config" 
	                 value="/WEB-INF/tiles-defs.xml" />
    <set-property property="moduleAware" value="true" />
    <set-property property="definitions-parser-validate" value="true" />
  </plug-in>

  <!-- end comment if struts1.0.x -->

  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property
        property="pathnames"
        value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
  </plug-in>

</struts-config>

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

Reply via email to