国产精品日韩久久久久,亚洲一区二区三区精品中文字幕,中文字幕剧情在线观看一区http://www.aygfsteel.com/LittleRain/category/15012.html小雨不打傘 打傘雨不小zh-cnTue, 12 Jun 2007 07:44:34 GMTTue, 12 Jun 2007 07:44:34 GMT60java訪問windows活動目錄http://www.aygfsteel.com/LittleRain/archive/2007/04/21/112381.html小雨不打傘小雨不打傘Fri, 20 Apr 2007 22:56:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/04/21/112381.htmlhttp://www.aygfsteel.com/LittleRain/comments/112381.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/04/21/112381.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/112381.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/112381.html

小雨不打傘 2007-04-21 06:56 發(fā)表評論
]]>
JSP2.0 tag使用http://www.aygfsteel.com/LittleRain/archive/2007/04/18/111693.html小雨不打傘小雨不打傘Wed, 18 Apr 2007 09:43:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/04/18/111693.htmlhttp://www.aygfsteel.com/LittleRain/comments/111693.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/04/18/111693.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/111693.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/111693.html1.使用Servlet2.4/jsp2.0

1. 確定Web Container支持Serverlet2.4, 復(fù)制支持jstl 1.1版本的jstl.jar,standard.jar(可查閱meta-inf)到web-inf/lib。

2. 在Web.xml,Root節(jié)點改為

<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd ">

3.在jsp中,對core,ftm taglib的引入改為  

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"% >
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"% >

2.直接在html里面使用EL,而不是<c:out value="">

  充分使用JSP2.0的EL,直接在html中寫${book} 而不是<c:out value="${book}">將獲得簡潔無比,可比美velocity,freemarker的界面。

3.新增的Function標(biāo)簽

    Function標(biāo)簽里最有用的一項是取得List,Map的size了。另外有一些StringUtils和Collection的函數(shù)。

    JSTL里面不給調(diào)用對象除getXXX()外的任何方法真是件很讓讓人郁悶的事情!!

<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
${fn:length(myList)}

4.其他的EL知識點

4.1 EL的運算符

      除了最基本的算術(shù)運算符,邏輯運算符,比較運算符外,還有一個empty運算符,用來判斷變量是否為null 或list, map的size 是否為零。

<c:if test="${not empty myList}">

EL的運算符都有文字和符號兩種版本,如|| 和 or, >= 和 ge,適用于不能使用文字或符號的時候。

4.2 []與. 兩種訪問屬性或元素的方式

       ${book.name}與${book["name"]}等價。

       ${book["name"]}主要用于"name"串為變量,或者字符串中含有"."字符的情況

       如 ${myMap[order.status]} 是訪問Map元素的一種很重要的方式。

4.3 list與map

    orderList[0]  返回第一個元素

     用key和value遍歷map

<c:forEach var="entry" items="${myMap}">
   <option value="${entry.key}">${entry.value}</option> </c:forEach>

4.4.訪問靜態(tài)變量

      EL本身不支持靜態(tài)變量訪問,變通的方法是寫一個tag,將某個類的靜態(tài)變量反射到一個map中, 如http://www.javaranch.com/journal/200601/Journal200601.jsp#a3

     不過使用Map將失去靜態(tài)變量編譯期安全的意義,因此還是建議在這種情況下,使用普通JSP,見showOrder.jsp



小雨不打傘 2007-04-18 17:43 發(fā)表評論
]]>
使用POI讀寫EXCELhttp://www.aygfsteel.com/LittleRain/archive/2007/04/02/107876.html小雨不打傘小雨不打傘Mon, 02 Apr 2007 02:05:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/04/02/107876.htmlhttp://www.aygfsteel.com/LittleRain/comments/107876.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/04/02/107876.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/107876.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/107876.html2:http://www.aygfsteel.com/czcode/archive/2006/12/18/88448.html
3:http://hbcui1984.javaeye.com/blog/post/230199


小雨不打傘 2007-04-02 10:05 發(fā)表評論
]]>
Session詳解http://www.aygfsteel.com/LittleRain/archive/2007/03/20/105064.html小雨不打傘小雨不打傘Tue, 20 Mar 2007 10:27:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/03/20/105064.htmlhttp://www.aygfsteel.com/LittleRain/comments/105064.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/03/20/105064.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/105064.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/105064.htmlhttp://cs.cuc.edu.cn/linweiguo/archives/000023.html#2
這里是原文地址

小雨不打傘 2007-03-20 18:27 發(fā)表評論
]]>
js效果拾集http://www.aygfsteel.com/LittleRain/archive/2007/02/06/98420.html小雨不打傘小雨不打傘Tue, 06 Feb 2007 12:11:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/02/06/98420.htmlhttp://www.aygfsteel.com/LittleRain/comments/98420.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/02/06/98420.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/98420.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/98420.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>test.html</title>
   
   <SCRIPT src="1.js"></SCRIPT>
    <SCRIPT language="javaScript">
 function go()
 {
  document.getElementById("button").style.background="url(2.jpg)";
  //document.getElementById("button").style.
 }
    </SCRIPT>
  </head>
 
  <body>
    <input onclick="go()" id="button" type="button" style="width:350;height:300;background:url(1.jpg);">
    <input type="button" value="test" onclick="go()"/>
  </body>
