html的frameset标签在不同浏览器中的不同表现!

下面一段代码在IE,firefox和Chrome下的表现不同,不知道为什么,请各位知道的留下信息!

test

哎呀,本来想上个图片的,MLGB,但是上了半天上不了!真是CSDN啊!佩服!

总之现象是在IE(6.0)和firefox(3.5)下只显示test,而在chrome(3.0)下显示了三个frame。

这是为什么呢?

难道只浏览器的差异。

1。frame还有一个重要的特性,那就是frame所对应的路径会传递给自己所包含的url。

比如:

而在go.html中又有这样的url:./hello.html,那么它会被解释成./jsp/test/hello.html。

所以请注意,尤其是go.html中包含js,而js中使用到了相对路径的图片,图片的路径会以./jsp/test

开始的!

2。还有在go.html中不要使用base标签,因为frame和base在一起时,不同的浏览器解释不同。在firefox下

会将两者叠加起来,而在chrome下两者的url都会失效!

js中的prototype chain

注意proto只有在firefox下有效。

prototype chain就是说继承链。JavaScript用这种方式来实现继承。

以下例子在firebugs下完成:

function Hero(){this.name = “name”}
Hero.proto
function()
Hero.proto.proto
Object
Hero.proto.proto.proto
null
var t = new Hero()
t.proto
Object
t.proto.proto
Object
t.proto.proto.proto
null
function Hero2(){this.age = 23}
Hero.prototype = new Hero2
Object age=23
t.proto
Object
t.proto.proto
Object
t.proto.proto.proto
null
var tt = new Hero()
tt
Object name=name age=23
tt.proto
Object age=23
tt.proto.proto
Object
tt.proto.proto.proto
Object
tt.proto.proto.proto.proto
null

可以参见http://mckoss.com/jscript/object.htm中的图进行理解!我也只是稍微理解了一点点,请多指教!

js中的prototype和constructor

在这之前先说明几个问题:

prototype是JavaScript中所有对象都具有的属性,
constructor是用new创建函数的才有的属性。

当使用new来创建一个函数时,JavaScript会自动创建一个prototype属性,并且将prototype.constructor属性指向该函数本身。

见下面的例子(在firebugs下完成):

Object.prototype. constructor === Object
true
function Hero() {this.name = “Hero”}
Hero.prototype.constructor == Hero
true
var h1 = new Hero()
h1.constructor //没有更改prototype的情况下,h1.constructor是正确的
Hero()
Hero.prototype = {} //将Hero.prototype制空
Object
var h2 = new Hero()
h2.constructor //h2.constructor是错误的
Object()
function Hero2() {this.name = “Hero2”}
Hero.prototype = new Hero2 //将Hero.prototype制为Hero2
Object
var h3 = new Hero()
h3.constructor //h3.constructor是错误的
Hero2()
Hero.prototype.constructor = Hero //将Hero.prototype.constructor设置回去
Hero()
var h4 = new Hero()
h4.constructor //恢复正常
Hero()

所以在自己设置函数的prototype时,一定要同时更改函数的constructor属性,要不然会出现一些莫名其妙的问题!

HTML CSS JavaScript

The modern understanding of a web page is that it consists of three distinct
parts:

1. Content (HTML)
2. Presentation (CSS)
3. Behavior (JavaScript)

These should be kept separate, ideally each in its own file (or files). What
it means for JavaScript is that there should be no inline such as onclick,
onmouseover, etc. Ideally there should be little to no inline scripts.

The idea is that content (the text on the page) is independent of:

  • how it looks like, so the page should be usable even with CSS disabled, or not supported by the browser, and
  • how it behaves, meaning the page should be usable even with JavaScript disabled. The content should be accessible independent of any mouseovers, animations, and so on.

也就是说:

我们使用js框架将结构(HTML)和行为分离(JS),用css将结构和表现分离

其他:

HTTP has two hurdles to address. It is stateless , and it is text
based
.

在西安办理护照之疼

首先说一下正常的流程:

1.带上自己的 户口本(或者户籍卡)和身份证,300块钱,一只碳素笔 到西安市 西斜七路 出入境管理处(二楼)

2.用自己的 户口本(或者户籍卡)和身份证 复印一张申请表(免费)

3.花30块钱照相,可以立即取的

4.然后填写刚才申请的表,贴上照片(最后下午去,上午人很多)

5.抽号排队等待办理(办理如果出现麻烦,请一定想方设法要到给你办理的工作人员的电话,方便自己及时查询)

6.办理完成后到15号窗口开票,到附近的农行缴费(200块)

7.交完费后再回来到16号窗口确认

8.按照回执单上的日期到12号窗口取护照

注意:

如果户籍卡上没有派出所的章子,必须先到自己户籍所在的派出所盖章,否则办理不了;

