您的位置:程序门 -> java -> 框架、开源



有人用appfuse 2.0.1吗?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


有人用appfuse 2.0.1吗?
发表于:2008-01-16 17:21:37 楼主
我照着作者视频做了一下,demo以及能用了。
我在   src\main\webapp   随便加了一个1.jsp。
可是http://127.0.0.1:8080/1.jsp   找不到文件。

他用的是mac   os,其中执行了下面的命令:
1   mvn   war:inplace
2   rm   -r   src/main/webapp/web-inf/lib
3   rm   -r   src/main/webapp/web-inf/classes/struts.xml
4   m   jetty:run

2,3行   执行的是什么意思?
4行   m是指mvn吗?
发表于:2008-01-17 10:39:231楼 得分:0
没有人用吗?这么好的集成框架啊
发表于:2008-01-17 16:10:262楼 得分:0
rm   应该是unix中的删除命令
第四行不知道

没有仔细看那段视频,我也一直想用一下appfuse
发表于:2008-01-17 17:06:123楼 得分:0
在struts2-crud视频中。
根据perion来生成代码的那段,

mvn   appfuse:gen
可我的出现了出错:h:\struts2-crud\target\appfuse\generated-sources   not   found

怎么回事啊?
发表于:2008-01-18 00:45:244楼 得分:0
maven不好用,还是用1.94那个,用ant,比较好用。。
不过我们现在用的是2.0,而且抛弃maven了。。自己手写。。
发表于:2008-01-18 16:30:265楼 得分:0
照着做了一遍。基本能用了。

1可是有些原理不太清楚,自己添加一个1.jsp
java code
<s:action name="hello" id="action" namespace="default"/> <strong>message from struts2!</strong> <span style="color:blue"><s:property value="#action.message"/></span>

还有一个action
java code
public class helloaction extends actionsupport { /** * */ private static final long serialversionuid = 2475227211747249299l; string message; public string getmessage() { return message; } public string EXECute() { message = "asdfasdf"; return success; } }

竟然不用配置struts.xml就能用了,奇怪呀。

2我个人习惯先建数据库,然后生成pojo。请问怎么做呢?
发表于:2008-01-18 17:23:566楼 得分:0
http://hi.baidu.com/zhang20084/blog/item/f1874ec26997ec36e4dd3bb4.html

这个地方有个文章,就是先建库,再生成pojo的
发表于:2008-01-19 11:05:237楼 得分:0
自己摸索了半天,pojo出来了。
问题又来了。

1   mvn   appfuse:gen   一次只能做一次,有什么办法能一次全部做完?

2   单独的一张表,做起来没问题。如果有n个表,而且这些表还有1对多,多对多的关系。就要出错了。

h:\appfuse2_test>   mvn   jetty:run-war
[info]   scanning   for   projects...
[info]   searching   repository   for   plugin   with   prefix:   'jetty'.
[info]   ------------------------------------------------------------------------
[info]   building   appfuse   struts   2   application
[info]         task-segment:   [jetty:run-war]
[info]   ------------------------------------------------------------------------
[info]   preparing   jetty:run-war
[info]   [aspectj:compile   {EXECution:   default}]
[info]   [native2ascii:native2ascii   {EXECution:   native2ascii-utf8}]
[info]   [native2ascii:native2ascii   {EXECution:   native2ascii-8859_1}]
[info]   [resources:resources]
[info]   using   default   encoding   to   copy   filtered   resources.
[info]   [compiler:compile]
[info]   nothing   to   compile   -   all   classes   are   up   to   date
[info]   [resources:testresources]
[info]   using   default   encoding   to   copy   filtered   resources.
[info]   preparing   hibernate3:hbm2ddl
[warning]   removing:   hbm2ddl   from   forked   lifecycle,   to   prevent   recursive   invocation.
[info]   [aspectj:compile   {EXECution:   default}]
[info]   [native2ascii:native2ascii   {EXECution:   native2ascii-utf8}]
[info]   [native2ascii:native2ascii   {EXECution:   native2ascii-8859_1}]
[info]   [resources:resources]
[info]   using   default   encoding   to   copy   filtered   resources.
[info]   [hibernate3:hbm2ddl   {EXECution:   default}]
[info]   configuration   xml   file   loaded:   h:\appfuse2_test\src\main\resources\hibernate.cfg.xm
l
[info]   configuration   xml   file   loaded:   h:\appfuse2_test\src\main\resources\hibernate.cfg.xm
l
[info]   configuration   properties   file   loaded:   h:\appfuse2_test\target\classes\jdbc.properti
es
alter   table   user_role   drop   foreign   key   fk143bf46a7c4d7a42;
alter   table   user_role   drop   foreign   key   fk143bf46a21783e22;
drop   table   if   exists   app_user;
drop   table   if   exists   role;
drop   table   if   exists   user_role;
create   table   app_user   (id   bigint   not   null   auto_increment,   username   varchar(50)   not   null   un
ique,   email   varchar(255)   not   null   unique,   password_hint   varchar(255),   first_name   varchar(5
0)   not   null,   last_name   varchar(50)   not   null,   phone_number   varchar(255),   website   varchar(25
5),   account_expired   bit   not   null,   account_locked   bit   not   null,   credentials_expired   bit   not
  null,   city   varchar(50)   not   null,   province   varchar(100),   postal_code   varchar(15)   not   null,
  address   varchar(150),   country   varchar(100),   account_enabled   bit,   version   integer,   passwor
d   varchar(255)   not   null,   primary   key   (id))   engine=innodb;
error   [main]   schemaexport.create(274)   ¦   unsuccessful:   create   table   app_user   (id   bigint   not
  null   auto_increment,   username   varchar(50)   not   null   unique,   email   varchar(255)   not   null   un
ique,   password_hint   varchar(255),   first_name   varchar(50)   not   null,   last_name   varchar(50)   n
ot   null,   phone_number   varchar(255),   website   varchar(255),   account_expired   bit   not   null,   ac
count_locked   bit   not   null,   credentials_expired   bit   not   null,   city   varchar(50)   not   null,   pr
ovince   varchar(100),   postal_code   varchar(15)   not   null,   address   varchar(150),   country   varch
ar(100),   account_enabled   bit,   version   integer,   password   varchar(255)   not   null,   primary   key
  (id))   engine=innodb