</html>

2.注意用js提交表單的時候,提供表單提交功能的button的名字不能定義成submit,不然會導(dǎo)致formName無法提交!

小雨不打傘 2007-02-06 20:11 發(fā)表評論
]]>
錯誤拾集http://www.aygfsteel.com/LittleRain/archive/2007/02/01/97187.html小雨不打傘小雨不打傘Thu, 01 Feb 2007 04:45:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/02/01/97187.htmlhttp://www.aygfsteel.com/LittleRain/comments/97187.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/02/01/97187.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/97187.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/97187.html** Caught an Ognl exception while getting property stores **
ognl.OgnlException: stores [java.lang.RuntimeException: Testing my RuntimeException]

導(dǎo)致的原因還不明
解決的方法:去掉action的set get方法中的log信息
xcd說還一定要有g(shù)et方法,還沒驗證

**Tomcat,java.io.UTFDataFormatException:Invalid byte 2 of 2-byte UTF-8 sequence問題的解決 **
去除在tomat的server.xml中添加的中文注釋即可



小雨不打傘 2007-02-01 12:45 發(fā)表評論
]]>
Msn加密軟件相關(guān)資料http://www.aygfsteel.com/LittleRain/archive/2007/01/23/95636.html小雨不打傘小雨不打傘Tue, 23 Jan 2007 15:53:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2007/01/23/95636.htmlhttp://www.aygfsteel.com/LittleRain/comments/95636.htmlhttp://www.aygfsteel.com/LittleRain/archive/2007/01/23/95636.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/95636.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/95636.html

http://www.xihsolutions.net/dotmsn/download.html

http://www.hypothetic.org/docs/msn/forum.php

http://zhouwran.spaces.live.com/blog/cns!F815C2377431BB22!201.entry


msn login process:http://searchsecurity.techtarget.com.cn/tips/37/2367037.shtml

msn protocol:http://msnpiki.msnfanatic.com/index.php/Main_Page

use dotnet to develop msn Robort:http://www.im286.com/archiver/tid-1267660.html

小雨不打傘 2007-01-23 23:53 發(fā)表評論
]]>
輕松為自己的網(wǎng)站添加Rss功能http://www.aygfsteel.com/LittleRain/archive/2006/11/15/81247.html小雨不打傘小雨不打傘Wed, 15 Nov 2006 06:05:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/15/81247.htmlhttp://www.aygfsteel.com/LittleRain/comments/81247.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/15/81247.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/81247.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/81247.html用ROME來作:https://rome.dev.java.net/

?

自己的第一個項目IQBoree
里面要求有提供給客戶Rss訂閱的功能,找了下網(wǎng)上介紹,最后還是在rome的管網(wǎng)找到了解決方案

解決方案有兩種:
1,寫一個servlet,生成feed,直接由客戶來訂閱
2,寫一個java.自動生成feed的xml文件,然后讓客戶通過讀取這個xml文件來達(dá)到訂閱Rss的目的

首先我就來講解下第一種方法:
1.
FeedServlet.java

package com.iqboree.rss.servlet;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.iqboree.po.Article;
import com.iqboree.service.impl.ArticleManagerImpl;
import com.sun.syndication.feed.synd.SyndContent;
import com.sun.syndication.feed.synd.SyndContentImpl;
import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndEntryImpl;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.feed.synd.SyndFeedImpl;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedOutput;

/**

* @author Michael
*
*/
public class FeedServlet extends HttpServlet {
?
?private static final Log log = LogFactory.getLog(FeedServlet.class);?
??? private static final String DEFAULT_FEED_TYPE = "default.feed.type";
??? private static final String FEED_TYPE = "type";
??? private static final String MIME_TYPE = "application/xml; charset=UTF-8";
??? private static final String COULD_NOT_GENERATE_FEED_ERROR = "Could not generate feed";

??? private static final DateFormat DATE_PARSER = new SimpleDateFormat("yyyy-MM-dd");



??? private String _defaultFeedType;
???
??? List list;

??? public void init() {
??????? _defaultFeedType = getServletConfig().getInitParameter(DEFAULT_FEED_TYPE);
??????? _defaultFeedType = (_defaultFeedType!=null) ? _defaultFeedType : "atom_0.3";
?????? log.info("初始化完成");//用來調(diào)試,可以看出在tomcat里的輸出信息,自己可以去掉,后面的log.info()?也是同樣的效果.
???????DATE_PARSER.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));//這里用來設(shè)置時區(qū)
???
??? }

??? public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException {
??????? try {
??????? ?log.info("doget方法完成");
??????????? SyndFeed feed = getFeed(req);

??????????? String feedType = req.getParameter(FEED_TYPE);
??????????? feedType = (feedType!=null) ? feedType : _defaultFeedType;
??????????? feed.setFeedType(feedType);

??????????? res.setContentType(MIME_TYPE);
??????????? SyndFeedOutput output = new SyndFeedOutput();
??????????? output.output(feed,res.getWriter());
??????? }
??????? catch (FeedException ex) {
??????????? String msg = COULD_NOT_GENERATE_FEED_ERROR;
??????????? log(msg,ex);
??????????? res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR,msg);
??????? }
??? }

