1.menu栏中对应页面
URL ws.conf.notice-index.service 权限bpwsupper
2.通过URL找到ws.conf下service-config-notice.xml文件
3.在service-id为index的service中获得该service
<service>
<service-id>index</service-id>
<next-page>
<page-path>/notice/topicIndex.jsp</page-path>
</next-page>
</service>
通过page-path打开topicIndex.jsp页面
4.topicIndex.jsp页面提交from时
<imart:Form application="ws.conf.notice" service="sendTopicService">
找到到ws.conf下service-config-notice.xml文件,service-id为sendTopicService的Service
<service>
<service-id>sendTopicService</service-id>
<controller-class>
ws.conf.service.TopicController
</controller-class>
<input-error>
<page-path>/notice/error.jsp</page-path>
</input-error>
<next-page>
<page-path>/notice/topicShow.jsp</page-path>
</next-page>
</service>
5.通过controller-class,进入TopicController.java (extends ServiceControllerAdapter)
先运行其中的check()方法,如果有throw new RequestException("XXX"),则进入 sendTopicService的Service中的input-error页面error.jsp
6.如果check()通过,运行TopicController的service()方法,运行成功后转入page-path的topicShow.jsp页面
7.topicShow.jsp中如果有HelpBean(extends HelperBean)
<imart:HelperBean id="topicViewBean" class="ws.conf.bean.TopicViewBean" />
会先运行TopicViewBean中init()方法,可以在TopicViewBean定义全局变量,init对其进行赋值,就可以在jsp页面使用这些数据了
8.在Controller和Bean中,可以调用Event时间
Event event = createEvent("ws.conf.notice", "topic_view");
EventResult eventResult = dispatchEvent(event);
其中,会先找ws.conf下event-config-notice.xml文件event-key为topic_view的event-group
<event-group>
<event-key>topic_view</event-key>
<event-class>jp.co.intra_mart.framework.base.event.EmptyEvent
</event-class>
<event-factory>
<factory-class>
jp.co.intra_mart.framework.base.event.StandardEventListenerFactory
</factory-class>
<init-param>
<param-name>listener</param-name>
<param-value>ws.conf.event.TopicShowEventListener
</param-value>
</init-param>
</event-factory>
</event-group>
createEvent的结果类型就是event-class的类型,eventclass可以定义事件传递的参数和数据
当调用dispatchEvent方法时,就会找到TopicShowEventListener的fire方法,进行逻辑处理,返回值为TopicShowEventResult:EventResult,可以携带处理完成后的数据
9.使用数据库时,getDAO("ws.conf.notice", "topic_dao", event
.getUserInfo().getLoginGroupID());
会找到ws.conf下的data-config-notice.xml文件,dao-key为topic_dao的dao-group,获得对应的Dao层对象
<dao-group>
<dao-key>topic_dao</dao-key>
<dao>
<dao-class>ws.conf.dao.impl.TopicDaoImpl</dao-class>
<connector-name>system_db</connector-name>
</dao>
</dao-group>
connector有2种:
<connector-name>system_db</connector-name> TopicDaoImpl extends SystemDBDAO
<connector-name>logingroup_db</connector-name> TopicDaoImpl extends LoginGroupDBDAO