原创 使JSP內相對路徑基於同一個位置

<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+requ

原创 各框架配合問題

1. 當Struts2遇到H2 在struts2中可以做配置,當配置文件或java代碼改變時,自動重新發布。這個讓人覺得很方便。而H2數據庫不支持Multi-Threaded Statement Processing,在你用這個數據庫文件

原创 document.form.xxxx方式獲得表單元素

這是老式的獲取表單元素的方法,例如if(document.form.password.value==""),它先找id爲password的元素,找不到則找name屬性爲password的元素,再找不到就會報錯。當然對於這句它是在name或

原创 利用struts2的ActionContext但JSP中取不到屬性值

今天這樣寫ActionContext.getContext().put("allGoodsSum", 300);但在JSP中卻得不到此值,後來放在session中,纔可以得到。最終也沒弄清楚,我的那個JSP中include了好幾個其它的J

原创 pager_taglib使用

1) 準備 原始的pager-taglib.jar可能會導致中文亂碼(準確說是在url中有中文時),要用修改過的。(要沒有可給我評論中索取) 2) 分頁jsp文件 將分頁的代碼寫到一個獨立的jsp文件中, <%@ pagelanguage

原创 EL表達式常用判斷

判斷不爲null, <c:if test="${ not empty null}">般配</c:if> 判斷爲null, <c:if test="${ not empty null}">般配</c:if> 判斷不相等, <c:if tes

原创 鼠標變爲手形

<a  style="cursor:pointer"onClick="window.open('${goodsDetail}?id=${goods.id}','','width=500,height=200');">查看詳細內容</a>

原创 向JSP傳值注意事項

如果action中有一屬性名爲affiche,又ActionContext.getContext().put("affiche", afficheDb);那麼在JSP中用${affiche.id}時取得是action屬性中的這一個affi

原创 action的返回類型是另一個action

<result name="showOrders" type="redirectAction">order_showOrders</result> 標籤體爲另一個action的name.實際上用的是客戶端重定向。

原创 js與server數據交換

1. Json使用 <script type="text/javascript">    var json='{"result":false}';    var obj=eval('('+json+')');    var result

原创 Strut2得到原始的request對象

HttpServletRequest request=ServletActionContext.getRequest();

原创 c:forEach得到循環計數

<c:forEach items="${goodsSellList }"var="goods" varStatus="status"> <strong>NO ${status.count }</strong>

原创 hibernate注意事項

1.  org.hibernate.hql.ast.QuerySyntaxException: unexpected token: member near line 1, column 6 [from member wheremember

原创 匹配多個action時究竟執行哪個

<packagename="member_action"namespace="/member"extends="struts-default">     <actionname="maintain_*"class="com.gathers

原创 利用泛型避免工廠方法強制類型轉換

1. 首先要有一個配置文件beans.properties: memberDao=com.gathershell.daoImpl.MemberDaoImpl 2. Java代碼: public class BeanUtil {