??? protected SyndFeed getFeed(HttpServletRequest req) throws IOException,FeedException {
??? ?log.info("Synd方法開始");
??? ?
??????? SyndFeed feed = new SyndFeedImpl();

??????? feed.setTitle("Sample Feed (created with ROME)");//channle name ;display as the title
??????? feed.setLink("http://rome.dev.java.net");
??????? feed.setDescription("This feed has been created using ROME (Java syndication utilities");
???????
??????? List entries = new ArrayList();
??????? SyndEntry entry;
??????? SyndContent description;
???????
??????? List list = new ArrayList();

??????//項目是基于spring+webwork+hibernate的,但是在這里不知道讓為這個servlet自動獲得對應(yīng)的DAO,所以只能用jdbc手動獲取
??????? String sql = "";
??????? try {
??????? ?log.info("開始進(jìn)行jdbc操作");
???Class.forName("com.mysql.jdbc.Driver");
???String url="jdbc:mysql://localhost:3306/iqboree";
???Connection conn = DriverManager.getConnection(url,"root","ahuango");
???if(conn == null)
???{
????log.info("conn NULL");
???}
???Statement stmt = conn.createStatement();
???if(stmt==null)
???{
????log.info("NULLNULLNULL");
???}
???log.info("開始進(jìn)行sql操作");
???sql = "Select id,AddedDate,AddedBy,Title,Abstract,Body,CommentsEnabled,ViewCount," +
?????"ReleaseDate,ExpireDate,Approved,Listed,OnlyForMembers,Category_ID from iq_article";
???ResultSet rs = stmt.executeQuery(sql);
???log.info("begin iterator resultSet");
???while(rs.next())
???{
????log.info("test 1");
????Article art = new Article();
????art.setId(Long.valueOf(rs.getString(1)));
????log.info("test 2");
????art.setAddedDate(rs.getDate(2));
????log.info("test 3");
????art.setAddedBy(rs.getString(3));
????log.info("test 4");
????art.setTitle(rs.getString(4));
????log.info("test 5");
????art.setAbstracts(rs.getString(5));
????log.info("test 6");
????art.setBody(rs.getString(6));
????log.info("test 7");
????art.setCommentsEnabled(Boolean.valueOf(rs.getBoolean(7)));
????log.info("test 8");
????art.setViewCount(Integer.valueOf(rs.getString(8)));
????log.info("test 9");
????art.setReleaseDate(rs.getDate(9));
????log.info("test 10");
????art.setExpireDate(rs.getDate(10));
????log.info("test 11");
????art.setApproved(Boolean.valueOf(rs.getBoolean(11)));
????log.info("test 12");
????art.setListed(Boolean.valueOf(rs.getBoolean(12)));
????log.info("test 13");
????art.setOnlyForMembers(Boolean.valueOf(rs.getBoolean(13)));
????log.info("test 14");
//????art.getCategory().setId(Long.valueOf(rs.getString(14)));
????log.info("test 15");
????
????list.add(art);
???}??
???stmt.close();
???conn.close();
???
??} catch (ClassNotFoundException e) {
???// TODO Auto-generated catch block
???e.printStackTrace();
??}catch(Exception e)
??{
???log.error("sql:"+sql+"?????? "+e.toString());
??}

//數(shù)據(jù)庫信息獲取完畢,里面的信息大家根據(jù)實際需要自己更改.

??????? log.info("開始獲取db");
??????? //List articles=new ArticleManagerImpl().getCurrentNArticles(2);
??????? log.info("開始迭代");
??????
???????
??????? Iterator its = list.iterator();
??????? log.info("開始添加feed條目");
??????? while(its.hasNext())
??????? {
??????? ?Article art=(Article)its.next();
??????? ?log.info("在while內(nèi)部");
??????? entry = new SyndEntryImpl();
??????? entry.setTitle("\""+art.getTitle()+"\"");
??????? entry.setLink("Link is:"+art.getId()+"\"");
??????? try {
??????????? entry.setPublishedDate(DATE_PARSER.parse("2004-06-08"));
??????? }
??????? catch (ParseException ex) {
??????????? // IT CANNOT HAPPEN WITH THIS SAMPLE
??????? }
??????? description = new SyndContentImpl();
??????? description.setType("text/plain");
??????? description.setValue("The value is here:"+art.getTitle()); //set the content of this feed
??????? entry.setDescription(description);
??????? entries.add(entry);
??????? }

?

??????? feed.setEntries(entries);

??????? return feed;
??? }

}

然后在web.xml中配置這個Rss的訂閱地址
The web.xml:
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
??? <display-name>ROME Samples</display-name>

??? <servlet>
??????? <servlet-name>FeedServlet</servlet-name>
??????? <servlet-class>com.sun.syndication.samples.servlet.FeedServlet</servlet-class>
??????? <init-param>
??????????? <param-name>default.feed.type</param-name>
??????????? <param-value>rss_2.0</param-value>
??????? </init-param>
??? </servlet>

