2007/08/30 11:25
The Yahoo! User Interface (YUI) Library is a set of utilities and controls, written in JavaScript, for building richly interactive web applications using techniques such as DOM scripting, DHTML and AJAX. The YUI Library also includes several core CSS resources. All components in the YUI Library have been released as open source under a BSD license and are free for all uses.
这里可以下载并有文档。
http://developer.yahoo.com/yui/
这里可以下载并有文档。
http://developer.yahoo.com/yui/
2007/06/19 00:55
以下是我在其它论坛上发表的问题:
QUOTE:
我采用AbstractDependencyInjectionSpringContextTests进行测试,通过以下代码进行加载.
protected String[] getConfigLocations() { return new String[] { "classpath:springapplicationcontext.xml" }; }
以下是我原来的配置文件:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
字串1
</property>
<property name="url">
<value>jdbc:oracle:thin:@localhost:1521:oracle9</value>
</property>
<property name="username">
<value>gap</value>
</property>
<property name="password">
<value>gap</value>
</property>
</bean> 字串3
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" /> 字串9
</bean>
<bean id="gapdictionaryDao" class="org.gap.dao.GapdictionaryDao">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="gap" class="org.gap.service.GapImpl">
<property name="gapdictionaryDao" ref="gapdictionaryDao" />
</bean>
</beans>
以下是我新的配置文件:
QUOTE:
我采用AbstractDependencyInjectionSpringContextTests进行测试,通过以下代码进行加载.
protected String[] getConfigLocations() { return new String[] { "classpath:springapplicationcontext.xml" }; }
以下是我原来的配置文件:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
字串1
</property>
<property name="url">
<value>jdbc:oracle:thin:@localhost:1521:oracle9</value>
</property>
<property name="username">
<value>gap</value>
</property>
<property name="password">
<value>gap</value>
</property>
</bean> 字串3
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<bean id="txManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" /> 字串9
</bean>
<bean id="gapdictionaryDao" class="org.gap.dao.GapdictionaryDao">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="gap" class="org.gap.service.GapImpl">
<property name="gapdictionaryDao" ref="gapdictionaryDao" />
</bean>
</beans>
以下是我新的配置文件:
2007/06/03 23:15
首先创建代表产品的类cn.org.jock.Product,代码如下:
package cn.org.jock;
import java.sql.Date;
public class Product {
private String name;
private double price;
private Date dateOfProduction;
public Date getDateOfProduction() {
return dateOfProduction;
}
public void setDateOfProduction(Date dateOfProduction) {
this .dateOfProduction = dateOfProduction;
}
public String getName() {
return name;
}
public void setName(String name) {
this .name = name;
}
public double getPrice() {
return price;
}
public void setPrice( double price) {
this .price = price;
}
}
本例子中的dateOfProduction属性使用了java.sql.Date,而不是java.util.Date。这是因为Struts 1.x不支持请求参数到java.util.Date的转换,归根到底是由于org.apache.commons.beanutils.ConvertUtilsBean.convert()不支持关于java.util.Date的转换。另外,值得注意的是common-beanutils是通过java.sql.Date.valueOf()方法工作的,所以在页面输入的字符串的格式必须为“yyyy-MM-dd”。
表单(Actoin Form)+ 列表(List)
首先,我们要创建类cn.org.jock.struts.util.AutoInitArrayList,代码如下:
/**
*
*/
package cn.org.jock.struts.util;
import java.util.ArrayList;
/**
* @author Jock
*
*/
public class AutoInitArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 1L ;
private Class<E> t = null ;
public AutoInitArrayList(Class<E> t) {
this.t = t;
}
@Override
public E get( int index) {
try {
while (index >= size()) {
add(t.newInstance());
}
} catch (Exception e) {
e.printStackTrace();
}
return super .get(index);
}
}
AutoInitArrayList继承ArrayList并重载get()方法,作用就是在Struts 1.x框架调用这个方法时,如果index超出列表大小,则会实例化新项放到列表中,避免出现(IndexOutOfBoundsException)异常。
package cn.org.jock;
import java.sql.Date;
public class Product {
private String name;
private double price;
private Date dateOfProduction;
public Date getDateOfProduction() {
return dateOfProduction;
}
public void setDateOfProduction(Date dateOfProduction) {
this .dateOfProduction = dateOfProduction;
}
public String getName() {
return name;
}
public void setName(String name) {
this .name = name;
}
public double getPrice() {
return price;
}
public void setPrice( double price) {
this .price = price;
}
}
本例子中的dateOfProduction属性使用了java.sql.Date,而不是java.util.Date。这是因为Struts 1.x不支持请求参数到java.util.Date的转换,归根到底是由于org.apache.commons.beanutils.ConvertUtilsBean.convert()不支持关于java.util.Date的转换。另外,值得注意的是common-beanutils是通过java.sql.Date.valueOf()方法工作的,所以在页面输入的字符串的格式必须为“yyyy-MM-dd”。
表单(Actoin Form)+ 列表(List)
首先,我们要创建类cn.org.jock.struts.util.AutoInitArrayList,代码如下:
/**
*
*/
package cn.org.jock.struts.util;
import java.util.ArrayList;
/**
* @author Jock
*
*/
public class AutoInitArrayList<E> extends ArrayList<E> {
private static final long serialVersionUID = 1L ;
private Class<E> t = null ;
public AutoInitArrayList(Class<E> t) {
this.t = t;
}
@Override
public E get( int index) {
try {
while (index >= size()) {
add(t.newInstance());
}
} catch (Exception e) {
e.printStackTrace();
}
return super .get(index);
}
}
AutoInitArrayList继承ArrayList并重载get()方法,作用就是在Struts 1.x框架调用这个方法时,如果index超出列表大小,则会实例化新项放到列表中,避免出现(IndexOutOfBoundsException)异常。