复印申请表多复印几张(可以多排几次队复印),写错了,不用再去排队复印了;

在填写申请表时,如果自己是出差,请选择“商务”而不是“劳务”;

如果你的户口曾经签到外地又签回来不足十年的话,你先要办理户口协查(短的十天,长的一个月),然后才能办理护照,我在办理时就用了10天,还是托我的朋友到原先户口所在地的出入境管理处去催的!

西安出入境管理处的办公时间时:

周一到周五 早9:30到下午4:30

这里有一个办公人员的电话:02986755620

在virtualbox上安装openlsolaris 09.06碰到的一个问题

在选择完键盘布局和桌面语言后,出现file system full提示,然后安装过程停止。见下图:

NOTICE: realloccg /: file system full

NOTICE: alloc: /: file system full

原因是这个虚拟机的虚拟硬盘所在的盘符没有足够的空间来完成安装系统所需的空间,所以安装停止,只要将虚拟硬盘换到一个有足够空间的盘符下就可以正常安装了。

why file system full?

Because the phisical disk which your virtual disk located capacity is lacking!

THANKS!

详细的安装步骤请看:

http://developers.sun.com.cn/opensolaris/getting_started.html#2_3

安装opensolaris:
桌面环境默认用户名:jack,密码:jack;默认root密码:opensolaris

我开发一个jsp系统时碰到的问题

1.No getter method for property name problem(struts)
有一种可能是Bean没有写相应的get方法,例如变量userName的get方法是getUserName;
还有就是这个Bean为空;

2. MyEclipse的自动添加struts和hibernate功能不能返回,请注意!

所以我先使用MyEclipse导入struts和hibernate,然后将它们的jar导入到另外一个新建的工程,这是我就不需要Myeclipse来给我管理依赖了。

3 .在增加对struts taglib支持时,请将对应的tld文件追加到web.xml文件中去:
例如:

http://struts.apache.org/tags-bean

/WEB-INF/struts-bean.tld

4. 如果出错说某个tag在tld文件中没有,则说明自己在jsp文件中使用的tag和使用的struts taglib版本不一致
例如:在struts1.1中的html:locale,在struts1.2中改为html:lang

5. struts tag中可以使用scriptlets,但是在scriptlets中不能使用struts tag。
Any Struts tag will work only if you place it directly in the JSP, not if you
generate it through a scriptlet. To understand why it won’t work to generate
it in a scriptlet.
JSP life cycle:

  • The JSP interpreter reads the JSP file, including any custom tags such as Struts tags and converts everything to Java source code
  • It then compiles it into a class file
  • It executes the code, rendering a response in plain HTML and sending it back to the browser.
  • It is only at this point that the scriptlet code you inserted gets executed. It is now too late in the cycle to insert any custom tags, since they’ve already been interpreted by this point.

6. it is illegal according to JSP specification to nest one tag within
another as an attribute.

There are two options:
1) You evaluate bean:write and then substitute it into html:text.
2) Use Struts-EL tags. They let you use expression language to get a bean
value and substitute it in another tag.
Unless you have a system wide requirement to do this, I suggest you stick to
the first option.

7.Explain the scope of JSP objects.
Scope of JSP objects:
The availability of a JSP object for use from a particular place of the
application is defined as the scope of that JSP object.
Every object created in a JSP page will have a scope. Object scope in JSP is
segregated into four parts and they are page, request, session and
application.

  • page
    ‘page’ scope means, the JSP object can be accessed only from within the same
    page where it was created. The default scope for JSP objects created using
    jsp:useBean tag is page. JSP implicit objects out, exception, response,
    pageContext, config and page have ‘page’ scope.
  • request
    A JSP object created using the ‘request’ scope can be accessed from any pages
    that serves that request. More than one page can serve a single request. The
    JSP object will be bound to the request object. Implicit object request has
    the ‘request’ scope.
  • session
    ’session’ scope means, the JSP object is accessible from pages that belong to
    the same session from where it was created. The JSP object that is created
    using the session scope is bound to the session object. Implicit object
    session has the ’session’ scope.
  • application
    A JSP object created using the ‘application’ scope can be accessed from any
    pages across the application. The JSP
    object is bound to the application object. Implicit object application has the
    ‘application’ scope.

8. Cannot find bean under name org.apache.struts.taglib.html.BEAN[转]
试图在Struts的form标记外使用form的子元素
不经意使用的无主体的标记,如web服务器解析时当作一个无主体的标记,随后使用的标记都被认为是在这个标记之外的
还有就是在使用taglib引入HTML标记库时,你使用的prefix的值不是html
property必须和所要提交的action对应的formbean中的某个属性相匹配(必须有一个formbean)
要使用标签,外层必须使用标签,不能使用html的