??? <servlet-mapping>
???????? <servlet-name>FeedServlet</servlet-name>
???????? <url-pattern>/feed</url-pattern>
ervlet-mapping>

</web-app>


我的項目名稱為IQBoree,所以這個feed相應(yīng)的訂閱地址為:http://localhost:8080/IQBoree/feed


2,自己生成一個xml文件,然后讓客戶來讀取這個xml文件


生成xml文件:
if (true) {
??????????? try {
??????????????? String feedType = "rss_1.0";
??????????????? String fileName = "rssTest2.xml";

??????????????? DateFormat dateParser = new SimpleDateFormat(DATE_FORMAT);

??????????????? SyndFeed feed = new SyndFeedImpl();
??????????????? feed.setFeedType(feedType);

??????????????? feed.setTitle("Sample Feed (created with Rome)");
??????????????? feed.setLink("??????????????? feed.setDescription("This feed has been created using Rome (Java syndication utilities");

??????????????? List entries = new ArrayList();
??????????????? SyndEntry entry;
??????????????? SyndContent description;

??????????????? entry = new SyndEntryImpl();
??????????????? entry.setTitle("Rome v1.0");
??????????????? entry.setLink("
??????????????? entry.setPublishedDate(dateParser.parse("2006-11-16"));
??????????????? description = new SyndContentImpl();
??????????????? description.setType("text/plain");
??????????????? description.setValue("Initial release of Rome");
??????????????? entry.setDescription(description);
??????????????? entries.add(entry);

//以上九行可以用來添加一條feed,可以更具自己的需要多添加幾個,或者和第一種生成servlet的方法一樣來從數(shù)據(jù)庫讀取

??????????????? feed.setEntries(entries);

??????????????? Writer writer = new FileWriter(fileName);
??????????????? SyndFeedOutput output = new SyndFeedOutput();
??????????????? output.output(feed,writer);
??????????????? writer.close();

??????????????? System.out.println("The feed has been written to the file ["+fileName+"]");

??????????????? ok = true;
??????????? }
??????????? catch (Exception ex) {
??????????????? ex.printStackTrace();
??????????????? System.out.println("ERROR: "+ex.getMessage());
??????????? }
??????? }



使用rom讀取rssUrl

把jdom和rom包拷貝到lib目錄下。

直接在jsp頁面上嵌入如下代碼:
<%@ page language="java"
import="java.util.*;
import java.net.URL;
import java.io.InputStreamReader;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;
" pageEncoding="UTF-8"%>

<%
? try {
??????????????? URL feedUrl = new URL("
http://www.aygfsteel.com/crazycy/CommentsRSS.aspx");
//上面是那個需要讀取的xml文件的存放地址,我這里找的是偶大哥的blog地址.

??????????????? SyndFeedInput input = new SyndFeedInput();
??????????????? SyndFeed feed = input.build(new XmlReader(feedUrl));

//??????????????? System.out.println(feed);

out.println(feed);

//??????????????? ok = true;
??????????? }
??????????? catch (Exception ex) {
??????????????? ex.printStackTrace();
??????????????? System.out.println("ERROR: "+ex.getMessage());
??????????? }
?
? %>

=============================================================================================
使用javaBean:
<%@page contentType="text/html"%>

<%@page pageEncoding="UTF-8"%>
<%@ page import="com.sun.syndication.feed.synd.SyndFeed" %>
<%@ page import="com.sun.syndication.io.SyndFeedInput"%>
<%@ page import="com.sun.syndication.io.XmlReader"%>

<%@page import="java.net.*"%>
<%@page import="java.util.Properties"%>
<%@ page import="com.sun.syndication.feed.atom.Feed" %>
<%@ page import="java.util.List" %>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Sina News</title>

</head>

<body>

<%

??????? System.out.println("Start...");
??????? String str ="http://www.aygfsteel.com/LittleRain/category/15573.html/rss";
??????? Properties prop = System.getProperties();
?????? // prop.put("http.proxyHost","10.10.10.11");??? //這里填寫代理的ip
??????? //prop.put("http.proxyPort","8080");

??????? boolean ok = false;
??????? try {????????

??????????? URL feedUrl = new URL(str);

??????????? SyndFeedInput input = new SyndFeedInput();

??????????? SyndFeed feed = input.build(new XmlReader(feedUrl));
?????????? ??? out.println("Author:"+feed.getAuthor()+"<br>");
??? ??? ??? out.println("Title:"+feed.getTitle()+"<br>");
??? ??? ??? out.println("Description:"+feed.getDescription()+"<br>");
??? ??? ???
??? ??? ??? java.util.List list=feed.getEntries();
??? ??? ??? for (int i=0; i< list.size(); i++) {

??? ??? ??? com.sun.syndication.feed.synd.SyndEntry entry = (com.sun.syndication.feed.synd.SyndEntry)list.get(i);
??? ??? ??? //out.println(feed.get);
??? ??? ???
??? ??? ??? out.println(i+1+":");
??? ??? ??? out.println("<a href="+entry.getLink()+">"+entry.getTitle()+"</a>");
??? ??? ??? out.println(entry.getPublishedDate()+"<br>");
?????????? ??? }


??????????? ok = true;
??????? }
??????? catch (Exception ex) {
??????????? ex.printStackTrace();
??????????? System.out.println("ERROR: "+ex.getMessage());
??????? }


??????? if (!ok) {
??????????? System.out.println();
?????????? out.println("FeedReader reads and prints any RSS/Atom feed type.");
??????????? out.println("The first parameter must be the URL of the feed to read.");
??????????? System.out.println();
??????? }
??????
??? %>

</body>

</html>



小雨不打傘 2006-11-15 14:05 發(fā)表評論
]]>
Tomcat調(diào)試心得http://www.aygfsteel.com/LittleRain/archive/2006/11/13/80987.html小雨不打傘小雨不打傘Mon, 13 Nov 2006 14:07:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/13/80987.htmlhttp://www.aygfsteel.com/LittleRain/comments/80987.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/13/80987.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80987.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80987.html1。遇到莫名錯誤,學(xué)會查看%CATALINA_HOME%\logs下的logs日志。

2。使用log來輸出:
在需要調(diào)試的類中添加:private static final Log log = LogFactory.getLog(FeedServlet.class);



小雨不打傘 2006-11-13 22:07 發(fā)表評論
]]>
JSP下FCKeditor的配置http://www.aygfsteel.com/LittleRain/archive/2006/11/12/80763.html小雨不打傘小雨不打傘Sun, 12 Nov 2006 14:46:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80763.htmlhttp://www.aygfsteel.com/LittleRain/comments/80763.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80763.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80763.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80763.html
a)找到web.xml文件的
<servlet-name>SimpleUploader</servlet-name>
<init-param>
???<param-name>enabled</param-name>
???<param-value>false</param-value>//把這里設(shè)置為true
??</init-param>

