The following comment has been added to this issue:

     Author: Erik Hatcher
    Created: Mon, 26 Jan 2004 4:58 PM
       Body:
This issue comes up frequently.  The problem is always that you do not have the full 
set of JAR's in your taskdef for webdoclet.  You need struts.jar, j2ee.jar (or 
servlet.jar), the Commons Validator JAR (if you're using the validator stuff) as well 
as the XDoclet JAR files.  If you are extending from ActionForm indirectly, be sure to 
have whatever classes you are extending from also in the classpath or in the source 
tree that webdoclet is processing.  This should solve the problem for you.
---------------------------------------------------------------------
View the issue:

  http://opensource.atlassian.com/projects/xdoclet/secure/ViewIssue.jspa?key=XDT-758


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-758
    Summary: Struts Form Bean Metadata Not Getting Generated
       Type: Bug

     Status: Open
   Priority: Major

 Original Estimate: 1 hour
 Time Spent: Unknown
  Remaining: 1 hour

    Project: XDoclet
 Components: 
             Web Module
   Versions:
             1.2

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: Stephen Cuppett

    Created: Wed, 7 Jan 2004 7:11 PM
    Updated: Mon, 26 Jan 2004 4:58 PM
Environment: Ant Version 1.5.4
Java Version 1.4.1 IBM JDK

Description:
XDoclet fails to create form bean information in struts-config.xml file.  There is 
also a datasources merge file that gets included as well.  The following section is 
the definition for Ant:

    <target depends="init,build,jar" name="webapp">
            <taskdef name="webdoclet"
                 classname="xdoclet.modules.web.WebDocletTask">
            <classpath refid="classpath"/>
        </taskdef>
        <webdoclet destDir="defaultroot/WEB-INF"  mergeDir="defaultroot/WEB-INF"
                   excludedtags="@version,@author,@todo" verbose="true">
            <fileset dir="${src}">
               <include name="**/*FormBean.java"/>
               <include name="**/*Action.java"/>
               <include name="**/*Servlet.java"/>
            </fileset>
                <deploymentdescriptor validatexml="true"
              servletspec="2.3" sessiontimeout="60"
                  destdir="defaultroot/WEB-INF" distributable="false">
                </deploymentdescriptor>
            <strutsconfigxml version="1.1"  validatexml="true"/>
            <strutsvalidationxml/>        
        </webdoclet>

*******************************************************************

The following is the struts-config.xml file that gets created:

<?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";>

<struts-config>

  <!-- ========== Data Sources Definitions =================================== -->
    <data-sources>
    <data-source key="database1">
       <set-property property="autoCommit" value="false"/>
       <set-property property="description" value="Connection to old database"/>
       <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
       <set-property property="maxCount" value="5"/>
       <set-property property="minCount" value="1"/>
       <set-property property="url" value="jdbc:mysql://mysqlhost1/DB"/>
       <set-property property="user" value="username"/>
       <set-property property="password" value="password"/>
    </data-source>

    <data-source key="database2">
       <set-property property="autoCommit" value="false"/>
       <set-property property="description" value="Connection to old database"/>
       <set-property property="driverClass" value="com.mysql.jdbc.Driver"/>
       <set-property property="maxCount" value="3"/>
       <set-property property="minCount" value="0"/>
       <set-property property="url" value="jdbc:mysql://mysqlhost2/DB"/>
       <set-property property="user" value="username"/>
       <set-property property="password" value="password"/>
    </data-source>

    <data-source key="intranet">
       <set-property property="autoCommit" value="false"/>
       <set-property property="description" value="Connection to PostgreSQL"/>
       <set-property property="driverClass" value="org.postgresql.Driver"/>
       <set-property property="maxCount" value="10"/>
       <set-property property="minCount" value="2"/>
       <set-property property="url" value="jdbc:postgresql://pghost/DB"/>
       <set-property property="user" value="username"/>
       <set-property property="password" value="password"/>
    </data-source>

  </data-sources>

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

    <!--
         If you have non XDoclet forms, define them in a file called struts-forms.xml 
and
         place it in your merge directory.
    -->
  </form-beans>

  <!-- ========== Global Exceptions Definitions =================================== -->
  <!--
    Define your exceptions in a file called global-exceptions.xml and place
    it in your merge directory.
  -->

  <!-- ========== Global Forward Definitions =================================== -->
  <!--
    Define your forwards in a file called global-forwards.xml and place
    it in your merge directory.
  -->

  <!-- ========== Action Mapping Definitions =================================== -->
   <action-mappings>
    <action
      path="/Logon"
      type="LogonAction"
      name="LogonAction"
      scope="request"
      input="Login.jsp"
      unknown="false"
      validate="true"
    >
      <forward
        name="failure"
        path="/Login.jsp"
        redirect="false"
      />
      <forward
        name="success"
        path="/LoggedIn.jsp"
        redirect="false"
      />
    </action>

    <!-- If you have non XDoclet actions, define them in a file called 
struts-actions.xml and place it in your merge directory. -->
  </action-mappings>

   <!-- Define your Struts controller in a file called struts-controller.xml and place 
it in your merge directory. -->

   <!-- Define your Struts plugins in a file called struts-plugins.xml and place it in 
your merge directory. -->

</struts-config>

*******************************************************************

The following is the LogonAction.java file:

/*
 * LogonAction.java
 *
 * Created on December 28, 2003, 6:19 PM
 */

import java.sql.Connection;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 * This class will process the user login.
 * @struts.action
 *  name="LogonAction"
 *  path="/Logon"
 *  scope="request"
 *  input="Login.jsp"
 *  validate="true"
 * @struts.action-forward 
 *  name="failure"
 *  path="/Login.jsp"
 * @struts.action-forward
 *  name="success"
 *  path="/LoggedIn.jsp"
 * @author cuppett
 */

public class LogonAction extends DatabaseAction {
    
    /**
     * The Apache logging subsystem variable
     */
    private static Log logger = LogFactory.getLog(LogonAction.class);    
    
    public ActionForward dbExecute(ActionMapping actionMapping, 
                                 ActionForm actionForm, 
                                 HttpServletRequest request, 
                                 HttpServletResponse response) 
    {
        ActionForward toReturn = actionMapping.findForward("failure");
        
                try
                {
                logger.trace("-> dbExecute( 4 params )");
            
                Connection myConnection = getDefaultConn();
                
                // TODO: process user login
                
                toReturn = actionMapping.findForward("success");
               
        } 
        catch (Exception sqle) 
        {
            logger.error("Attempted to authenticate user", sqle);
            toReturn = actionMapping.findForward("failure");
                } 
        
        logger.trace("<- dbExecute( 4 params )");
        return toReturn;
    }
    
}

*******************************************************************

The following is the LoginFormBean.java file:

/**
 * LoginFormBean.java
 *
 * Created on December 28, 2003, 5:22 PM
 */

/**
 * This form bean represents a user login session.
 * @struts.form name="LoginForm"
 * @author cuppett
 */
public class LoginFormBean extends GotoFormBean {
    
    private String username;
    private String password;
    
    public String getUsername() {
        return username;
    }
    
    public String getPassword() {
        return password;
    }
    
        /**
         * Sets the username attribute of the LoginForm object
         *
         * @struts.validator type="required" msgkey="username.required"
         */
    public void setUsername(String newUsername) {
        username = newUsername;
    }
    
        /**
         * Sets the password attribute of the LoginForm object
         *
         * @struts.validator type="required" msgkey="password.required"
         */
    public void setPassword(String newPassword) {
        password = newPassword;
    }
    
}



---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/xdoclet/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to