2012年9月7日金曜日

struts2 action type plainTextの使い方

struts.xml のファイルに

              <action class="testAction" method="test" name="test">   
         <result name="success" type="plainText">
           <param name="charSet" />UTF-8
           <param name="location" />/test.jsp
         </result>   
         </action>

actionの中に、responseでクライアントにデータを転送する
ServletActionContext.getResponse().setContentType ("text/html;charset=utf-8");
  PrintWriter out = ServletActionContext.getResponse().getWriter();
  out.print("test");
  out.flush();
  out.close();

<param name="charSet">UTF-8</param>の目的は、文字化けを防ぐのため


2012年9月6日木曜日

eclipse プロジェクトのクリーンをやってること

eclipse プロジェクトのクリーンをやってること

プロジェクトのクリーンとは?

.classファイル削除し、再コンパイルを行う。基本的には、rebuildを実行する

2012年9月5日水曜日

jquery 空のオブジェクトかどうかを判別


$.isEmptyObject(value)
プロパティを持たない空オブジェクトの場合はtrue、プロパティを持つオブジェクトの場合はfalse


jQuery.isEmptyObject({}) // true
jQuery.isEmptyObject({ foo: "bar" }) // fals