b)
〈FCK:editor id="infoContent" basePath="/FCK/FCKeditor/"
??????????????width="522"
??????????????height="300"
??????????????skinPath="/FCK/FCKeditor/editor/skins/silver/"
??????????????defaultLanguage="zh-cn"
??????????????tabSpaces="8"(需要在fckconfig.js終設(shè)置FCKConfig.TabSpaces??= 1 ;開啟Tab鍵功能)
??????????????imageBrowserURL="/FCK/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
??????????????linkBrowserURL="/FCK/FCKeditor/editor/filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
??????????????flashBrowserURL="/FCK/FCKeditor/editor/filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
??????????????imageUploadURL="/FCK/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Image"
??????????????linkUploadURL="/FCK/FCKeditor/editor/filemanager/upload/simpleuploader?Type=File"
????????????? flashUploadURL="/FCK/FCKeditor/editor/filemanager/upload/simpleuploader?Type=Flash"〉
????????????? 請輸入內(nèi)容
??〈/FCK:editor〉


小雨不打傘 2006-11-12 22:46 發(fā)表評論
]]>
JSP頁面顯示亂碼 / 表單提交中文時出現(xiàn)亂碼 / 數(shù)據(jù)庫連(轉(zhuǎn)載)http://www.aygfsteel.com/LittleRain/archive/2006/11/12/80740.html小雨不打傘小雨不打傘Sun, 12 Nov 2006 12:08:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80740.htmlhttp://www.aygfsteel.com/LittleRain/comments/80740.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80740.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80740.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80740.html
一、JSP頁面顯示亂碼
下面的顯示頁面(display.jsp)就出現(xiàn)亂碼:
<html>
<head>
<title>JSP的中文處理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<%
out.print("JSP的中文處理");
%>
</body>
</html>
對不同的WEB服務(wù)器和不同的JDK版本,處理結(jié)果就不一樣。原因:服務(wù)器使用的編碼方式不同和瀏覽器對不同的字符顯示結(jié)果不同而導(dǎo)致的。解決辦法:在JSP頁面中指定編碼方式(gb2312),即在頁面的第一行加上:<%@ page contentType="text/html; charset=gb2312"%>,就可以消除亂碼了。完整頁面如下:
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>JSP的中文處理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<%
out.print("JSP的中文處理");
%>
</body>
</html>

二、表單提交中文時出現(xiàn)亂碼
下面是一個提交頁面(submit.jsp),代碼如下:
<html>
<head>
<title>JSP的中文處理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<form name="form1" method="post" action="process.jsp">
<div align="center">
<input type="text" name="name">
<input type="submit" name="Submit" value="Submit">
</div>
</form>
</body>
</html>
下面是處理頁面(process.jsp)代碼:
<%@ page contentType="text/html; charset=gb2312"%>
<html>
<head>
<title>JSP的中文處理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<%=request.getParameter("name")%>
</body>
</html>
如果submit.jsp提交英文字符能正確顯示,如果提交中文時就會出現(xiàn)亂碼。原因:瀏覽器默認(rèn)使用UTF-8編碼方式來發(fā)送請求,而UTF-8和GB2312編碼方式表示字符時不一樣,這樣就出現(xiàn)了不能識別字符。解決辦法:通過request.seCharacterEncoding("gb2312")對請求進(jìn)行統(tǒng)一編碼,就實現(xiàn)了中文的正常顯示。修改后的process.jsp代碼如下:
<%@ page contentType="text/html; charset=gb2312"%>
<%
request.seCharacterEncoding("gb2312");
%>
<html>
<head>
<title>JSP的中文處理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
<%=request.getParameter("name")%>
</body>
</html>

