Be happy with Java

          #

          畢設用Buffalo實時保存部分的代碼寫了71行,第一次:)

          服務器端SimpleService.java
          ?1package?net.buffalo.sei.simple;
          ?2import?java.io.IOException;
          ?3import?java.util.*;
          ?4import?java.io.*;
          ?5
          ?6public?class?SimpleService{
          ?7????public?static?void?main(String[]?args)?throws?IOException{
          ?8/*????????2.Input?from?memory
          ?9????????StringReader?in2=new?StringReader(sHandle.value);
          10????????int?c;
          11????????while((c=in2.read())!=-1)
          12????????????System.out.print((char)c);
          13????????
          14*/

          15????????
          16//????????4.File?output
          17????????try{
          18????????????BufferedReader?in4=new?BufferedReader(
          19????????????????????new?StringReader(sHandle.value));
          20????????????PrintWriter?out1=new?PrintWriter(
          21????????????????????new?BufferedWriter(new?FileWriter("Interval.xml")));
          22????????????int?lineCount=1;
          23????????????while((s=in4.readLine())!=null)
          24????????????????out1.println(lineCount++?+?":"+s);
          25????????????out1.close();
          26????????}
          catch(EOFException?e){
          27????????????System.err.println("End?of?stream");
          28????????}

          29????}

          30}
          瀏覽器端部分相關代碼:)
          ?1<script?language="JavaScript"?src="script/prototype.js"></script>
          ?2<script?language="JavaScript"?src="script/buffalo.js"></script>
          ?3<script?language="JavaScript"?src="script/template.js"></script>
          ?4<SCRIPT?language=javascript>
          ?5<!--
          ?6var?endPoint="<%=request.getContextPath()%>/BUFFALO";
          ?7var?buffalo?=?new?Buffalo(endPoint);
          ?8function?cmdSave()?{
          ?9var?sHandle?=?Buffalo.getElementById("description1");
          10buffalo.remoteCall("simpleService.save",[buffalo:],?function(reply)?{
          11??sHandle.value?=?reply.getResult();
          12?}
          )
          13}

          14//-->
          15
          </SCRIPT>
          16
          17<script?language=javascript>
          18<!--
          19setInterval("cmdSave()",60000);
          20-->
          21
          </script>
          buffalo-service.properties
          1#?simpleService,?The?simple?Service
          2simpleService=net.buffalo.sei.simple.SimpleService
          web.xml
          ?1<?xml?version="1.0"?encoding="UTF-8"?>
          ?2<!DOCTYPE?web-app?PUBLIC?"-Sun?Microsystems,?Inc.DTD?Web?Application?2.3//EN"?"http://java.sun.com/dtd/web-app_2_3.dtd">
          ?3<web-app>
          ?4<display-name>Buffalo?Demo-divide?Application</display-name>
          ?5<servlet>
          ?6??<servlet-name>service</servlet-name>
          ?7??<servlet-class>net.buffalo.server.BuffaloServiceServlet</servlet-class>
          ?8??<init-param>
          ?9???<param-name>debug</param-name>
          10???<param-value>true</param-value>
          11??</init-param>
          12</servlet>
          13
          14<servlet-mapping>
          15??<servlet-name>service</servlet-name>
          16??<url-pattern>/BUFFALO</url-pattern>
          17</servlet-mapping>
          18</web-app>
          又是71行:)

          posted @ 2006-05-31 23:06 SYBIL@BLOGJAVA 閱讀(140) | 評論 (0)編輯 收藏

          5.19links

          如何用正確的方法寫出高質量軟件的75條體會(粗粗的看了30條,就當是長見識和開闊思路用)

          http://www.blueidea.com/tech/program/2006/3479.asp

          posted @ 2006-05-19 13:33 SYBIL@BLOGJAVA 閱讀(139) | 評論 (0)編輯 收藏

          畢設代碼改進版,寫了71行:)

          Item.java:)
          ?1package?xml;
          ?2public?class?Item?implements?java.io.Serializable{
          ?3????private?String?input=null,output=null;
          ?4????public?Item(String?input,String?output)?
          ?5????{?
          ?6????????this.input=input;?
          ?7????????this.output=output;?
          ?8????}
          ?
          ?9????public?String?getinput()?
          10????{?
          11????????return?input;?
          12????}
          ?
          13????public?String?getoutput()?
          14????{?
          15????????return?output;?
          16????}
          ?
          17}
          ItemOption.java:)
          ?1package?xml;?
          ?2import?java.util.Iterator;?
          ?3import?java.util.Vector;?
          ?4public?class?ItemOption?implements?java.io.Serializable?{?
          ?5????private?Vector?items=new?Vector();?
          ?6????public?ItemOption()?
          ?7????{?
          ?8????}
          ?
          ?9????public?Iterator?getItems()?
          10????{?
          11????????return?items.iterator();?
          12????}
          ?
          13????//增加vector中的對象?
          14????public?void?addItem(String?input,String?output)?
          15????{?
          16????????Object?elements=new?Item(input,output);?
          17????????items.addElement(elements);?
          18????}
          ?
          19????//移除vector中的對象?
          20????public?void?delItem()?
          21????{?
          22????????items.removeAllElements();?
          23????}
          ?
          24}
          ?
          25
          tcxml.jsp:)
          ?1<%@?page?contentType="text/html;charset=gb2312"%>
          ?2<%@?page?import="xml.*"%>
          ?3<jsp:useBean?id="ItemOption"?scope="session"?class=xml.ItemOption"/>
          ?4
          ?5????<%int?tcnum=Integer.parseInt(request.getParameter("tcNum"));%>
          ?6????<count><%out.println("tcnum");%></count>
          ?7
          ?8????<%?for(int?i=1;i<=tcnum;i++){
          ?9????????String?textarea0=request.getParameter("textarea"+"i");
          10????????String?textarea1=request.getParameter("textarea"+"i+1");
          11????
          12????????ItemOption.addItem("textarea0","textarea1");?
          13????}
          ?%>
          14????
          15????<%?
          16????java.util.Iterator?Itvar=ItemOption.getItems()?;?
          17????Item?item=null;?
          18????%>
          19????
          20????<%!int?i=1;?%>
          21????<%????while(Itvar.hasNext())?
          22????{?
          23????????item=(Item)Itvar.next();?
          24????%>?
          25????<tc<%out.println(i);?%>weight=<%Integer.parseInt(request.getParameter("weight13"));%>>
          26????<input><%=item.getinput()%></input>?
          27????<output>?<%=item.getoutput()%>?</output>?
          28????<%i+=1;%>
          29????</tc<%out.println(i);?%>weight=<%Interger.parseInt(request.getParameter("weight13"));%>>
          30????<%}
          %>

          我是在動態生成xml文件呢,呵呵,程序應該有好多錯,有沒人幫我挑挑呢?
          XML文件格式是這樣的:
          ?1<count>5</count>
          ?2<tc1?weight="0.2">????????
          ?3????<input>輸入</input>
          ?4????<output>期望輸出</output>
          ?5</tc1>?
          ?6<tc2?weight="0.2">
          ?7????<input>輸入</input>????
          ?8????<output>期望輸出</output>
          ?9</tc2>
          10<tc3?weight="0.2">
          11????<input>輸入</input>????
          12????<output>期望輸出</output>
          13</tc3>?
          14<tc4?weight="0.2">
          15????<input>輸入</input>????
          16????<output>期望輸出</output>
          17</tc4>?
          18<tc5?weight="0.2">
          19????<input>輸入</input>????
          20????<output>期望輸出</output>
          21</tc5>??

          posted @ 2006-05-15 22:33 SYBIL@BLOGJAVA 閱讀(165) | 評論 (0)編輯 收藏

          畢設代碼寫了二十一行:)

          呵呵,有米人知道我寫的是啥?

          <% @?page?contentType = " text/xml;charset= " gb2312 " ?language= " java " %>
          <%@?page?import=
          " java . io .* " %>
          <html>
          <head>
          ????<title>JDOM?parse?XML</title>
          </head>
          <body>
          ????<br>file2file.jsp動態生成XML文件</br>
          ????<%int?tcnum=Integer.parseInt(request.getParameter(
          " tcNum " ));%>
          ????<count><%out.println(
          " tcnum " );%></count>
          ????
          ????????<%?for(int?i=1;i<=tcnum;i++){%>???
          ????????????<tc<%out.println(i);%>?weight=<%Integer.parseInt(request.getParameter(
          " weight13 " ));%>>
          ????????????????<%String?textarea0=request.getPafameter(
          " textarea " + " i " );%>
          ????????????????<input><%out.println(
          " textarea0 " );%></input>
          ????????????????<%String?textarea1=request.getPafameter(
          " textarea " + " i + 1 " );%>
          ????????????????<output><%out.println(textarea1);%></output>
          ????????????</tc<%out.println(i);%>>
          ????
          </body>
          </html>

          posted @ 2006-05-14 22:33 SYBIL@BLOGJAVA 閱讀(284) | 評論 (0)編輯 收藏

          [5.1]links

          百度首席架構師:算法是百度工程師的利器
          http://community.csdn.net/Expert/topic/4680/4680082.xml?temp=.6066553


          文件之間的鏈接

          http://www.shanxiwindow.net/teaching/htmlbook/link01.htm

          posted @ 2006-05-01 18:25 SYBIL@BLOGJAVA 閱讀(97) | 評論 (0)編輯 收藏

          4.29 links

          表單提交中get和post方式的區別

          http://www.weste.net/2006/1-11/14235072108.html

          建一個XMLHttpRequest對象池
          http://www.ugia.cn/?p=85

          posted @ 2006-04-29 18:02 SYBIL@BLOGJAVA 閱讀(176) | 評論 (0)編輯 收藏

          4.28 links

          PEAR簡介:用PEAR來寫你的下一個php程序

          http://www-128.ibm.com/developerworks/cn/linux/sdk/php/pear1/index.html

          才發現是01年的文章,不知道是不是過時了?不過今天面試時問道了require_once和include_once的問題,我發現我怎么總是現學現賣呢,怎么就沒有以前的積累呢?

          posted @ 2006-04-28 23:11 SYBIL@BLOGJAVA 閱讀(126) | 評論 (0)編輯 收藏

          推薦《ajax新手快車道》第二章四節內容

          不知道適不適合高手,反正在我這樣的web開發新手看來,有種醍醐灌頂的感覺

          posted @ 2006-04-25 23:16 SYBIL@BLOGJAVA 閱讀(157) | 評論 (0)編輯 收藏

          4.24Blog Links

          javascript的prototype

          中國程序員的26種能力之六--不被別人替代的能力

          中國程序員的26種能力之二 取信于人的能力

          posted @ 2006-04-24 13:07 SYBIL@BLOGJAVA 閱讀(129) | 評論 (0)編輯 收藏

          4.22Blog Links

          用HTML和CSS寫出漂亮正規的BLOG
          http://www.duduwolf.com/post/129.asp


          Tag之死——來自spam的威脅?
          http://www.duduwolf.com/post/133.asp

          posted @ 2006-04-22 20:04 SYBIL@BLOGJAVA 閱讀(114) | 評論 (0)編輯 收藏

          僅列出標題
          共5頁: 上一頁 1 2 3 4 5 下一頁 
          主站蜘蛛池模板: 铜山县| 高清| 安岳县| 鲜城| 囊谦县| 龙口市| 沁水县| 陵川县| 雷波县| 玛曲县| 武定县| 保定市| 兰考县| 修武县| 余江县| 修文县| 威信县| 同德县| 屏东市| 彰化县| 桓仁| 宁明县| 张家界市| 革吉县| 古田县| 镇江市| 陈巴尔虎旗| 自治县| 临湘市| 伊金霍洛旗| 高阳县| 周口市| 安多县| 广南县| 云梦县| 新津县| 林西县| 平山县| 金湖县| 贵南县| 高邑县|