2012年6月29日金曜日

struts2.0 ValueStackの表示

Struts2 ValueStackの値、JSPで

<%
ValueStack vs
=(ValueStack)request.getAttribute("struts.valueStack");
out.print(vs.findValue(
"age"));%>





一覧で見たい時は

<s:debug />

2012年6月27日水曜日

struts2 action メッセージとアクション エラーの表示

アクションエラー

<s:if test="hasActionErrors()">
   <div class="errors">
      <s:actionerror/>
   </div>
</s:if>
アクションメッセージ

<s:if test="hasActionMessages()">
   <div class="welcome">
      <s:actionmessage/>
   </div>
</s:if>

2012年6月22日金曜日

php 後方一致検索メソッド


/**
     * 後方一致検索メソッド
     */
    private function _endsWith($haystack, $needle)
    {
        $length = strlen($needle);
        if ($length == 0) {
            return true;
        }
   
        $start  = $length * -1; //negative
        return (substr($haystack, $start) === $needle);
    }

2012年6月11日月曜日

struts2 actionの中、パラメター設定


  1.   
  2. /**   
  3.     * File Name:BaseAction.java * Version: * Date:2010-1-27 * Copyright Belongs To Musoon  Corporation 2010    
  4. */  
  5.        
  6. package com.action;   
  7.   
  8. import java.util.Map;   
  9.   
  10. import javax.servlet.http.HttpServletRequest;   
  11. import javax.servlet.http.HttpServletResponse;   
  12.   
  13. import org.apache.struts2.ServletActionContext;   
  14.   
  15. import com.opensymphony.xwork2.ActionContext;   
  16. import com.opensymphony.xwork2.ActionSupport;   
  17.   
  18. /**  
  19.  * Project Name:ZhiMing   ** Class Name:BaseAction   
  20.  * Author:Musoon        ** Created Time:2010-1-27 下午06:45:35   
  21.  * Changed By:Musoon   ** Changed Time:2010-1-27 下午06:45:35   
  22.  * Changed Memo:   
  23.  * @version   
  24.  * Class Description:   
  25.  */  
  26.   
  27. public class BaseAction extends ActionSupport {   
  28.   
  29.     private static final long serialVersionUID = 7620009925942346125L;   
  30.        
  31.     ActionContext context = ActionContext.getContext();   
  32.     HttpServletRequest request = (HttpServletRequest) context.get(ServletActionContext.HTTP_REQUEST);   
  33.     HttpServletResponse response = (HttpServletResponse) context.get(ServletActionContext.HTTP_RESPONSE);   
  34.     Map session = context.getSession();   
  35.     //SessionMap session = (SessionMap) context.get(ActionContext.SESSION);   
  36.        
  37. }  

2012年6月8日金曜日

java.lang.NoClassDefFoundError: javax/annotation/security/RunAs の問題

解決方法としては、

run Configurations-> Classpath -> Add External JARs


org\apache\tomcat\annotations-api\6.0.13\annotations-api-6.0.13.jar を追加
jar ファイルがなけらば、download annotations-api.jar

ClassNotFoundException: org.objectweb.asm.ClassVisitorの問題

run Configurations-> Classpath -> Add External JARs

asm/asm/3.3.1/asm-3.3.1.jar を追加


2012年6月7日木曜日

php eval php code

方法は二つ

eval('?>' . $content .'<?php');

もしくは

ob_start();
        include 'main.php';
        $str = ob_get_clean();

/.htaccess: Invalid command 'AuthDigestFile', perhaps misspelled or defined by a module not included in the server configuration エラーの解決方法

.htaccessファイルでdigest認証をかけるときに、こんなエラーが発生しました。

/.htaccess: Invalid command 'AuthDigestFile', perhaps misspelled or defined by a module not included in the server configuration

解決方法は:

「AuthDigestFile」は「AuthUserFile」に変更