三、數(shù)據(jù)庫連接出現(xiàn)亂碼
只要涉及中文的地方全部是亂碼,解決辦法:在數(shù)據(jù)庫的數(shù)據(jù)庫URL中加上useUnicode=true&characterEncoding=GBK就OK了。

四、數(shù)據(jù)庫的顯示亂碼
在mysql4.1.0中,varchar類型,text類型就會出現(xiàn)中文亂碼,對于varchar類型把它設(shè)為binary屬性就可以解決中文問題,對于text類型就要用一個編碼轉(zhuǎn)換類來處理,實現(xiàn)如下:
public class Convert {
/** 把ISO-8859-1碼轉(zhuǎn)換成GB2312
*/
public static String ISOtoGB(String iso){
String gb;
try{
if(iso.equals("") || iso == null){
return "";
}
else{
iso = iso.trim();
gb = new String(iso.getBytes("ISO-8859-1"),"GB2312");
return gb;
}
}
catch(Exception e){
System.err.print("編碼轉(zhuǎn)換錯誤:"+e.getMessage());
return "";
}
}
}
把它編譯成class,就可以調(diào)用Convert類的靜態(tài)方法ISOtoGB()來轉(zhuǎn)換編碼。


小雨不打傘 2006-11-12 20:08 發(fā)表評論
]]>
為自己的網(wǎng)站添加rss功能http://www.aygfsteel.com/LittleRain/archive/2006/11/12/80652.html小雨不打傘小雨不打傘Sat, 11 Nov 2006 16:27:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80652.htmlhttp://www.aygfsteel.com/LittleRain/comments/80652.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/12/80652.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80652.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80652.html1)
<html>
?<body>
??<script language="javascript" src="??? </script>
?</body>
</html>

2)
http://sourceforge.net/docman/?group_id=116283



小雨不打傘 2006-11-12 00:27 發(fā)表評論
]]>
web.xml中無法添加tablib標(biāo)簽問題的解決 http://www.aygfsteel.com/LittleRain/archive/2006/11/10/80414.html小雨不打傘小雨不打傘Fri, 10 Nov 2006 07:27:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/10/80414.htmlhttp://www.aygfsteel.com/LittleRain/comments/80414.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/10/80414.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80414.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80414.html 環(huán)境:
???eclipse3.1.2,myeclipse4.0.2,tomcat5.0.28

解決方法:
???1.將<taglib>標(biāo)簽放在<jsp-config>標(biāo)簽內(nèi)即可;
???2.使用DTD進(jìn)行驗證

產(chǎn)生問題的原因:
???將出問題的web.xml文件與tomcat下其它的文件進(jìn)行比較發(fā)現(xiàn),區(qū)別在于xml文件使用了不同的文檔類型描述
???能夠直接添加的web.xml使用是DTD
???

<! DOCTYPE?web-app
????PUBLIC?"-//Sun?Microsystems,?Inc.//DTD?Web?Application?2.3//EN"
????"http://java.sun.com/dtd/web-app_2_4.dtd"
>


???而我的這個web使用的是XML Schema

< web-app? xmlns ="http://java.sun.com/xml/ns/j2ee" ?xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance" ?version ="2.4" ?xsi:schemaLocation ="http://java.sun.com/xml/ns/j2ee???http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" >


小雨不打傘 2006-11-10 15:27 發(fā)表評論
]]>
JSP下FCKeditor的安裝http://www.aygfsteel.com/LittleRain/archive/2006/11/10/80364.html小雨不打傘小雨不打傘Fri, 10 Nov 2006 04:42:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/11/10/80364.htmlhttp://www.aygfsteel.com/LittleRain/comments/80364.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/11/10/80364.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/80364.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/80364.html下載地址:http://www.fckeditor.net/download

?????????接下來我們可以開始配置了。
我是在eclipse下來配置的
環(huán)境:
jdk:1.4
eclisp:3.12
plugin:myeclipse4.0
FCKeditor :FCKeditor_2.3.2
FCKeditor.java:FCKeditor-2.3

1.新建一個webproject,我這里取名為FCK。

2.把FCKeditor_2.3.2目錄下的FCKeditor目錄拷貝到FCK工程的根目錄,即WebRoot目錄下。

3.將FCKeditor-2.3\web\WEB-INF目錄下的web.xml中的兩個servlet,servlet-mapping定義復(fù)制到工程的web.xml文件中去。

4.修改web.xml文件

<servlet-mapping>?
????????<servlet-name>Connector</servlet-name>?
????????<url-pattern>/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>?
????</servlet-mapping>?

????<servlet-mapping>?
????????<servlet-name>SimpleUploader</servlet-name>?
????????<url-pattern>/editor/filemanager/upload/simpleuploader</url-pattern>??
?</servlet-mapping>

  為

<servlet-mapping>?
????????<servlet-name>Connector</servlet-name>?
????????<url-pattern>/FCKeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>?
????</servlet-mapping>?

