Raible's Wiki

Raible Designs
Wiki Home
News
Recent Changes

AppFuse

Homepage
  - Korean
  - Chinese
  - Italian
  - Japanese

QuickStart Guide
  - Chinese
  - French
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish
  - Japanese

User Guide
  - Korean
  - Chinese

Tutorials
  - Chinese
  - German
  - Italian
  - Korean
  - Portuguese
  - Spanish

FAQ
  - Korean

Latest Downloads

Other Applications

Struts Resume
Security Example
Struts Menu

Set your name in
UserPreferences


Referenced by
Articles
CreateManager_it
ValidationAndList_it




JSPWiki v2.2.33

[RSS]


Hide Menu

CreateActions_it


Difference between version 4 and version 3:

At line 31 changed 1 line.
Now let's generate our PersonForm object for Struts and our web tier. To do this, we need to add XDoclet tags to the Person.java Object to create our Struts ActionForm. In the JavaDoc for the Person.java file, add the following @struts.form tag (use User.java if you need an example):
Ora generiamo il nostro oggetto PersonForm per Struts ed il nostro strato web. Per far questo, dobbiamo aggiugere dei tag XDoclet all'oggetto Person.java per creare la nostra ActionForm di Struts. Nel JavaDoc del file Person.java, aggiungi il seguente tag @struts.form (vedi User.java per un esempio):
At line 38 changed 1 line.
;:''We extend org.appfuse.webapp.form.BaseForm because it has a toString() method that allows us to call log.debug(formName) to print out a reader-friendly view of the Form object.''
;:''Estendiamo org.appfuse.webapp.form.BaseForm perché ha un metodo toString() che ci permette di chiamare log.debug(formName) per stampare una visualizzazione più leggibile dell'oggetto Form.''
At line 40 changed 1 line.
;:''If you haven't renamed the "org.appfuse" packages to "com.company" or otherwise don't have your model class in the default package, you may need to fully-qualify the reference to org.appfuse.webapp.form.BaseForm in the @struts.form tag.''
;:''Se non hai rinominato i package "org.appfuse" in "com.company" o in alternativa non hai la tua classe di modello nel package di default, può rivelarsi necessario specificare completamente il riferimento a org.appfuse.webapp.form.BaseForm nel tag @struts.form.''
At line 42 changed 1 line.
Now if you run __ant gen-forms__, Ant (and XDoclet) will generate a PersonForm.java for you in build/web/gen/**/form.
Ora se esegui __ant gen-forms__, Ant (ed XDoclet) genererà un PersonForm.java per te in build/web/gen/**/form.
At line 45 changed 1 line.
In this step, you'll generate a JSP page to display information from the Person object. It will contain Struts' JSP tags that render table rows for each property in Person.java. The [AppGen] tool that's used to do this is based off a StrutsGen tool - which was originally written by [Erik Hatcher|http://www.blogscene.org/erik/]. It's basically just a couple of classes and a bunch of XDoclet templates. All these files are located in extras/appgen.
In questo passo, genererai una pagina JSP per visualizzare le informazioni presenti nell'oggetto Person. Conterrà tag JSP di Struts per visualizzare righe di una tabella per ogni proprietà in Person.java. Lo strumento [AppGen] che viene utilzzato per far questo è basato su uno strumento StrutsGen - che è stato scritto in origine da [Erik Hatcher|http://www.blogscene.org/erik/]. Si tratta in poche parola di giusto un paio di classi ed un po' di template XDoclet. Tutti questi file si trovano in extras/appgen.
At line 47 changed 1 line.
Here are the simple steps to generating the JSP and a properties file containing the labels for the form elements:
Ecco i semplici passi per generare una JSP ed un file properties contenente le etichette per gli elementi del form:
At line 49 changed 6 lines.
* From the command-line, navigate to "extras/appgen"
* Execute __ant -Dobject.name=Person -Dappgen.type=pojo__ to generate a bunch of files in extras/appgen/build/gen. In fact, it'll generate all the files you need to complete this tutorial. However, let's just grab the ones you need.
** web/WEB-INF/classes/Person.properties (labels for your form elements)
** web/pages/personForm.jsp (JSP file for viewing a single Person)
** web/pages/personList.jsp (JSP file for viewing a list of People)
* Copy the contents of Person.properties into web/WEB-INF/classes/ApplicationResources.properties. These are all the keys you will need for titles/headings and form properties. Here is an example of what you should add to ApplicationResources.properties:
* Dalla linea di comando, naviga in "extras/appgen"
* Esegui __ant -Dobject.name=Person -Dappgen.type=pojo__ per generare una serie di file in extras/appgen/build/gen. Infatti, genererà tutti i file di cui hai bisogno per completare questo tutorial. Tuttavia, prendiamo solo quelli di cui abbiamo bisogno.
** web/WEB-INF/classes/Person.properties (etichette per gli elementi del tuo form)
** web/pages/personForm.jsp (file JSP per visualizzare una singola Persona)
** web/pages/personList.jsp (file JSP per visualizzare un elenco di Persone)
* Copia il contenuto di Person.properties in web/WEB-INF/classes/ApplicationResources.properties. Queste sono tutte le chiavi di cui avrai bisogno per titoli/intestazioni e proprietà del form. Ecco un esempio di quello che dovrai aggiungere ad ApplicationResources.properties:
At line 75 changed 1 line.
* Copy personForm.jsp to web/pages/personForm.jsp. Copy personList.jsp to web/pages/personList.jsp.
* Copia personForm.jsp in web/pages/personForm.jsp. Copia personList.jsp in web/pages/personList.jsp.

Back to CreateActions_it, or to the Page History.