JBOSS 點(diǎn)滴

          豐豐的博客

          #

          JAVA規(guī)范寫法

          更新某個對象時: 
          // 發(fā)布
           public String issue() throws Exception {
            String defineId = super.getRequest().getParameter("defineId");
            try {
             boolean isSuccess = false;
             // 修改
             if (defineId != null && !Utility.isEmpty(defineId)) {
              //更新某個字段時,先清空對象。
              fmDefine = new FmDefine();
              fmDefine.setDefineId(defineId);
              fmDefine.setState("已發(fā)布");
              isSuccess = fmDefineBO.update(fmDefine);
             }
             if (isSuccess) {
              super.addActionMessage("發(fā)布成功!");
             } else {
              super.addActionMessage("保存失敗!");
             }
          //   super.getRequest().setAttribute("isSuccess", isSuccess);
            } catch (Exception e) {
             e.printStackTrace();
            }
            return query();
           }

          posted @ 2013-08-15 15:11 半導(dǎo)體 閱讀(206) | 評論 (0)編輯 收藏

          文件上傳

                   FileWriter writer;
                   try {
                    String path = System.getProperty("user.dir")+"/../webapps/sxzx/formfiles/"+session.get("objectID")+".txt";
                       writer = new FileWriter(path);
                       writer.write(content);
                       writer.flush();
                       writer.close();
                   } catch (IOException e) {
                       e.printStackTrace();
                   }

          posted @ 2013-08-15 11:30 半導(dǎo)體 閱讀(305) | 評論 (0)編輯 收藏

          數(shù)據(jù)庫最大連接數(shù)原理

          1、JAVA做一個循環(huán),每做一次事務(wù)(CRUD)加一個連接,一個連接相當(dāng)于占2M內(nèi)存。
          50秒后自動釋放。
          如果超過最大連接數(shù)報錯如下:
          ORA-12519: TNS:no appropriate service handler found 解決  

          有時候連得上數(shù)據(jù)庫,有時候又連不上.

          可能是數(shù)據(jù)庫上當(dāng)前的連接數(shù)目已經(jīng)超過了它能夠處理的最大值.


          select count(*) from v$process --當(dāng)前的連接數(shù)
          select value from v$parameter where name = 'processes' --數(shù)據(jù)庫允許的最大連接數(shù)
          修改最大連接數(shù):
          alter system set processes = 300 scope = spfile;
          重啟數(shù)據(jù)庫:
          shutdown immediate;
          startup;
          --查看當(dāng)前有哪些用戶正在使用數(shù)據(jù)
          SELECT osuser, a.username,cpu_time/executions/1000000||'s', sql_fulltext,machine
          from v$session a, v$sqlarea b
          where a.sql_address =b.address order by cpu_time/executions desc;

          連接數(shù)配置在:applicationcontext.xml中
          另一種解決辦法:直接用存儲過程,一個存儲過程只占一個連接。

          查看當(dāng)前最大連接數(shù):
          BasicDataSource dataSource = (BasicDataSource)SpringTools.getBean("dataSource");
          System.out.println(dataSource.getNumActive());

          posted @ 2013-08-14 17:07 半導(dǎo)體 閱讀(301) | 評論 (0)編輯 收藏

          myeclipse環(huán)境配置

          當(dāng)myeclipse慢時,請查看以下原因:
          1、檢查:.project文件,去掉<nature>org.eclipse.wst.jsdt.core.jsNature</nature>。
              或:右鍵項(xiàng)目 -> properties -> Builders 去掉JavaScript Validator 前面的勾

          posted @ 2013-08-14 09:32 半導(dǎo)體 閱讀(184) | 評論 (0)編輯 收藏

          Jquery Eeay UI Validatebox 常用自定義效驗(yàn)

               摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$.extend($.fn.validatebox.defaults.rules, {         ...  閱讀全文

          posted @ 2013-07-26 23:01 半導(dǎo)體 閱讀(281) | 評論 (0)編輯 收藏

          中文排序

          import java.text.Collator;
          import java.util.Arrays;


          public class Test2 {

              
          /**
               * 
          @param args
               
          */

              
          public static void main(String[] args) {
                  
          // TODO Auto-generated method stub
                  String[] names ={"王飛","李明","趙六"};
                  Arrays.sort(names, Collator.getInstance(java.util.Locale.CHINA));
                  System.out.println(Arrays.toString(names));

              }

          }

          posted @ 2013-07-26 22:39 半導(dǎo)體 閱讀(153) | 評論 (0)編輯 收藏

          輸出日志。myeclipse中

          1、在hibernate.cfg.xml中配置如下:
            <property name="hibernate.jdbc.batch_size">0</property>
            <property name="format_sql">false</property>
            <property name="use_sql_comments">false</property>
            
            <property name="show_sql">true</property>

          posted @ 2013-07-03 16:18 半導(dǎo)體 閱讀(228) | 評論 (0)編輯 收藏

          struct2.0語法

          字符串條件判斷:
             <s:if   test="%{#listD.genreId == '402881b73e11d5f5013e11dc118f000a'}">
          數(shù)字型判斷:
             <s:iterator value="list" id="listD" status="ind1">
             <s:if test="#ind1.getIndex()<=6"   >
          對象的取值方法:
                  <s:iterator value="page" id="list" status="ind1">
                <s:iterator value="list" id="listD" status="ind1">
                  <s:if test="#ind1.getIndex()<=5"   >
                   <li> <a href="#"><span
                     class="news">${listD.titleName}</span> </a> <span class="right"><s:date
                      name="issueDate" format="yyyy-MM-dd" /> </span>
                 </s:if>
                </s:iterator>
               </s:iterator>
          在一個頁面重復(fù)取list對象(不要id,,var,status):
                  <s:iterator value="#list">
                <s:if test="%{genreId == '402881b73e11d5f5013e11dd21ea000c'}">
                 <li><a href="../opt/PortalInfoDAction_queryContent.do?detailId=${detailId}"><span class="news">${titleName}</span> </a>
                  <span class="right"><s:date name="issueDate"
                    format="yyyy-MM-dd" /> </span>
                </s:if>
               </s:iterator>
          sql條件的取值方法:
          <s:iterator value="#a19list" var="a19list" status="ind1">
                     <s:if test="#ind1.getIndex()<4">
                     <li>
                      <a
                       href="<c:url value="/web/WebHomeAction_content.do?detailId=${detailId}"/>">${titleName}</a>
                     </li>
                    </s:if>
                   </s:iterator>

          判斷大小: <s:property value="sysRegisterList.size()"/>

          下拉框獲取值:            
          <select id="radioName" name="radioName"    >
              <c:forEach var="sysobject" items="${session.sysobject }" >
                <option name="" value="${sysobject.englishNames}" typeCode="${sysobject.dictName}" >${sysobject.chnName}</option>
             </c:forEach>
             </select> 
          session取值:
          JAVA中:ActionContext.getContext().getSession().put("sum2", (String)sumObject[1]);
          取值:${session.sum2}

          在struts中用#來訪問ActionContext中的對象。

          posted @ 2013-05-14 17:15 半導(dǎo)體 閱讀(191) | 評論 (0)編輯 收藏

          樣式表學(xué)習(xí)

          1、文字太長,加省略號。
          li{
            white-space:nowrap;
            text-overflow:ellipsis;
            -o-text-overflow:ellipsis; /*opera*/
            overflow: hidden;
           }

          posted @ 2013-05-14 16:33 半導(dǎo)體 閱讀(158) | 評論 (0)編輯 收藏

          jerichoTab 加載完默認(rèn)選中最后一個,如何讓他選擇第一個

          第一步:

          改代碼吧。 改文件jquery.jerichotab.js 第205行, 原為

          .animate({ 'opacity': '1', width: opts.tabWidth }, function() {

          $.fn.setTabActive(curIndex);

          });

          直接刪除205行,或注解掉205行

          //$.fn.setTabActive(curIndex);
          第二步:改JSP頁面
               把a(bǔ)ctiveTabIndex:1改為activeTabIndex:0

          posted @ 2013-05-03 15:56 半導(dǎo)體 閱讀(752) | 評論 (1)編輯 收藏

          僅列出標(biāo)題
          共27頁: First 上一頁 5 6 7 8 9 10 11 12 13 下一頁 Last 
          主站蜘蛛池模板: 屯留县| 庆云县| 旅游| 通化市| 平湖市| 泌阳县| 和田市| 嵊泗县| 青阳县| 乐陵市| 文山县| 左贡县| 乌恰县| 临高县| 体育| 玛沁县| 祥云县| 重庆市| 平原县| 如东县| 中西区| 当阳市| 河津市| 冷水江市| 寿光市| 康平县| 九龙县| 阜新市| 石狮市| 定州市| 固镇县| 临沧市| 久治县| 丰台区| 珲春市| 大石桥市| 舞阳县| 兴业县| 孝感市| 彭泽县| 兴化市|