????<servlet-mapping>?
????????<servlet-name>SimpleUploader</servlet-name>?
????????<url-pattern>/FCKeditor/editor/filemanager/upload/simpleuploader</url-pattern>??
??</servlet-mapping>

這里的/FCKeditor/是對應(yīng)你webroot目錄下的FCKeditor目錄。

5.拷貝FCKeditor-2.3\web\WEB-INF\lib下的兩個jar包到WebRoot\WEB-INF\lib目錄下
(在項目的庫中添加FCKeditor-2.3\web\WEB-INF\lib下的兩個jar包? 達(dá)不到同樣的效果,一定要拷貝到lib目錄下)

6.在webroot目錄下新建一個jsp,使用默認(rèn)的MyJsp.jsp即可。

7. 文件開頭處加入? :
<%@ taglib uri="
8.在jsp中嵌入的代碼:在Jsp中使用
方法一:(可能會出現(xiàn):The requested resource (/FCK/editor/fckeditor.html) is not available)
<c:set var="basepath"><c:url value="/fck/" /></c:set>
<FCK:editor id="descn" basePath="${basepath}" height="500px">
<c:out value="${book.descn}" escapeXml="false" default="" />
</FCK:editor>

方法二:
<FCK:editor id="infoContent" basePath="/FCK/FCKeditor/"
????????????? width="800"
????????????? height="300"?????????????????????????
????????????? >
????????????? 請輸入內(nèi)容
</FCK:editor>

9.部署好工程,開啟tomcat,打開MyJsp.jsp頁面即可。




10.三種方法調(diào)用FCKeditor
<%--
三種方法調(diào)用FCKeditor
1.FCKeditor自定義標(biāo)簽 (必須加頭文件 <%@ taglib uri="/TestFCKeditor" prefix="FCK" %> )
2.script腳本語言調(diào)用 (必須引用 腳本文件 <script type="text/javascript" src="/TestFCKeditor/FCKeditor/fckeditor.js"></script> )
3.FCKeditor API 調(diào)用 (必須加頭文件 <%@ page language="java" import="com.fredck.FCKeditor.*" %> )
--%>

<%--
<form action="show.jsp" method="post" target="_blank">
<FCK:editor id="content" basePath="/TestFCKeditor/FCKeditor/"
width="700"
height="500"
skinPath="/TestFCKeditor/FCKeditor/editor/skins/silver/"
toolbarSet = "Default"
>
input
</FCK:editor>
<input type="submit" value="Submit">
</form>
--%>

<form action="show.jsp" method="post" target="_blank">
<table border="0" width="700"><tr><td>
<textarea id="content" name="content" style="WIDTH: 100%; HEIGHT: 400px">input</textarea>
<script type="text/javascript">
var oFCKeditor = new FCKeditor('content') ;
oFCKeditor.BasePath = "/TestFCKeditor/FCKeditor/" ;
oFCKeditor.Height = 400;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.ReplaceTextarea();
</script>
<input type="submit" value="Submit">
</td></tr></table>
</form>

<%--
<form action="show.jsp" method="post" target="_blank">
<%
FCKeditor oFCKeditor ;
oFCKeditor = new FCKeditor( request, "content" ) ;
oFCKeditor.setBasePath( "/TestFCKeditor/FCKeditor/" ) ;
oFCKeditor.setValue( "input" );
out.println( oFCKeditor.create() ) ;
%>
<br>
<input type="submit" value="Submit">
</form>
--%>

添加文件/TestFCKeditor/show.jsp:
<%
String content = request.getParameter("content");
out.print(content);
out.println(request.getParameter("title"));
%>
<!--表單中的input的name可以等于這里request.getParameter("parameter") 中的parameter參數(shù)。可以通過out.println輸出
<FCK:editor id="content".....>FCK中的id相當(dāng)于input的name
-->



11.FCKeditor編輯器文件上傳配置

FCKeditor編輯器的配置文件是fckconfig.js,其中有對編輯器各種默認(rèn)屬性的設(shè)置。以下是fckeditor與java集成使用 時上傳文件的設(shè)置(需要注意的是編輯器不會自動創(chuàng)建文件上傳的文件夾,需要在項目的根目錄中手動添加),將fckeditor.js文件中以下幾個屬性原 來的值修改為如下設(shè)置:

至此,即可使用FCKeditor的文件上傳功能。



小雨不打傘 2006-11-10 12:42 發(fā)表評論
]]>
對實戰(zhàn)Struts中一個經(jīng)典例子的詳細(xì)學(xué)習(xí) http://www.aygfsteel.com/LittleRain/archive/2006/10/02/73185.html小雨不打傘小雨不打傘Mon, 02 Oct 2006 03:23:00 GMThttp://www.aygfsteel.com/LittleRain/archive/2006/10/02/73185.htmlhttp://www.aygfsteel.com/LittleRain/comments/73185.htmlhttp://www.aygfsteel.com/LittleRain/archive/2006/10/02/73185.html#Feedback0http://www.aygfsteel.com/LittleRain/comments/commentRss/73185.htmlhttp://www.aygfsteel.com/LittleRain/services/trackbacks/73185.html 關(guān)于Logon例子的學(xué)習(xí)

