创建seam文件

来源:互联网 发布:公安大数据应用与问题 编辑:程序博客网 时间:2024/06/01 10:21

环境:Jboss 5.0 版 seam 2.2版 linux系统


启动Jboss:

找到Jboss的目录下:……/jboss/bin   然后输入命令 ./run.sh   启动jboss


创建seam文件,以下选项按我自己的想法来设定的,依个人条件自行设定。


进入seam目录下输入命令(蓝色部分)

……/seam$  ./seam setup

回车后就可以进行文件搭建了

setup:
     [echo] Welcome to seam-gen 2.2.2.Final :-)
     [echo] Answer each question or hit ENTER to accept the default (in brackets)
     [echo] 

第一步:
    [input] Enter the directory where you want the project to be created (should not contain spaces) [/home/huihui/work/seam-project] [/home/huihui/work/seam-project]   
//[]内为seam文件默认存储路径,如果不想用默认的存储路径,可自定义

第二步:
    [input] Enter your JBoss AS home directory [/home/huihui/app/jboss-5.0.0.GA] [/home/huihui/app/jboss-5.0.0.GA]
//[]内为JBoss存在路径,如果JBoss路径改变,此值需改
第三步:
    [input] Enter your JBoss AS domain [default] [default]
//本人采用的默认值
第四步:
    [input] Enter your GlassFish V2 or V3 home directory (Ignore if you aren't deploying to GlassFish) [C:/Program Files/glassfish-v2.1] [C:/Program Files/glassfish-v2.1]
//本人采用的默认值
第五步:
    [input] Enter your GlassFish domain (Ignore if you aren't deploying to GlassFish) [domain1] [domain1]
//本人采用的默认值
第六步:
    [input] Enter the project name [demo] [demo]
//输入创建的seam文件的名字【】内为默认,可自行修改
第七步:
     [echo] Accepted project name as: demo

第八步:
    [input] Do you want to use ICEfaces instead of RichFaces? [n] (y, [n])
//本人选n
第九步:
    [input] skipping input as property icefaces.home.new has already been set.
    [input] Select a RichFaces skin [blueSky] ([blueSky], classic, darkX, deepMarine, DEFAULT, emeraldTown, glassX, japanCherry, laguna, ruby, wine)
//选择皮肤,可根据个人喜好选择
第十步:
    [input] Is this project deployed as an EAR (with EJB components) or a WAR (with no EJB support)? [ear] ([ear], war)
ear  //当用ant将文件传到JBoss时文件的扩展名,对应方式ant explode 对应ear,ant deploy 对应war

第十一步:
    [input] Enter the base package name for your Java classes [com.mydomain.demo] [com.mydomain.demo]

com.Demo.demo

//定义Java classes的包名

第十二步:
    [input] Enter the Java package name for your session beans [com.Demo.action] [com.Demo.action]
com.Demo.action

//定义 session beans的包名

第十三步:
    [input] Enter the Java package name for your entity beans [com.Demo.model] [com.Demo.model]
com.Demo.model

 //定义 entity beans的包名

第十四步:
    [input] Enter the Java package name for your test cases [com.Demo.demo] [com.Demo.demo]
 //定义 test cases的包名
第十五步:
    [input] What kind of database are you using? [postgres] (hsql, mysql, derby, oracle, [postgres], mssql, db2, sybase, enterprisedb, h2)
postgres

//确定你使用的数据库类型,选择相应的数据库类型名

第十六步:
    [input] Enter the filesystem path to the JDBC driver jar [/home/huihui/Downloads/postgresql-9.1-903.jdbc4.jar] [/home/huihui/Downloads/postgresql-9.1-903.jdbc4.jar]
//确定JDBC驱动路径
第十七步:
    [input] skipping input as property driver.license.jar.new has already been set.
    [input] Enter the Hibernate dialect for your database [org.hibernate.dialect.PostgreSQLDialect] [org.hibernate.dialect.PostgreSQLDialect]
//默认
第十八步:
    [input] Enter the JDBC driver class for your database [org.postgresql.Driver] [org.postgresql.Driver]
//默认
第十九步:
    [input] Enter the JDBC DataSource class for your database [org.postgresql.jdbc3.Jdbc3ConnectionPool] [org.postgresql.jdbc3.Jdbc3ConnectionPool]
//默认
第二十步:
    [input] Enter the JDBC URL for your database [jdbc:postgresql:demo] [jdbc:postgresql:demo]
jdbcjdbc:postgresql:test

//数据库中存在的文件,JDBC链接数据库中建立的文件,如果文件不存在则在创建seam项目时会报错

第二十一步:
    [input] Enter the database username [postgres] [postgres]
//database username
第二十二步:
    [input] Enter the database password [111111] [111111]
// database password
第二十三步:
    [input] Enter the database schema name (Enter '-' to clear previous value) [public] [public]
//database schema name 
第二十四步:
    [input] Enter the database catalog name (Enter '-' to clear previous value) [] []
// database catalog name
第二十五步:
    [input] Are you working with tables that already exist in the database? [n] (y, [n])
n

//可根据自己的情况来
    [input] Do you want to recreate the database tables and execute import.sql each time you deploy? [n] (y, [n])
n

//可根据自己的情况来


这个过程走完后,如果出现……BUILD SUCCESSFUL,则继续输入命令(蓝色)……/app/seam$   ./seam create-project,

出现BUILD SUCCESSFUL,则创建文件成功。


输入ctrl + shift + t 开启另一个终端

用ant 导入seam文件,方法如下:

找到seam文件所在目录,路径结果为……/seam-project/demo

输入命令  cd 文件名  进入到文件下。

进入文件下后再输入命令   ant deploy 或 ant  explode 把文件部署到jboss上


打开浏览器,在地址栏里输入:http://localhost/8080/(文件名)  刷新就可以看到seam默认的一个界面。



1 0
原创粉丝点击