ノックステクノロジーのブログ -2ページ目

SAStruts + Mayaa ファイルアップロード

struts-config.xml


<controller
maxFileSize="1024K"
bufferSize="1024"
processorClass="org.seasar.struts.portlet.action.S2RequestProcessor"
multipartClass="org.seasar.struts.upload.S2MultipartRequestHandler"/>
(multipartClass="org.seasar.struts.upload.S2MultipartRequestHandler"を追加)



XxxForm


public FormFile formFile;


XxxAction


@Execute(input = "Xxx.html", redirect = true)
public String xxx() throws Exception{

try {
//ファイルの格納先フォルダの絶対パスを取得
ServletContext app = ServletContextUtil.getServletContext();
String path = app.getRealPath("/WEB-INF/images/" + XxxForm.formFile.getFileName());

//ファイル書き込み
UploadUtil.write(path, XxxForm.formFile);

} catch (RuntimeException e) {
throw e;
} finally {
//一時領域に生成したアップロードファイル情報を削除
XxxForm.formFile.destroy();
}

return "/";
}



Xxx.html


<input type="file" name="formFile" size="35" value="" />



Xxx.mayaa


<s:form m:id="form" enctype="multipart/form-data">
(enctype="multipart/form-data"を追加)



SAStruts Dxo

dxoパッケージの作成


XxxDxo(Interface)の作成



app.dicon


<include path="dxo.dicon"/>

を追加



customizer.dicon



<component name="dxoCustomizer" class="org.seasar.framework.container.customizer.CustomizerChain">
<initMethod name="addCustomizer">
<arg>traceCustomizer</arg>
</initMethod>
<initMethod name="addCustomizer">
<arg>s2DxoCustomizer</arg>
</initMethod>
</component>

を追加

SAStruts + Mayya

①ファイルのダウンロード


・apache-tomcat-sastruts-6.0.16.zip
・eclipse-jee-europa-winter-win32.zip
・pleiades_1.2.2.zip
・jstyle_3.4.0.0.zip
・tomcatPluginV321.zip



②プラグインを追加


・jstyle


 ダウンロードしたファイルを解凍し、Eclipseフォルダに上書きする


・pleiades


 ダウンロードしたファイルを解凍し、Eclipseフォルダに上書きする

 eclipse.ini.sample.3.3-
 の最後の行をコピーしeclipse.iniの最後に貼り付ける


・Tomcatプラグイン
 tomcatPluginV321.zipを解凍しpluginsにコピーする


・eclipse.exe -clean.cmdでeclipseを起動



③ソフトウェアの更新


Europa ディスカバリーサイト
・Web標準ツール


seaser2 3.3
http://eclipse.seasar.org/updates/3.3/
・Dolteng
・Kijimuna
・Matatabi
・S2JUnit4 Plugin
・SAStruts Plugin


プロパティエディタ

http://propedit.sourceforge.jp/eclipse/updates/


Subversive
・Subversive plug-in update site
http://download.eclipse.org/technology/subversive/0.7/update-site/
上記サイトから
Subversive SVN チーム・プロバイダー(インキュベーション)をインストール

・Subversive SVN Connectors update site
http://www.polarion.org/projects/subversive/download/eclipse/2.0/update-site/
上記サイトから
Subversive SVN コネクターををインストール




④Tomcatホームの設定


 ウィンドウ-設定-Tomcat
  Tomcatホームを設定する


⑤プロジェクトの作成


 新規-プロジェクト-Dolteng Projectを作成する

 プロパティ-Tomcat
  Tomcatプロジェクトにチェックを入れる
  コンテキストパスを追加
  



Virtual Box2.1.4 Guest Additonsのインストール(CentOS5)

・Virtual Box

 インストールが簡単

 共有フォルダを作成できる

 複数のGuestOSをインストール可


CentOS5 on Virtual Box 2.1.4にGesu Additionsのインストール方法


1.GuestOSを起動する



2.デバイス-Guest Additions のインストールを選択



3.コマンド実行


 # su -

 # mount /dev/cdrom /mnt
 # cd /mnt
 # sh VBoxLinuxAdditions-x86.run x11



4.再起動


 再起動後にHost OSと Guest OSをスムーズにマウスの移動ができるようになる






Douteng ProjectのDB(PostgreSql)を表示する

PostgreSql8.3への接続の場合


1.データベース・ビューを表示


 Eclipseのウィンドウ-ビューの表示-その他-Dolteng-データベース・ビューを選択



2.接続設定


 プロジェクトが表示されるので、右クリック-構成を選択


 名前:任意

 ドライバー・パス:/webapp/WEB-INF-postgressql-8.3-604.jdbc3.jar ※jarファイルはあらかじめ配置しておく

 ドライバー・クラス:ドライバー・パス設定後に検索ボタンをクリックすると「org.postgresql.Driver」が表示される

 接続URL:jdbc.diconで定義した値

 ユーザーID:jdbc.diconで定義した値

 パスワード:jdbc.diconで定義した値

 文字セット:UTF-8