I was creating a new form-bean in struts-config.xml and got annoyed with the process. So I wrote a simple python script called gen-formbean. It's an interactive script that prompts you for the formbean name, and any property labels and types.
To avoid typing too much I created a map of the java types to short strings. For example, if you want java.lang.String simply enter 'string'. Want java.lang.String[]? enter string_array. Easy huh? What if you want an org.apache.struts.upload.FormFile? Yep, formfile :) When you're done it will output the form-bean entry that you can copy and paste into the struts-config.xml yourself. I hope folks find this useful. It lives in spacewalk/java/scripts in both master and multiorg branches. Here's a sample session: [EMAIL PROTECTED] scripts{multiorg}]$ ./gen-formbean form-bean name? sampleForm property label? name property type? string property label? age property type? int property label? fat property type? bool <---- notice bool and boolean are the same property label? tall property type? boolean property label? id property type? long property label? filename property type? formfile property label? losers property type? string_array property label? arches property type? option property label? <---- just hit enter when done ------- PASTE INTO struts-config.xml ----------- <form-bean name="sampleForm" type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm"> <form-property name="name" type="java.lang.String" /> <form-property name="age" type="java.lang.Integer" /> <form-property name="fat" type="java.lang.Boolean" /> <form-property name="tall" type="java.lang.Boolean" /> <form-property name="id" type="java.lang.Long" /> <form-property name="filename" type="org.apache.struts.upload.FormFile" /> <form-property name="losers" type="java.lang.String[]" /> <form-property name="arches" type="org.apache.struts.util.LabelValueBean" /> </form-bean> -- jesus m. rodriguez | [EMAIL PROTECTED] sr. software engineer | irc: zeus rhn satellite & spacewalk | 919.754.4413 (w) rhce # 805008586930012 | 919.623.0080 (c) +-------------------------------------------+ | "Those who cannot learn from history | | are doomed to repeat it." | | -- George Santayana | +-------------------------------------------+ _______________________________________________ Spacewalk-devel mailing list Spacewalk-devel@redhat.com https://www.redhat.com/mailman/listinfo/spacewalk-devel