Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "MoDisco/Components/JSP/Documentation/0.9"
Line 1: | Line 1: | ||
− | {{MoDiscoTabs|JSP| | + | {{MoDiscoTabs|JSP|{{MoDiscoTab|JSP|Documentation|0.9}}{{MoDiscoTab|JSP|Architecture|0.9}}}} |
− | + | ||
− | }} | + | |
==JSP Metamodel== | ==JSP Metamodel== | ||
− | The Modisco JSP MetaModel inherits from the Modisco XML one : | + | The Modisco JSP MetaModel inherits from the Modisco XML one : |
+ | |||
[[Image:JSP_Metamodel.png]] | [[Image:JSP_Metamodel.png]] | ||
− | The choice to extend the XML | + | The choice to extend the XML metamodel was made because JSP scripts use the same tag mechanism, attributes and comments, and contain well formed XML most of the time. |
According to the "Java Server Pages Specifications Version 1.2", JSP content is divided into 4 categories : | According to the "Java Server Pages Specifications Version 1.2", JSP content is divided into 4 categories : | ||
Line 20: | Line 19: | ||
**JSP TagLib : <code><nowiki> <%@ taglib prefix="myPrefix" uri="taglib/mytag.tld" %> </nowiki> </code> | **JSP TagLib : <code><nowiki> <%@ taglib prefix="myPrefix" uri="taglib/mytag.tld" %> </nowiki> </code> | ||
*Comments : <code><nowiki> <%-- This is a JSP comment --%> </nowiki> </code> | *Comments : <code><nowiki> <%-- This is a JSP comment --%> </nowiki> </code> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==JSP Discoverer== | ==JSP Discoverer== | ||
− | ===User | + | ===User Manual=== |
The plug-in provides the user with a contextual menu to easily create JSP models. | The plug-in provides the user with a contextual menu to easily create JSP models. | ||
Line 105: | Line 98: | ||
=== User Manual === | === User Manual === | ||
− | + | First, you need a JSP model. Please refer to the JSP Discoverer user manual. | |
− | To launch JSP generation | + | To launch a JSP generation: |
− | *Checkout ''org.eclipse | + | *Checkout ''org.eclipse.modisco.jee.jsp.generation'' into your workspace from the Eclipse SVN repository, and create an Accelo launch configuration pointing to the ''GenerateJsp'' java class, and specify the input model and target folder. |
Or | Or | ||
− | *Add ''org.eclipse | + | *Add ''org.eclipse.modisco.jee.jsp.generation'' to your plug-in dependencies and use the ''GenerateJsp'' main method with the input model and target folder as parameters. The code should look like this : |
+ | <source lang="java"> | ||
+ | GenerateJsp jspGenerator = new GenerateJsp(URI.createFileURI("C:/.../my.javaxmi"), | ||
+ | new File("C:/.../myOutputFolder"), new ArrayList<Object>()); | ||
+ | jspGenerator.doGenerate(null); | ||
+ | </source> | ||
+ | |||
+ | |||
+ | == Source Repository == | ||
+ | |||
+ | All the source code is stored in the Eclipse public source repository: | ||
+ | |||
+ | * JSP metamodel : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp/ | ||
+ | * JSP discoverer : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp.discoverer/ | ||
+ | * JSP generator : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp.generation/ | ||
− | + | {{MoDisco}} | |
− | + | [[Category:MoDisco]] | |
− | + |
Revision as of 04:13, 30 March 2011
MoDisco |
Website |
Download |
Community |
Mailing List • Forums |
Bugzilla |
Open |
Help Wanted |
Bug Day |
Contribute |
Browse Source • Project Set File |
Contents
JSP Metamodel
The Modisco JSP MetaModel inherits from the Modisco XML one :
The choice to extend the XML metamodel was made because JSP scripts use the same tag mechanism, attributes and comments, and contain well formed XML most of the time.
According to the "Java Server Pages Specifications Version 1.2", JSP content is divided into 4 categories :
- JSP Scripts :
- JSP Scriplet :
<% int variable = 0;%>
- JSP Expression :
<%= variable %>
- JSP Declaration :
<%! int variable = 0; %>
- JSP Scriplet :
- JSP Actions :
<myPrefix:myAction arg1="value" />
- JSP Standard Action :
<jsp:getProperty name="beanName" property="propertyNamef" />
- JSP Standard Action :
- JSP Directive :
<%@ include file="myFilePath" %>
- JSP TagLib :
<%@ taglib prefix="myPrefix" uri="taglib/mytag.tld" %>
- JSP TagLib :
- Comments :
<%-- This is a JSP comment --%>
JSP Discoverer
User Manual
The plug-in provides the user with a contextual menu to easily create JSP models.
By right-clicking on a JSP Project in the Eclipse Package Explorer view, you can quickly create the JSP model of your application (see next Figure).
You can also select one or several files to create a model for each one of them
Once launched, a progress bar will appear at the bottom of the window as soon as the operation begins. Depending on the size of your application, the reverse engineering process might take some time to complete (see next Figure).
At the end of the process, the newly created model files are added to the root of your project and are automatically opened in the default editor (see next Figure).
.jspxmi files can be opened in the Sample Ecore Model Editor (see next Figure).
They can also be opened in the MoDisco model browser (see next Figure).
Discovery Limitations
Because JSP language is used to generate some content, it can be placed almost anywhere in the file, which implies some limitations:
This is why the "isTagFragment : EBoolean" attribute was added. In fact, everything contained in a tag declaration, as in its body, is considered as a children of this tag. It is indeed necessary to be able to differentiate whether the JSP tag is used to generate the tag description, or its body.
Some ways of implementing JSP might cause some problems with the parser, especially for tag's attributes evaluation. What is expected to be found is some kind of syntax like :
name="value"
or name='value'
and even name=value
Sometimes we faced implementations like :
<tag name=" <% if(condition){ %> value1" <% }else{ %> value2" <% } %> >
The parser finds the opening double quote for the attribute's value, then looks for the closing one.
Returned value will be: with an exception raised on the last double quote, because '=' is expected.
Source Repository
All of the source code is stored in a public source repository, which you can access at:
Discoverer API
Each MoDisco discoverer responds to a normalized interface and can be called programmatically (see org.eclipse.gmt.modisco.infra.discoverymanager.Discoverer).
As an example, you may checkout the code from org.eclipse.gmt.modisco.jsp.discoverer.tests project.
JSP Generation
The goal of the JSP Generation plug-in is to allow JSP/Html code generation from a Java model
Description
This plug-in proposes Acceleo MTL modules for generating JSP/html files conforming to JSP models. There is only one template which generates thecode
JSP models are obtained with JSPDiscoverer component.
User Manual
First, you need a JSP model. Please refer to the JSP Discoverer user manual.
To launch a JSP generation:
- Checkout org.eclipse.modisco.jee.jsp.generation into your workspace from the Eclipse SVN repository, and create an Accelo launch configuration pointing to the GenerateJsp java class, and specify the input model and target folder.
Or
- Add org.eclipse.modisco.jee.jsp.generation to your plug-in dependencies and use the GenerateJsp main method with the input model and target folder as parameters. The code should look like this :
GenerateJsp jspGenerator = new GenerateJsp(URI.createFileURI("C:/.../my.javaxmi"), new File("C:/.../myOutputFolder"), new ArrayList<Object>()); jspGenerator.doGenerate(null);
Source Repository
All the source code is stored in the Eclipse public source repository:
- JSP metamodel : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp/
- JSP discoverer : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp.discoverer/
- JSP generator : https://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/plugins/trunk/org.eclipse.modisco.jee.jsp.generation/
MoDisco | |
Components | Infrastructure: KDM · SMM · GASTM · Model Browser · Discovery Manager · MoDisco Workflow · Query Manager · Facet Manager · Metrics Visualization Builder · KDM Source Extension Technologies: Java · JEE · EjbJar · WebApp · XML Use Cases: Simple Transformation Chain · Model Filter |
Help | Installation · SVN |
Project | API Policy · Retention Policy · Project Plan · metrics · Accessibility Guidelines · Capabilities Disablement |