9.注意使用相对路径,比如说..或者.什么的。不要使用绝对路径。
一般来说404,提示说找不到资源,大部分就是路径写的不对。

10.今天使用jdbc连接数据库取得所有符合条件的数据库名字,然后根据数据库名动态生成各自对应的SessionFactory,
但是在画面上不同的叶子上进行转移切换不同数据库取得不同数据库的数据时,总是从业个特定的数据库中去数据。 最后的原因是在hibernate
的mapping文件中使用了catalog=”数据库名”,所以它总是连接到该数据库,将它删除回复正常。

11.Servlets are modules of Java code that run in a server application (hence
the name “Servlets”, similar to “Applets” on the client side) to answer client
requests. Servlets are not tied to a specific client-server protocol but they
are most commonly used with HTTP and the word “Servlet” is often used in the
meaning of “HTTP Servlet”.

ref:
http://www.novocode.com/doc/servlet-essentials/chapter1.html
http://www.roseindia.net/servlets/what-is-servlets.shtml
http://en.wikipedia.org/wiki/Servlet

JSP pages are high level extension of servlet and it enable the developers
to embed java code in html pages. JSP files are finally compiled into a
servlet by the JSP engine. Compiled servlet is used by the engine to serve the
requests.


javax.servlet.jsp package defines two interfaces:

  • JSPPage
  • HttpJspPage

These interfaces defines the three methods for the compiled JSP page. These
methods are:

  • jspInit()
  • jspDestroy()
  • _jspService(HttpServletRequest request,HttpServletResponse response)

In the compiled JSP file these methods are present. Programmer can define
jspInit() and jspDestroy() methods, but the _jspService(HttpServletRequest
request,HttpServletResponse response) method is generated by the JSP engine.

ref:
http://www.roseindia.net/jsp/jsparchitecture.shtml
http://en.wikipedia.org/wiki/JavaServer_Pages
http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html

Tomcat implements the Servlet X.X and JSP X.X specifications
please visite this website: http://en.wikipedia.org/wiki/Apache_Tomcat

JSTL:
http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=JSTL+primer

12.Adobe

Used Flash and the Flex framework to create applications
Flash Player 9 and AIR are the runtimes for browser-based and desktop-based
applications.

JavaScript中的prototypes(JavaScript: The Definitive Guide学习摘要7)

Prototypes:

All functions have a prototype property that is automatically created and
initialized when the function is defined. The initial value of the prototype
property is an object with a single property. This property is named
constructor and refers back to the constructor function with which the
prototype is associated. Any properties you add to this prototype object will
appear to be properties of objects initialized by the constructor.

This is clearer with an example. Here again is the Rectangle( ) constructor:

// The constructor function initializes those properties that
// will be different for each instance.
function Rectangle(w, h) {
this.width = w;
this.height = h;
}

// The prototype object holds methods and other properties that
// should be shared by each instance.
Rectangle.prototype.area = function( ) { return this.width * this.height; }

A constructor provides a name for a “class” of objects and initializes
properties, such as width and height, that may be different for each instance
of the class. The prototype object is associated with the constructor, and
each object initialized by the constructor inherits exactly the same set of
properties from the prototype. This means that the prototype object is an
ideal place for methods and other constant properties.

Note that inheritance occurs automatically as part of the process of looking
up a property value. Properties are not copied from the prototype object into
new objects; they merely appear as if they were properties of those objects.
This has two important implications. First, the use of prototype objects can
dramatically decrease the amount of memory required by each object because the
object can inherit many of its properties. The second implication is that an
object inherits properties even if they are added to its prototype after the
object is created. This means that it is possible (though not necessarily a
good idea) to add new methods to existing classes.

参见:

1.http://mckoss.com/jscript/object.htm

2.http://www.cs.rit.edu/~atk/JavaScript/manuals/jsobj/

数组的长度(JavaScript: The Definitive Guide学习摘要6)

7.6.3. Array Length

All arrays, whether created with the Array() constructor or defined with
an array literal, have a special length property that specifies how many
elements the array contains. More precisely, since arrays can have undefined
elements, the length property is always one larger than the largest
element number in the array. Unlike regular object properties, the length
property of an array is automatically updated to maintain this invariant when
new elements are added to the array. The following code illustrates:

var a = new Array();   // a.length == 0  (no elements defined)
a = new Array(10);     // a.length == 10 (empty elements 0-9 defined)
a = new Array(1,2,3);  // a.length == 3  (elements 0-2 defined)
a = [4, 5];            // a.length == 2  (elements 0 and 1 defined)
a[5] = -1;             // a.length == 6  (elements 0, 1, and 5 defined)
a[49] = 0;             // a.length == 50 (elements 0, 1, 5, and 49 defined)

Remember that array indexes must be less than 2 32 -1, which means that the
largest possible value for the length property is 2 32 -1.