开发Struts 2的Eclipse插件
哪些抵制JLF和France的爱国guys就不要看了,是个French弄的开源插件。真正爱国的是农民朋友,从来不用帝国主义生产的电脑和软件。感谢网中人分享此信息!
看情况需要安装在 Eclipse 3.3 Java EE 版本上。
Alveole Studio MVC Web Project An eclipse plugin for Struts 2
MVC Web Project
MVC Web Project is a generic plugin for eclipse that enables J2ee developers to organize their web project visually using MVC (Model View Controller) model.
MVC Web Project currently integrates Struts 2 framework only, but its API is open and MVC Web Project can be extended to any MVC framework.
Alveole Studio
Alveole Studio is a French firm currently composed by a single developer: Sylvain RIBEYRON.
Screenshots
Tutorial – step 3: create actions and views
Creating first action
Enter initialization package (double-click on Initialization node).
Click on "struts2" button:

On properties panel, fill action properties as follows:

Fill fields:
- Action Name: it is the name attribute in struts2 action. This name is used in URL to call the specified Action.
- Node Label: a text that is displayed on the graph.
- Action class: a class that implements this action (you can click the browse button to choose an existing class).
- Action method: the method that is called on this action.
Then click ok.

Then double-click on the created node. This open a new Java Class creation wizard:

This creates a new class, and automatically add the init() method:

Note: you can close the Action class. When you simply double-clicks on action node, plugin automatically opens Java source, and focuses on the init() method.
Creating first view
First of all, create a jsp directory inside WebContents. (This operation is not mandatory but it provides a clearer organization of code, because all JSP will be stored under this directory).
Then click on the Jsp view button on tool-bar:

Fill view properties on properties panel:

And click ok…

Double-click on the created node. It opens new JSP wizard (or it opens JSP if it already exists).

Create your JSP using any provided template:

Instead of classic struts2 taglibs, MVC Web Project provides an extended set of struts taglibs that facilitate use of links between views and other actions. Add the following taglib:
<%@ taglib uri="/alveole-struts2" prefix="s" %>
To fasten your developments, you may add the following JSP template in eclipse:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/alveole-struts2" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
Linking action to view
Creating links from actions to views is interpreted as an action mapping. Links of this type are named, and name is used for action mapping.
Create a link from struts2 node to view node (click link button, drag’n drop link from struts node to JSP view and fill lin properties). Name it "success":

Then click OK:

By returning "success" in Action.init(), the created link is followed to displayed the target view.


