The following comment has been added to this issue:

     Author: Matt Raible
    Created: Tue, 24 Dec 2002 7:01 AM
       Body:
Here is a fix for rendering the @struts.form name="formName" correctly when a name is 
not specified and you're using a POJO.  The EJB functionality still appears to work 
the same on the samples.  

Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java,v
retrieving revision 1.9
diff -r1.9 StrutsFormTagsHandler.java
118c118,128
<             return Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
"Form");
---
>             formName = Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
>"Form");
> 
>             int packageExists = formName.indexOf(getCurrentPackage().toString());
> 
>             if (packageExists > -1) {
>                 // package name still exists, chop it off
>                 return 
>Introspector.decapitalize(getStrutsFormClassName(getCurrentClass()));
>             }
>             else {
>                 return Introspector.decapitalize(getEjbNameFor(getCurrentClass()) + 
>"Form");
>             }
159,160c169,170
<                     !foundFields.containsKey(getCurrentMethod().getName()) &&
<                     PersistentTagsHandler.isPersistentField(getCurrentMethod())
---
>                     !foundFields.containsKey(getCurrentMethod().getName())
>                 //PersistentTagsHandler.isPersistentField(getCurrentMethod())
---------------------------------------------------------------------
View the issue:

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


Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XDT-211
    Summary: Improve the <strutsform> task so it can be applied to any POJO
       Type: Improvement

     Status: Assigned
   Priority: Minor

 Time Spent: Unknown
   Estimate: 0 minutes

    Project: XDoclet
  Component: Apache Module
   Versions:
             1.2 Beta 2

   Assignee: xdoclet-devel (Use for new issues)
   Reporter: Matt Raible

    Created: Tue, 24 Dec 2002 4:44 AM
    Updated: Tue, 24 Dec 2002 4:44 AM

Description:
I did a little manipulation tonight of the code and can now generate a Struts Form 
from a POJO (i.e. for use with Hibernate).  My hacks are ugly, but they will work for 
me.  I hope we can figure out a way to retain existing functionality, but add this 
functionality to the codebase.  I think the best thing would be use the existing 
@struts.form tag, but somehow allow it to be a subtask of many - maybe of hibernate or 
something.  Right now it still has to be a subtask of ejb, and I don't know how to 
allow it as a subtask of many.  I tried to do a "make patch" with TortoiseCVS, but it 
just keeps giving me an error.

Here's the files I changed:

Index: xdoclet/modules/apache/src/META-INF/xtags.xml
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/modules/apache/src/META-INF/xtags.xml,v
retrieving revision 1.10
diff -r1.10 xtags.xml
110a111,113
>           <condition-parameter>java.lang.Object</condition-parameter>
>         </condition>
>         <condition type="type">
125c128,131
<             <condition-parameter>javax.ejb.EntityBean"</condition-parameter>
---
>             <condition-parameter>javax.ejb.EntityBean</condition-parameter>
>           </condition>
>           <condition type="type">
>             
> <condition-parameter>java.lang.Object</condition-parameter>
168a175,177
>           </condition>
>           <condition type="type">
>             
> <condition-parameter>java.lang.Object</condition-parameter>


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/StrutsFormTagsHandler.java,v
retrieving revision 1.9
diff -r1.9 StrutsFormTagsHandler.java
159,160c159,160
<                     !foundFields.containsKey(getCurrentMethod().getName()) &&
<                     PersistentTagsHandler.isPersistentField(getCurrentMethod())
---
>                     !foundFields.containsKey(getCurrentMethod().getName())
>                 
> //PersistentTagsHandler.isPersistentField(getCurrentMethod())


Index: 
xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/apache/src/xdoclet/modules/apache/struts/ejb/StrutsFormSubTask.java,v
retrieving revision 1.8
diff -r1.8 StrutsFormSubTask.java
53a54
>         addOfType("java.lang.Object");

I also have my own template that removes check for 
<XDtEjbDataObj:ifIsWithDataContainer>.

Any advice on a better way of doing this is appreciated.  I've also thought of just 
generating the XML fragment for a DynaActionForm from a POJO - that might be a cool 
way to do things.  It'd be tough to retain validator settings though doing that.

Thanks,

Matt


---------------------------------------------------------------------
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/Administrators.jspa

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



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to