アクションでjspページをテストします.


テスト:今回のテストは一つのポップアップページをテストしますが、それに応じた調整がないので、自分でアクションの調整を書くしかないです.ステップは以下の通りです.
1.TestActionを作成してアクションを継承し、TestActionでmapping.findWord(「success」)を書きます.
2.Struts-config.xmlファイルに対応するactionmappingのactionとforwardを配置する:

|<!--      -->
	<action 
		path="/ref/openCas"
		type="com.baosight.baosteel.bsi.cs.common.util.TestActionOpen"
		scope="session">
		<forward
			name="open"
			path="/helper/annProcess/announcementOpen.jsp"/>
	</action>
3.該当するDao、DaoImpl、Service、ServiceImplなどのjavaファイルを配置します.
4.一番重要なのはjspページで呼び出しました.コンテキストを取るには二つの方法があります.

(1)ActionContext context = new ActionContext();
AnnouncementOpenService announcementOpenService =(AnnouncementOpenService)context.findService("announcementOpenService",AnnouncementOpenService.class);

(2)ActionContext context = new ActionContext();
AnnouncementOpenService announcementOpenService =(AnnouncementOpenService) com.baosight.core.spring.BeanFactory
				.findService("announcementOpenService",AnnouncementOpenService.class);
5.jspページで使用するクラスのカバンを導入することに注意してください.これは重要な配置が整ったらテストができます.