adalm pluto_Apache Pluto和Groovy集成教程示例

本文档提供了一个使用Apache Pluto、Groovy和MVC设计模式的员工注册Portlet完整示例。Groovy作为Java Virtual Machine (JVM)语言,允许无缝集成。教程涵盖了项目结构、数据库交互、业务处理和JSP视图等内容,展示了如何在不需额外配置的情况下在门户页面上部署Groovy Portlet。
摘要由CSDN通过智能技术生成

adalm pluto

Apache Pluto provides you a vast amount of integration types that you could use when it comes to deal with the Portlet development missions. We’ve previously, introduced you different types of Portlets; Standard Portlet (JSR286), JSP & Servlet, JSF 2.0, Struts 2.0, PHP 5 and now a Portlet of type Groovy.

Apache Pluto为您提供了大量的集成类型,可用于处理Portlet开发任务。 之前,我们为您介绍了不同类型的Portlet。 标准Portlet(JSR286)JSP和ServletJSF 2.0Struts 2.0PHP 5 ,现在是Groovy类型的Portlet。

Groovy is a Java Virtual Language (JVM) that’s working inside a JVM seamlessly like any Java Class you may write. Apache Pluto provides you a Groovy Bridge that enables you exposing a Groovy Portlet into your Portal Page without any need for additional cosmetics.

Groovy是一种Java虚拟语言(JVM),可以像您可能编写的任何Java类一样在JVM中无缝运行。 Apache Pluto为您提供了Groovy桥,使您可以将Groovy Portlet暴露到门户页面中,而无需其他外观。

This tutorial is intended for providing you a full-fledged example for registering employees, in which an initial page will be displayed for employee’s information gathering. Once the user has submitted the form the employee registration will start and the confirmation message will be displayed too.

本教程旨在为您提供一个完整的员工注册示例,其中将显示初始页面以收集员工的信息。 用户提交表单后,员工注册将开始,并且确认消息也将显示。

项目结构 (Project Structure)

This figure below should help you recognize one of the best location for putting your Groovy classes as well as showing you the different accompanies files for the project.

下图可以帮助您识别放置Groovy类的最佳位置,并为您显示该项目的不同随附文件。

员工表 (Employee Table)

As being we have a registration employee form, let’s look at the form of the Employee Table and its relevant columns.

由于我们拥有一个注册员工表单,因此让我们看一下“员工表”及其相关列的表单。

As also, you can use below SQL create statement to get Employee Table created into your Schema.

同样,您可以使用下面SQL create语句将Employee Table创建到Schema中。

employee.sql

employee.sql

CREATE TABLE `employee` (
  `EMP_ID` int(11) NOT NULL AUTO_INCREMENT,
  `EMP_NAME` varchar(45) DEFAULT NULL,
  `EMP_JOB` varchar(45) DEFAULT NULL,
  `EMP_SALARY` int(11) DEFAULT NULL,
  PRIMARY KEY (`EMP_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

员工模式 (Employee Model)

In the MVC design pattern and according for the concept of Separation of Concern, we must have an Employee Model that it takes the form of:

在MVC设计模式中,并根据关注分离的概念,我们必须具有以下形式的Employee模型:

Employee.java

Employee.java

package com.journaldev.data;

public class Employee {
	private int id;
	private String name;
	private String job;
	private int salary;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getJob() {
		return job;
	}

	public void setJob(String job) {
		this.job = job;
	}

	public int getSalary() {
		return salary;
	}

	public void setSalary(int salary) {
		this.salary = salary;
	}
}

This model will hold the data that’s going back and forth between the different components defined in the application.

该模型将保存在应用程序中定义的不同组件之间来回传递的数据。

将Groovy插件安装到Eclipse中 (Install Groovy Plugin Into Your Eclipse)

To make sure you’re able of getting Groovy sources inside your Maven project, you must install Eclipse Groovy Plugin into your Eclipse IDE.

为了确保可以在Maven项目中获取Groovy源,必须将Eclipse Groovy 插件安装到Eclipse IDE中。

Installing of Eclipse Plugin wouldn’t take much time as you can do that by using the Eclipse install new software facility.

Eclipse插件的安装不会花费很多时间,因为您可以使用Eclipse安装新软件工具来完成安装。

  • From help menu, choose Install New Software.

    从帮助菜单中,选择“ 安装新软件”
  • Paste copied link into Work with input and waiting until Eclipse show you the listed supposed updates that plugin contains.

    将复制的链接粘贴到“使用输入”中,然后等待Eclipse向您显示插件包含的列出的假定更新。
  • Select Groovy-Eclipse (Required) & Click next.

    选择Groovy-Eclipse(必需)并单击下一步。
  • Proceed until your eclipse has installed the Groovy Plugin and restart your Eclipse to make sure your installed Plugin takes effect.

    继续进行操作,直到您的Eclipse安装了Groovy插件,然后重新启动Eclipse以确保已安装的插件生效。
  • Now, from your Maven Project (That you’ve created before), create a Groovy class normally.

    现在,从您之前创建的Maven项目中,正常创建一个Groovy类。

RegisterEmployeePortlet Groovy Portlet (RegisterEmployeePortlet Groovy Portlet

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值