2014年1月20日 星期一

Struts2 if tag for string and char comparison

Explanation: 
There are tow tag using in charater: String , character , and there are different in judge, if you using the character you will get false:


Result:
1. String example for work
 
<s:set name="webFramework" value="framework"/>
<s:if test="%{#webFramework=='Struts 2'}">
    This is Struts 2
</s:if>
<s:elseif test="%{#webFramework=='Struts 1'}">
    This is Struts 1
</s:elseif>
<s:else>
    Other framework
</s:else>

2. Character for work
<s:if test='%{#session.IsLogin== ("T")}'>
    Login
</s:if>
<s:else>
    LogOut
</s:else>




Reference:
String compare
character compare


























struts2 session login

Reference:
Sessions in struts2 application

Simple Struts login in example

2014年1月16日 星期四

Eclipse update

For WPT

For Juno :
http://download.eclipse.org/webtools/repository/juno/
For Indigo :
http://download.eclipse.org/webtools/repository/indigo/
 
 
Reference: 
WTP-update 

2013年11月11日 星期一

Virtual Box 上 安裝 CentOS Guest Additions


Problem:

1. "building the virtualbox guest additions kernel modules [失敗]"
2. "Building the OpenGL support module FAILED "


1. Solution: (內容為參考 竹林小屋 Virtual Box 上 安裝 CentOS Guest Additions )
所需套件:
1.gcc
2.kernel-devel
3.kernel-headers

安裝流程:
yum install gcc    #安裝gcc,會同時安裝很多相依套件
yum install kernel-devel    #安裝kernel-devel
yum install kerner-headers    #安裝kernel-headers

安裝完成之後,還必須注意一點........
kernel、kernel-devel、kernel-headers三個套件版本要一樣!
否則人生失敗句可能還會再重現XD
rpm -qa | grep kernel    #檢查三個套件的版本是否一樣

筆者遇到kernel版本比其他兩個還要低,所以還要升級一下。
yum update kernel    #升級kernel版本

升級好之後,重新開機使用新的kernel。(不曉得有沒有不用重開的方法)

2. solution (http://it.oyksoft.com/post/6568/):

cd /media/VBOXADDITIONS_4.1.8_75467/
export MAKE='/usr/bin/gmake -i'
./VBoxLinuxAdditions.run


"make -i" , -i, --ignore-errors   Ignore errors from commands.忽略错误

3. 如果 kernel update 後, 程式
要從新 recompile 程式, 但會出現 /etc/init.d/vbox setup
yum install -y  kernel-devel





2013年10月8日 星期二

location hash explaination


Reference:
網頁設計筆記(二十一) 一頁式網頁 location.hash
mozilla Window.location
jQuery hashchange event

css float and clear property

1. Explaintion:
The float proper can set the div or other as the layout that out of the regular, which is such a hidden man in the content, and others is not see this float block,
and the other content will layout there self deployment which ignore the float block and behaviour, ex wrap the div, which such there is no float block exist.

The clear proper is set to the other content block, that will know there has a float block, and it will new a layout to deploy itself



Reference:
w3c 
修正 CSS 對於 float 區塊, 使用 clear:both 無效的解法
 Overflow清除Float效果的妙用


2013年10月7日 星期一

struts2 OGNL value Get Method

1. Problem:
there are some difference method to get struts2 value such as $, #,
but what is the difference between them??


2. Solution:
  • objectName: object in the ValueStack (default/root object in the OGNL context), such as an Action property
  • #objectName: object in the ActionContext but outside of the ValueStack, specifically...
  • %{ OGNL expression } is used to force OGNL evaluation of an attribute that would normally be interpreted as a String literal.

Reference:
whats-the-difference-between-and-signs-in-struts-tags