Hi every one,
I am new to struts. I am using dynavalidatorform instead of
ActionForm .
My problem is, control is not going into cation class.It only display
blank page. no error or exception has been shown.
Here is the code given below.Its about updateAction Class.

Update.jsp

<%@ page language="java" pageEncoding="ISO-8859-1"%>

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />

    <title>Update.jsp</title>

        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <!--
        <link rel="stylesheet" type="text/css" href="styles.css">
        -->

  </head>

  <body>
  <html:errors />
  <center><h2>Enter Student Id</h2></center>
    <html:form action="/update" method="post" focus="id">
      <table border="0">
        <tr>
          <td><B>Student Id:</B></td>
          <td><html:text property="id" /></td>
        </tr>

        <tr>
          <td colspan="2" align="center"><html:submit
style="background:#FF0000"/></td>
        </tr>
      </table>
    </html:form>
  </body>
</html:html>

---------------------------------------------------------------------------------------------

Struts-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
Struts Configuration 1.1//EN"
                               "http://jakarta.apache.org/struts/dtds/
struts-config_1_1.dtd">
<struts-config>
        <data-sources/>

        <form-beans>
                  <form-bean name="bean"
type="org.apache.struts.validator.DynaValidatorForm">
                                <form-property  name="id" 
type="java.lang.String" />
                                <form-property  name="name" 
type="java.lang.String" />
                                <form-property  name="address" 
type="java.lang.String" />
                                <form-property  name="email" 
type="java.lang.String" />
                                <form-property  name="doj" 
type="java.lang.String" />
                                <form-property  name="age" 
type="java.lang.String" />
                        </form-bean>
                        <form-bean name="bean1"
type="org.apache.struts.validator.DynaValidatorForm">
                                <form-property  name="id" 
type="java.lang.String" />
                        </form-bean>
                        <form-bean name="bean2"
type="org.apache.struts.validator.DynaValidatorForm">

                                <form-property  name="address" 
type="java.lang.String" />
                                <form-property  name="email" 
type="java.lang.String" />
                                <form-property  name="doj" 
type="java.lang.String" />
                                <form-property  name="age" 
type="java.lang.String" />
                        </form-bean>
        </form-beans>

        <global-exceptions/>
        <global-forwards/>

        <action-mappings>
         <action path="/mytiles" forward="MyTiles"/>
                  <action name="bean"
                                                         path="/insert"
                                                         
type="dyna.RegisterAction"
                                                         input="/Register.jsp"
                                                         validate="true">
                           <forward name="ok" path="/Successl.html"/>
                           <forward name="fail" path="/Failure.html"/>
                  </action>
                  <action name="bean1"
                                  path="/update"
                                  type="dyna.UpdateAction"
                                  input="/Update.jsp"
                                  validate="true">
                        <forward name="ok" path="/UpdateDetail.jsp" />
                  </action>
                  <action name="bean2"
                                  path="/updateDetail"
                                  type="dyna.UpdateDetail"
                                  input="/UpdateDetail.jsp"
                                  validate="true">
                        <forward name="ok" path="/Successl.html" />
                        <forward name="fail" path="/Failure.html" />

                  </action>
         </action-mappings>
<message-resources
parameter="com.infodyna.struts.ApplicationResources" />
  <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>
-------------------------------------------------------------------------------------------------------------

UpdateAction.java


package dyna;
import  javax.servlet.http.*;
import  org.apache.struts.action.*;
import  org.apache.struts.validator.DynaValidatorForm;

public class UpdateAction extends Action {

        public ActionForward execute(ActionMapping mapping,
                                                                ActionForm form,
                                                                
HttpServletResponse response,
                                                                
HttpServletRequest request){

                String id=null;
                String status="ok";
                HttpSession session=request.getSession(true);
                DynaValidatorForm b=(DynaValidatorForm)form;
                id=(String)b.get("id");
                System.out.println("Inside UpdateAction");
                session.setAttribute("id", id);
                session.setMaxInactiveInterval(10000);
                /*dyna.updateBean b=new dyna.updateBean();
                b.setId(id);
                int result=b.update();*/
                /*if(id==null)
                        status="fail";
                else
                        status="ok";*/

                return  mapping.findForward(status);
        }

}
-----------------------------------------------------------------------------------

It works on first action tag but not in second.
Help me.
Thanks in advance!!

Regards
Sagar

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to