让你用seam new-project创建的项目也能用上JBossTools的功能。

我们可以用jbosstools直接创建Seam的项目, 但是我试了创建war项目还好,创建ear项目的话, 创建出来的都是不能编译的, 而且发布到Jboss deploy目录也是不合法的ear布局。 这些问题虽然可以通过手工修改来解决。但是我觉得还是用seam new-project创建出来的项目结构好很多,而且有很好的ant脚本。可以很方便的执行各种任务,而且我看到[url=http://www.seamframework.org/Community/SeamUsersForum]seam论坛上[/url]有人就说用jbosstools创建的seam的ear项目其实有4个项目(大家可以试试)。 他更喜欢seam new-project创建出来的一种目录的形式。就只有一个目录,用svn也更方便。

Seam2.0.1, JbossTools2.0.0GA(现在已经出了2.0.1GA,请看我在javaeye上发的新闻[url]http://www.iteye.com/news/1554[/url])。

安装好JbossTools后, 你需要在eclipse中设置你的Seam的home。

[img]http://dengyin2000.iteye.com/upload/picture/pic/9738/be3c7189-cd12-3c39-a15c-932af621ea7b.png[/img]

用seam创建你的项目。请看。 [url]http://docs.jboss.com/seam/2.0.1.GA/reference/en/html/gettingstarted.html#d0e2146[/url]

创建玩项目后用eclipse把刚创建的项目导入到eclipse中。File->Import->General->Existed projects into Workspace. 导入后你可能会发现有编译错误。 这个是因为eclipse把这个项目的java compiler设到了1.4. 我们把这个改成5.0就行了。

[img]http://dengyin2000.iteye.com/upload/picture/pic/9742/42656887-0be4-3c8d-a919-c6a393bb51e8.png[/img]

Jbosstools最好的一项功能是它能自动的识别出项目中所有的component。这个在写xhtml非常方便。而且还能在xhtml中跳转到java code。 更多的jbosstools的功能请看。[url]http://in.relation.to/Bloggers/JBossToolsScreenshots[/url]

我们在eclipse中打开Seam Component, Window->Show View->Other->Seam->Seam Component.

我们发现我们刚刚导入的sample项目找不到任何的compoent。Order是我用Jbosstools创建的一个war seam项目。
[img]http://dengyin2000.iteye.com/upload/picture/pic/9744/99958599-c172-3258-a90f-833db087b8f2.png[/img]

OK,打开你的.project文件,加入以下的代码。 (不要告诉我你不知道.project在哪里,是干什么用的。)

		<buildCommand>
<name>org.jboss.tools.common.verification.verifybuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.seam.core.seambuilder</name>
<arguments>
</arguments>
</buildCommand>


加入之后的.project应该是这样的。

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>sample</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.common.verification.verifybuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.seam.core.seambuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>auto,full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value><project>/explode.launch</value>
</dictionary>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.hibernate.eclipse.console.hibernateNature</nature>
<nature>org.jboss.tools.seam.core.seamnature</nature>
</natures>
</projectDescription>


OK, 再看下Seam Component, 现在已经可以找到所有的seam component了。
[img]http://dengyin2000.iteye.com/upload/picture/pic/9748/747cb906-06d5-3936-9366-bb436fb3b0e2.png[/img]


随便写个seam compoenent。

import org.jboss.seam.annotations.Name;

@Name("testELExpression")
public class TestElExpression {
public String getName() {
return "deng.yin@gmail.com";
}

public void doListener() {

}
}


已经有提示了。

[img]http://dengyin2000.iteye.com/upload/picture/pic/9750/92883305-e11b-3d47-b947-9a8d86769497.png[/img]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值