Welcome頁面:

<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
(在struts1.2中要寫成? <%@ taglib uri="
http://struts.apache.org/tags-html " prefix="html" %>? 其他兩個相似
作用:使得輸入的擴(kuò)展標(biāo)簽庫可以被頁面的其他部分使用)

<HTML>
<HEAD>
<TITLE>Welcome!</TITLE>
<html:base/>
(使得對于圖像等資源的引用與原始jsp頁面位置相關(guān))

</HEAD>
<BODY>?<logic:presentname="user">????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
<H3>Welcome<bean:write name="user" property="username"/>!</H3>??????????????????????????????????????????????????????
</logic:present>???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
(檢查用戶是否在session中存儲了userbean.如果存儲了該bean,則在歡迎頁面中顯示username)?????????
?
??????????
<logic:notPresentscope="session" name="user">
<H3>Welcome World!</H3>
</logic:notPresent>
(如果不存在userbean則顯示"Welcome World!")
注:在Struts中的邏輯標(biāo)簽都是使用"this"和"notThis"這樣的表單,但可以通過擴(kuò)展標(biāo)簽庫來實現(xiàn)if/then/else等語法

<html:errors/>
(用來顯示錯誤信息:)

<UL>
<LI><html:linkforward="logon">Sign in</html:link></LI>
<logic:presentname="user">
<LI><html:linkforward="logoff">Sign out</html:link></LI>
</logic:present>
</UL>
<IMG src='struts-power.gif' alt='Powered by Struts'>
</BODY>
</HTML>

上述的jsp頁面在瀏覽器中的代碼:

<HTML>
<HEAD>
<TITLE>Welcome!</TITLE>
<base href="
http://localhost:8080/logon/pages/Welcome.jsp ">
</HEAD>
<BODY>
<H3>Welcome World!</H3>
<UL>
<LI><a href="/logon/logon.do">Sign in</a></LI>
</UL>
<IMG src='struts-power.gif' alt='Powered by Struts'>
</BODY>
</HTML>

--------------------------------------------------------------------------------------------------------------------------

<%@ taglib uri="/tags/struts-html" prefix="html" %>
(參看Welcome.jsp部分)

<HTML>
<HEAD>
<TITLE>Sign in, Please!</TITLE>
</HEAD>
<BODY>
<html:errors/>
<html:formaction="/LogonSubmit" focus="username">
(<html:form> 標(biāo)簽會生成一個HTML表單來使用戶輸入數(shù)據(jù)。其action屬性指向Struts配置中的某個ActionMapping對象,該對象決定了使用哪個javabean來填充HTML控件,同時該javabean也是Srtuts框架結(jié)構(gòu)的一個ActionForm類)
<TABLE border="0" width="100%">
<TR>
<TH align="right">Username:</TH>
<TD align="left"><html:textproperty="username"/></TD>
(<html:text>標(biāo)簽創(chuàng)建一個HTML文本域來輸入框,同時,它還使用該表格對應(yīng)的JavaBean中屬性名為username的屬性值來進(jìn)行自我填充。)
</TR>
<TR>
<TH align="right">Password:</TH>
<TD align="left"><html:passwordproperty="password"/></TD>

</TR>
<TR>
<TD align="right"><html:submit/></TD>
<TD align="left"><html:reset/></TD>
</TR>
</TABLE>
</html:form>
</BODY>
</HTML>
---------------------------------------------------------------------------------------------------------

Struts中的 ?struts-config.xml的配置
ActionMapping的配置元素
?path -?????? 該ActionMapping的唯一標(biāo)識符,它包括對應(yīng)的Web地址 (不包括擴(kuò)展名.do)
?type?-?????? 當(dāng)請求該路徑時,調(diào)用的Action對象
?name?-? ?? HTML表單對應(yīng)的JavaBean(ActionForm)
?scope?-???? 定義了存儲該JavaBean在請求中(request)還是在會話中(session)
?validate?- 定義了在調(diào)用Action對象前是否調(diào)用JavaBean上的validate方法
?input -????? 定義了當(dāng)validate方法返回false時要轉(zhuǎn)移到的地址
(Struts中的很多命名都是很含糊的;比如ActionMapping中的name屬性并不是指該ActionMapping對象的名字,而是指該ActionMapping使用的JavaBean的名字;)?



小雨不打傘 2006-10-02 11:23 發(fā)表評論
]]>
主站蜘蛛池模板: 华池县| 乌拉特前旗| 塔河县| 文水县| 海林市| 勃利县| 广汉市| 通许县| 苍南县| 达孜县| 晋城| 凤台县| 湟源县| 迁西县| 天长市| 望奎县| 海盐县| 赞皇县| 泰宁县| 阳高县| 太谷县| 本溪| 萨嘎县| 双柏县| 罗甸县| 阿城市| 屏南县| 达日县| 四川省| 呼伦贝尔市| 石楼县| 娄底市| 青海省| 太白县| 东光县| 双牌县| 大邑县| 定襄县| 肇源县| 巴彦淖尔市| 长兴县|