leto@freecity.cn

On The Java Road

Jake's Free House For Fun.

foreword

它不是我最喜欢的语言,却是我使用得最多的,至少目前是这样。或许其中也有 Java 那些名字都老长老长的缘故,哈哈。想像一下吧,=try catch= 要捕获的 那些异常的名字,已定义的常量的名字。如果你要让捕获更加小心翼翼更加合乎 逻辑,如果你没在用 Eclipse 或者 Netbeans 的话我觉得最好还是放弃。不过 如果 Vim、Emacs 配置的好,自然不用理会我的想法。

本页的标题抄袭自 James Gosling 的博客。暂时只有这些内容,以后添加。

In Collaboration With XML

Some info about XML

XML stands for eXtensible Markuo Language which is NOT a replacement for HTML. There are 5 predefined entity references in XML. NOTE: Only the characters "<" and "&" are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.

&lt; < less than
&quot; " quotation mark
&gt; > greater than
&amp; & ampersand
&apos; ' apostrophe

HTML reduces multiple white space characters to a single white space. With XML, the white space in your document is not truncated.

In Windows applications, a new line is normally stored as a pair of characters: carriage return (CR) and line feed (LF). The character pair bears some resemblance to the typewriter actions of setting a new line. In Unix applications, a new line is normally stored as a LF character. Macintosh applications use only a CR character to store a new line.

Net

Proxies and Firewalls

If you are behind a firewall, you need to tell Java the details of your proxy server and its port number in order to access hosts outside the firewall. You do this by defining the applicable HTTP or FTP properties:

The http.proxyHost and http.proxyPort indicate the proxy server and port that the HTTP protocol handler will use. The http.nonProxyHosts can be set to specify the hosts which should be connected to directly (not through the proxy server). The value of the http.nonProxyHosts property can be a list of hosts, each separated by a |; it can also take a regular expression for matches; for example: .sfbay.sun.com would match any fully qualified hostname in the sfbay domain.

  • ftp.proxyHost (default: <none>)
  • ftp.proxyPort (default: 80 if ftp.proxyHost specified)
  • ftp.nonProxyHosts (default: <none>)

The ftp.proxyHost and ftp.proxyPort indicate the proxy server and port that the FTP protocol handler will use. The ftp.nonProxyHosts is similar to http.nonProxyHosts and indicates the hosts that should be connected to directly and not through the proxy server.

You can set these properties when you start your application:

  • Prompt> java -Dhttp.proxyHost=HostName -Dhttp.proxyPort=PortNumber yourApp

more

* JSP related

CLASSPATH

有许多选择,把相应的 jar 丢到 [your app]/WEN-INF/lib/ 下面,或者编译的 时候指定:

javac -classpath ".;C:\Program Files\Tomcat 5.5\common\lib\servlet-api.jar;" leto/servlet/foo.java

WARN: [Parameters] Parameters: Invalid chunk ignored.

When interacting with the application, such as facelets-component-showcase on JBoss 4.2, the following will be displayed in the server log:

WARN: [Parameters] Parameters: Invalid chunk ignored.

This is due to a parameter with no name — the string "&=" appearing in the form-encoded data. It is not clear which parameter is being encoded in this way.

native2ascii

According to the official doc, the default encoding is taken from System property file.encoding. So when you try to convert a non-english file (say, GBK, BIG-5...), you should use the -encoding option to sepecify the exact encoding of the original file.

struts 2

a configuration sample
<?xml version="1.0" encoding="UTF-8"?>
<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">
  <display-name>S2 Example Application - Chapter 1 - Hello World
  </display-name>
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
    <init-param>
      <param-name>actionPackages</param-name>
      <param-value>manning</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>anotherServlet</servlet-name>
    <servlet-class>manning.servlet.AnotherServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>anotherServlet</servlet-name>
    <url-pattern>/anotherServlet</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

工具配置笔记

学生习作

在外网的我的窝

友情链接们