error   [main]   schemaexport.create(275)   ¦   table   'app_user'   already   exists
create   table   role   (id   bigint   not   null   auto_increment,   name   varchar(20),   description   varcha
r(64),   primary   key   (id))   engine=innodb;
error   [main]   schemaexport.create(274)   ¦   unsuccessful:   create   table   role   (id   bigint   not   nul
l   auto_increment,   name   varchar(20),   description   varchar(64),   primary   key   (id))   engine=inno
db
error   [main]   schemaexport.create(275)   ¦   table   'role'   already   exists
create   table   user_role   (user_id   bigint   not   null,   role_id   bigint   not   null,   primary   key   (use
r_id,   role_id))   engine=innodb;
alter   table   user_role   add   index   fk143bf46a7c4d7a42   (role_id),   add   constraint   fk143bf46a7c4
d7a42   foreign   key   (role_id)   references   role   (id);
alter   table   user_role   add   index   fk143bf46a21783e22   (user_id),   add   constraint   fk143bf46a217
83e22   foreign   key   (user_id)   references   app_user   (id);
[warning]   6   errors   occurred   while   performing   <hbm2ddl> .
[error]   error   #1:   java.sql.sqlexception:   error   on   rename   of   '.\appfuse2_test\user_role'   to
  '.\appfuse2_test\#sql2-428-12'   (errno:   152)
[error]   error   #1:   java.sql.sqlexception:   error   on   rename   of   '.\appfuse2_test\user_role'   to
  '.\appfuse2_test\#sql2-428-12'   (errno:   152)
[error]   error   #1:   com.mysql.jdbc.exceptions.mysqlintegrityconstraintviolationexception:   ca
nnot   delete   or   update   a   parent   row:   a   foreign   key   constraint   fails
[error]   error   #1:   com.mysql.jdbc.exceptions.mysqlintegrityconstraintviolationexception:   ca
nnot   delete   or   update   a   parent   row:   a   foreign   key   constraint   fails
[error]   error   #1:   com.mysql.jdbc.exceptions.mysqlsyntaxerrorexception:   table   'app_user'   al
ready   exists
[error]   error   #1:   com.mysql.jdbc.exceptions.mysqlsyntaxerrorexception:   table   'role'   alread
y   exists
[info]   [compiler:testcompile]
[info]   compiling   31   source   files   to   h:\appfuse2_test\target\test-classes
[info]   ------------------------------------------------------------------------
[error]   build   failure
[info]   ------------------------------------------------------------------------
[info]   compilation   failure

h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[24,54]   需要
')'

h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[24,55]   需要
';'

h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[53,54]   需要
')'

h:\appfuse2_test\src\test\java\xwj\webapp\action\linkcategoryactiontest.java:[53,55]   需要
';'


[info]   ------------------------------------------------------------------------
[info]   for   more   information,   run   maven   with   the   -e   switch
[info]   ------------------------------------------------------------------------
[info]   total   time:   11   seconds
[info]   finished   at:   sat   jan   19   10:58:35   gmt+08:00   2008
[info]   final   memory:   16m/29m
[info]   ------------------------------------------------------------------------

h:\appfuse2_test>
发表于:2008-01-19 18:05:448楼 得分:0
上面的问题解决了。pojo学错了。

又有一个问题:主要是涉及到外键。
难道appfuse不支持外键的数据库??

....一大段建表的sql语句....
[info]   [compiler:testcompile]
[info]   nothing   to   compile   -   all   classes   are   up   to   date
[info]   [dbunit:operation   {EXECution:   test-compile}]
[info]   ------------------------------------------------------------------------
[error]   build   error
[info]   ------------------------------------------------------------------------
[info]   error   EXECuting   database   operation:   clean_insert

embedded   error:   com.mysql.jdbc.exceptions.mysqlintegrityconstraintviolationexception:   cann
ot   add   or   update   a   child   row:   a   foreign   key   constraint   fails   (`struts2_crud/weblogcategory
`,   constraint   `fk70aa746e989ee255`   foreign   key   (`websiteid`)   references   `website`   (`id`))
[info]   ------------------------------------------------------------------------
[info]   for   more   information,   run   maven   with   the   -e   switch
[info]   ------------------------------------------------------------------------
[info]   total   time:   21   seconds
[info]   finished   at:   sat   jan   19   18:02:58   gmt+08:00   2008
[info]   final   memory:   14m/26m
[info]   ------------------------------------------------------------------------
发表于:2008-01-20 18:50:129楼 得分:0
关注
发表于:2008-01-20 21:47:5010楼 得分:0
参考appfuse的手册,   从头看到尾,你的问题都解决了.
使用appfuse,需要了解maven   2的基本功能,appfuse2.x完全依赖于maven2,如果不了解maven,appfuse用起来会很郁闷.
我现在用maven,感觉挺好.
发表于:2008-01-22 19:05:0911楼 得分:0
摸索了半天,问题解决了,不过又遇到一个问题。-_-!

一张表,自动生成demo能用。
如果几张有关系的表,生成的demo能显示,点了没有反应。郁闷哦。


快速检索

最新资讯
热门点击