??xml version="1.0" encoding="utf-8" standalone="yes"?>懂色av一区二区在线播放,免费av在线电影,色视频一区二区三区http://www.aygfsteel.com/felicity/category/5829.htmlall gonezh-cnWed, 28 Feb 2007 05:58:08 GMTWed, 28 Feb 2007 05:58:08 GMT60Struts2 入门http://www.aygfsteel.com/felicity/archive/2007/01/08/92473.htmlall goneall goneMon, 08 Jan 2007 13:59:00 GMThttp://www.aygfsteel.com/felicity/archive/2007/01/08/92473.htmlhttp://www.aygfsteel.com/felicity/comments/92473.htmlhttp://www.aygfsteel.com/felicity/archive/2007/01/08/92473.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/92473.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/92473.html阅读全文

all gone 2007-01-08 21:59 发表评论
]]>
EJB3.0 + Struts试http://www.aygfsteel.com/felicity/archive/2006/08/11/62942.htmlall goneall goneFri, 11 Aug 2006 05:52:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/08/11/62942.htmlhttp://www.aygfsteel.com/felicity/comments/62942.htmlhttp://www.aygfsteel.com/felicity/archive/2006/08/11/62942.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/62942.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/62942.html阅读全文

all gone 2006-08-11 13:52 发表评论
]]>
SSH(Spring + Struts + Hibernate)试 之三 http://www.aygfsteel.com/felicity/archive/2006/07/18/58810.htmlall goneall goneTue, 18 Jul 2006 08:41:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/07/18/58810.htmlhttp://www.aygfsteel.com/felicity/comments/58810.htmlhttp://www.aygfsteel.com/felicity/archive/2006/07/18/58810.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/58810.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/58810.html

前面通过PlugIn我们实现了Spring Context的加载,不过仅仅加蝲Contextq没有什么实?
意义Q我们还需要修攚w|,Struts Action交给Spring容器q行理。下面将通过一个Regsit
实例加以说明?

首先准备好regist.jsp和login.jsp,在regist.jsp?的form有name,password,password2,email域?

在struts-config.xml中添加配|:

<form-bean name="registForm" type="com.lzy.forum.form.RegistForm" />

<action path="/regist" name="registForm"
type="org.springframework.web.struts.DelegatingActionProxy"

validate="true" input="/regist.jsp" scope="request">
<forward name="failure" path="/regist.jsp" />
<forward name="success" path="/login.jsp" />
</action>


RegistForm,RegistAction按照原来Struts的方法去?我在RegistAction中加入了一个UserDAO对象
userDAOQ这个对象由Spring注入?

<bean name="/regist" class="com.lzy.forum.action.RegistAction"
singleton="false">
<property name="userDAO">
<ref local="userDAO" />
</property>
</bean>

基本上SSH的架构已l完成,l确认后可以自己试一下了。(完)


all gone 2006-07-18 16:41 发表评论
]]>
SSH(Spring + Struts + Hibernate)试 之二http://www.aygfsteel.com/felicity/archive/2006/07/18/58802.htmlall goneall goneTue, 18 Jul 2006 08:09:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/07/18/58802.htmlhttp://www.aygfsteel.com/felicity/comments/58802.htmlhttp://www.aygfsteel.com/felicity/archive/2006/07/18/58802.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/58802.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/58802.htmlSpring和Strutsl合有几U方法,我选了最常用的PlugIn方式Q在struts-config.xml中加?br />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
      <set-property property="contextConfigLocation"
            value="/WEB-INF/action-servlet.xml" />
 </plug-in>

WEB-INF目录下的action-servlet.xml是Spring的配|文?下面l出的是整个?/font>action-servlet.xml文gQ?/font>

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "<beans>

//Data Source

 <bean id="dataSource"
  class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName">
   <value>com.mysql.jdbc.Driver</value>
  </property>
  <property name="url">
   <value>jdbc:mysql://localhost:3306/forum</value>
  </property>
  <property name="username">
   <value>test</value>
  </property>
  <property name="password">
   <null />
  </property>
 </bean>

// For Hibernate
 <bean id="sessionFactory"
  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
  <property name="dataSource">
   <ref local="dataSource" />
  </property>
  <property name="mappingResources">
   <list>
    <value>com/lzy/forum/domain/User.hbm.xml</value>
    <value>com/lzy/forum/domain/Article.hbm.xml</value>
    <value>com/lzy/forum/domain/Board.hbm.xml</value>
   </list>
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.dialect">
     org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>
   </props>
  </property>
 </bean>

 <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
   <ref local="sessionFactory" />
  </property>
 </bean>

 

// For DAO
 <bean id="userDAO"
  class="com.lzy.forum.dao.impl.UserDAOHibernate">
  <property name="sessionFactory">
   <ref local="sessionFactory" />
  </property>
 </bean>

 

 <bean id="boardDAO"
  class="com.lzy.forum.dao.impl.BoardDAOHibernate">
  <property name="sessionFactory">
   <ref local="sessionFactory" />
  </property>
 </bean>

 <bean id="articleDAO"
  class="com.lzy.forum.dao.impl.ArticleDAOHibernate">
  <property name="sessionFactory">
   <ref local="sessionFactory" />
  </property>
 </bean>

//For Struts Action

 <bean name="/regist" class="com.lzy.forum.action.RegistAction"
  singleton="false">
  <property name="userDAO">
   <ref local="userDAO" />
  </property>

 </bean>


 <bean name="/login" class="com.lzy.forum.action.LoginAction"
  singleton="false">
  <property name="userDAO">
   <ref local="userDAO" />
  </property>

 </bean>

 <bean name="/boardManage"
  class="com.lzy.forum.action.BoardManageAction" singleton="false">
  <property name="userDAO">
   <ref local="userDAO" />
  </property>
  <property name="boardDAO">
   <ref local="boardDAO" />
  </property>

 </bean>

 <bean name="/boardNavigate"
  class="com.lzy.forum.action.BoardNavigateAction" singleton="false">
  <property name="boardDAO">
   <ref local="boardDAO" />
  </property>

 </bean>

 <bean name="/boardDisplay"
  class="com.lzy.forum.action.BoardDisplayAction" singleton="false">
  <property name="boardDAO">
   <ref local="boardDAO" />
  </property>

 </bean>

 <bean name="/articleManage"
  class="com.lzy.forum.action.ArticleManageAction" singleton="false">
  <property name="userDAO">
   <ref local="userDAO" />
  </property>
  <property name="boardDAO">
   <ref local="boardDAO" />
  </property>
  <property name="articleDAO">
   <ref local="articleDAO" />
  </property>


 </bean>


</beans>

l过q样的配|之后,Hibernate事务交由Spring理QsessionFactory从Spring容器获得。下面通过其中的一个DAO实例来看看这样做带来的方ѝ?br />

//BoardDAO.java

package com.lzy.forum.dao;

import java.util.ArrayList;

import com.lzy.forum.domain.Board;

public interface BoardDAO {
 
 public boolean isBoardExist(String name);
 
 public void addBoard(Board board);
 
 public void deleteBoard(Board board);
 
 public Board loadBoard(int id);
 
 public Board loadBoard(String name);
 
 public Board loadBoardWithArticles(int id);
 
 public ArrayList getRootBoardsList();
 
 
 
}


//BoardDAOHibernate.java

package com.lzy.forum.dao.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
import java.util.Set;

import org.hibernate.Hibernate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.lzy.forum.dao.BoardDAO;
import com.lzy.forum.domain.Board;

public class BoardDAOHibernate extends HibernateDaoSupport implements BoardDAO {

 public void deleteBoard(Board board) {
  // TODO Auto-generated method stub
  this.getHibernateTemplate().delete(board);
 }

 public void addBoard(Board board) {
  // TODO Auto-generated method stub
  this.getHibernateTemplate().saveOrUpdate(board);

 }

 public boolean isBoardExist(String name) {
  // TODO Auto-generated method stub
  ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board where name = ? ", new Object[] { name });
  if (list.size() > 0) {
   // System.out.println("find it");
   return true;
  }
  return false;
 }

 public Board loadBoard(int id) {
  // TODO Auto-generated method stub
  ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board where id = ? ", new Object[] { id });

  Board b = null;
  if (list.size() > 0) {
   b = (Board) list.get(0);
  }

  return b;
 }

 public Board loadBoard(String name) {
  // TODO Auto-generated method stub
  ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board where name = ? ", new Object[] { name });

  Board b = null;
  if (list.size() > 0) {
   b = (Board) list.get(0);
  }

  return b;
 }

 public ArrayList getRootBoardsList() {
  // TODO Auto-generated method stub
  ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board b left join fetch b.ChildBoards where b.Parent = null order by b.id");
  System.out.println(list.size() + " root boards found ");
  

  ListIterator index = list.listIterator();
  while (index.hasNext()) {

   Board s = (Board) index.next();
   //this.getSession(true);
   //Hibernate.initialize(s.getChildBoards());
   ///*
    Set children  = (Set) s.getChildBoards();
    Iterator it = children.iterator();
   
    while(it.hasNext()){
    Board b = (Board)it.next();
    //Hibernate.initialize(b);
    System.out.println(b.getName());
    }
    //*/

   //System.out.println(children.size() + "child(ren) found ");
   //s.setChildBoards(s.getChildBoards());
  }

  return list;
 }

 public Board loadBoardWithArticles(int id) {
  // TODO Auto-generated method stub
  ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board b left join fetch b.Articles where b.Id = ? ", new Object[] { id });

  Board b = null;
  if (list.size() > 0) {
   b = (Board) list.get(0);
  }

  return b;

 }


}


BoardDAOHibernatel承 HibernateDaoSupport后,通过getHibernateTemplate()得到一个HibernateTemplate实例Q然后执行CRUD操作Q非常简单。需要注意的是,׃执行一ơCRUD操作后,Hibernate session关闭Q如果有使用延迟加蝲{略的对象没有加载,在后面的Web层很Ҏ出现如下错误Q?br />failed to lazily initialize a collection of role
从网上搜到的解决Ҏ是Open Session In ViewQ?br /><filter>
     <filter-name>hibernateFilter</filter-name>
     <filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
     </filter-class>

     <!-- singleSession默认为true,若设为false则等于没用OpenSessionInView -->
    <init-param>
       <param-name>singleSession</param-name>
       <param-value>true</param-value>
    </init-param>
  </filter>

   <filter-mapping>
     <filter-name>hibernateFilter</filter-name>
     <url-pattern>*.do</url-pattern>
   </filter-mapping>
我试了试Q还是有一些问题,所以后来还是放弃了q种ҎQ所有在Web层中需要的对象都必dBusiness层中加蝲完成。如下面的代码所C:

ArrayList list = (ArrayList) this.getHibernateTemplate().find(
    "from Board b left join fetch b.Articles where b.Id = ? ", new Object[] { id });


q样Hibernate和Spring的结合也完成了。其他的一些DAOcd实现代码我没有给出,但是大同异Q和Board的实现类伹{?br />

最后将是Struts 和Spring的结合,在下一给出。(未完待箋Q?/font>







all gone 2006-07-18 16:09 发表评论
]]>
SSH(Spring + Struts + Hibernate)试 之一http://www.aygfsteel.com/felicity/archive/2006/07/18/58689.htmlall goneall goneTue, 18 Jul 2006 01:54:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/07/18/58689.htmlhttp://www.aygfsteel.com/felicity/comments/58689.htmlhttp://www.aygfsteel.com/felicity/archive/2006/07/18/58689.html#Feedback2http://www.aygfsteel.com/felicity/comments/commentRss/58689.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/58689.html 之前对Spring Struts Hibernate都稍有了解,Spring的IOCl我留下了很q印象Q容器管理的对象生成
Ҏ极大地简化了E序逻辑QSpring也提供了用于Web的Spring MVC 框架Q由于我感觉其易用性还是不?br />StrutsQ所以我q是选择Struts作ؓ前端WEB框架QHibernate我一直没有在Web应用中试q,q次当然不会
错过Z了?/font>


开发环境的塔徏我就不多说了Q具体可以参考我以前的几日志?/p>

在Eclipse中新Z个动态Web工程Q将Struts 、Spring、Hibernate需要的jar都添加到WEB-INF/lib目录下,
Struts标签所需的tld文g、struts-config.xml文gQ可以由StrutsIDE生成Q添加到WEB-INF下,另外?br />此目录下d一个Spring的配|文件applicationContext.xml?/p>


我参考的例子是夏昕的《深入浅出Hibernate》上的第6章,很好的一个论坛示例?/p>

首先按照书上的ER模型Q在数据库(MySQLQ中建立相应的数据库?/p>


create database forum;

use forum;

create table user(
 id int not null auto_increment primary key,
 name varchar(50),
 pwd varchar(50),
 email varchar(50)

)type=innodb;


create table board(
 id int not null auto_increment primary key, 
 parent_id int,
 create_by int not null,
 name varchar(50) not null,
 remark varchar(255),
 create_time datetime,

 index(parent_id),
 index(create_by),

 foreign key(parent_id) references board(id) on delete cascade,
 foreign key(create_by) references user(id) on delete no action
 
)type=innodb;


create table article(
 id int not null auto_increment primary key, 
 parent_id int ,
 board_id int not null,
 article_type int not null,
 title varchar(255),
 body text,
 create_by int not null,

 create_time datetime,
 hits int unsigned,
 bytes int unsigned,
 last_update_by int not null,
 last_update_time datetime,

 index(parent_id),
 index(board_id),
 index(create_by),
 index(last_update_by),

 foreign key(parent_id) references article(id) on delete no action,
 foreign key(board_id) references board(id) on delete cascade,
 foreign key(create_by) references user(id) on delete no action,
 foreign key(last_update_by) references user(id) on delete no action
 
)type=innodb;

之后Q我选择了用Hibernate Sychonizer来生成映文件和实体c,然后对生成的c进行修改(删掉了生成的Basec)Q?br />实际上Hibernate Sychonizer生成的映文件也有错误,需要修改,我也是后来在使用中发现的?br />
//User.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

<hibernate-mapping package="com.lzy.forum.domain">
 <class
  name="User"
  table="user"
 >

  <id
   name="Id"
   type="integer"
   column="id"
  >
   <generator class="native"/>
  </id>

  <property
   name="Name"
   column="name"
   type="string"
   not-null="false"
   length="50"
  />
  <property
   name="Pwd"
   column="pwd"
   type="string"
   not-null="false"
   length="50"
  />
  <property
   name="Email"
   column="email"
   type="string"
   not-null="false"
   length="50"
  />
 

  <set name="ArticlesByLastUpdateBy" inverse="true" lazy="true">
   <key column="last_update_by"/>
   <one-to-many class="Article"/>
  </set>

  <set name="ArticlesByCreateBy" inverse="true" lazy="true">
   <key column="create_by"/>?font color="#0000ff">q里的create_by是后来修改的QHibernate Sychonizer生成的有错,后面有几处同L错误?/font>
   <one-to-many class="Article"/>
  </set>

  <set name="Boards" inverse="true" lazy="true">
   <key column="create_by"/>【这里的create_by是后来修改的?/font>

   <one-to-many class="Board"/>
  </set>


 </class> 
</hibernate-mapping>

//User.java
package com.lzy.forum.domain;


public class User{
 private static final long serialVersionUID = 1L;

//  primary key
 private java.lang.Integer id;

 // fields
 private java.lang.String name;
 private java.lang.String pwd;
 private java.lang.String email;

 // collections
 private java.util.Set<Article> articlesByLastUpdateBy;
 private java.util.Set<Article> articlesByCreateBy;
 private java.util.Set<Board> boards;
 
 
 public java.util.Set<Article> getArticlesByCreateBy() {
  return articlesByCreateBy;
 }
 public void setArticlesByCreateBy(java.util.Set<Article> articlesByCreateBy) {
  this.articlesByCreateBy = articlesByCreateBy;
 }
 public java.util.Set<Article> getArticlesByLastUpdateBy() {
  return articlesByLastUpdateBy;
 }
 public void setArticlesByLastUpdateBy(
   java.util.Set<Article> articlesByLastUpdateBy) {
  this.articlesByLastUpdateBy = articlesByLastUpdateBy;
 }
 public java.util.Set<Board> getBoards() {
  return boards;
 }
 public void setBoards(java.util.Set<Board> boards) {
  this.boards = boards;
 }
 public java.lang.String getEmail() {
  return email;
 }
 public void setEmail(java.lang.String email) {
  this.email = email;
 }
 public java.lang.Integer getId() {
  return id;
 }
 public void setId(java.lang.Integer id) {
  this.id = id;
 }
 public java.lang.String getName() {
  return name;
 }
 public void setName(java.lang.String name) {
  this.name = name;
 }
 public java.lang.String getPwd() {
  return pwd;
 }
 public void setPwd(java.lang.String pwd) {
  this.pwd = pwd;
 }


}

//Board.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

<hibernate-mapping package="com.lzy.forum.domain">
 <class
  name="Board"
  table="board"
 >
   <meta attribute="sync-DAO">false</meta>
  <id
   name="Id"
   type="integer"
   column="id"
  >
   <generator class="native"/>
  </id>

  <property
   name="Name"
   column="name"
   type="string"
   not-null="true"
   length="50"
  />
  <property
   name="Remark"
   column="remark"
   type="string"
   not-null="false"
   length="255"
  />
  <property
   name="CreateTime"
   column="create_time"
   type="timestamp"
   not-null="false"
   length="19"
  />
  <many-to-one
   name="CreateBy"
   column="create_by"
   class="User"
   not-null="true"
  >
  </many-to-one>
  <many-to-one
   name="Parent"
   column="parent_id"
   class="Board"   
   not-null="false"
   lazy="false">
  </many-to-one>
 

  <set name="Articles" inverse="true" lazy="true" order-by="id">
   <key column="board_id"/>【这里的board_id是后来修改的?/font>
   <one-to-many class="Article"/>
  </set>

  <set name="ChildBoards" inverse="true"  lazy="true" order-by="id">
   <key column="parent_id"/>?/font>q里的parent_id是后来修改的?br />   <one-to-many class="Board"/>
  </set>


 </class> 
</hibernate-mapping>

//Board.java
package com.lzy.forum.domain;

 


public class Board  {
 private static final long serialVersionUID = 1L;

//  primary key
 private java.lang.Integer id;

 // fields
 private java.lang.String name;
 private java.lang.String remark;
 private java.util.Date createTime;

 // many to one
 private com.lzy.forum.domain.User createBy;
 private com.lzy.forum.domain.Board parent;

 // collections
 private java.util.Set<com.lzy.forum.domain.Article> articles;
 private java.util.Set<com.lzy.forum.domain.Board> childBoards;
 
 
 public java.util.Set<com.lzy.forum.domain.Article> getArticles() {
  return articles;
 }
 public void setArticles(java.util.Set<com.lzy.forum.domain.Article> articles) {
  this.articles = articles;
 }
 public java.util.Set<com.lzy.forum.domain.Board> getChildBoards() {
  return childBoards;
 }
 public void setChildBoards(java.util.Set<com.lzy.forum.domain.Board> childBoards) {
  this.childBoards = childBoards;
 }
 public com.lzy.forum.domain.User getCreateBy() {
  return createBy;
 }
 public void setCreateBy(com.lzy.forum.domain.User createBy) {
  this.createBy = createBy;
 }
 public java.util.Date getCreateTime() {
  return createTime;
 }
 public void setCreateTime(java.util.Date createTime) {
  this.createTime = createTime;
 }
 public java.lang.Integer getId() {
  return id;
 }
 public void setId(java.lang.Integer id) {
  this.id = id;
 }
 public java.lang.String getName() {
  return name;
 }
 public void setName(java.lang.String name) {
  this.name = name;
 }
 public com.lzy.forum.domain.Board getParent() {
  return parent;
 }
 public void setParent(com.lzy.forum.domain.Board parent) {
  this.parent = parent;
 }
 public java.lang.String getRemark() {
  return remark;
 }
 public void setRemark(java.lang.String remark) {
  this.remark = remark;
 }


}

//Article.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd " >

<hibernate-mapping package="com.lzy.forum.domain">
 <class
  name="Article"
  table="article"
 >
  <meta attribute="sync-DAO">false</meta>
  <id
   name="Id"
   type="integer"
   column="id"
  >
   <generator class="native"/>
  </id>

  <property
   name="ArticleType"
   column="article_type"
   type="integer"
   not-null="true"
   length="11"
  />
  <property
   name="Title"
   column="title"
   type="string"
   not-null="false"
   length="255"
  />
  <property
   name="Body"
   column="body"
   type="string"
   not-null="false"
  />
  <property
   name="Hits"
   column="hits"
   type="integer"
   not-null="false"
   length="10"
  />
  <property
   name="Bytes"
   column="bytes"
   type="integer"
   not-null="false"
   length="10"
  />
  <property
   name="CreateTime"
   column="create_time"
   type="timestamp"
   not-null="false"
   length="19"
  />
  <property
   name="LastUpdateTime"
   column="last_update_time"
   type="timestamp"
   not-null="false"
   length="19"
  />
  <many-to-one
   name="LastUpdateBy"
   column="last_update_by"
   class="User"
   not-null="true"
  >
  </many-to-one>
  <many-to-one
   name="CreateBy"
   column="create_by"
   class="User"
   not-null="true"
  >
  </many-to-one>
  <many-to-one
   name="Parent"
   column="parent_id"
   class="Article"
   not-null="false"
  >
  </many-to-one>
  <many-to-one
   name="Board"
   column="board_id"
   class="Board"
   not-null="true"
  >
  </many-to-one>
 

  <set name="Articles" inverse="true" lazy="false" order-by="id">
   <key column="parent_id"/>【这里的parent_id是后来修改的?/font>
   <one-to-many class="Article"/>
  </set>


 </class> 
</hibernate-mapping>



//Article.java
package com.lzy.forum.domain;

import java.util.Date;

 


public class Article  {
 private static final long serialVersionUID = 1L;
 // primary key
 private java.lang.Integer id;

 // fields
 private java.lang.Integer articleType;
 private java.lang.String title;
 private java.lang.String body;
 private java.lang.Integer hits;
 private java.lang.Integer bytes;
 private java.util.Date lastUpdateTime;
 private java.util.Date createTime;
 

 // many to one
 private com.lzy.forum.domain.User lastUpdateBy;
 private com.lzy.forum.domain.User createBy;
 private com.lzy.forum.domain.Article parent;
 private com.lzy.forum.domain.Board board;

 // collections
 private java.util.Set<com.lzy.forum.domain.Article> articles;

 public java.util.Set<com.lzy.forum.domain.Article> getArticles() {
  return articles;
 }

 public void setArticles(java.util.Set<com.lzy.forum.domain.Article> articles) {
  this.articles = articles;
 }

 public java.lang.Integer getArticleType() {
  return articleType;
 }

 public void setArticleType(java.lang.Integer articleType) {
  this.articleType = articleType;
 }

 public com.lzy.forum.domain.Board getBoard() {
  return board;
 }

 public void setBoard(com.lzy.forum.domain.Board board) {
  this.board = board;
 }

 public java.lang.String getBody() {
  return body;
 }

 public void setBody(java.lang.String body) {
  this.body = body;
 }

 public java.lang.Integer getBytes() {
  return bytes;
 }

 public void setBytes(java.lang.Integer bytes) {
  this.bytes = bytes;
 }

 public com.lzy.forum.domain.User getCreateBy() {
  return createBy;
 }

 public void setCreateBy(com.lzy.forum.domain.User createBy) {
  this.createBy = createBy;
 }

 public java.lang.Integer getHits() {
  return hits;
 }

 public void setHits(java.lang.Integer hits) {
  this.hits = hits;
 }

 public java.lang.Integer getId() {
  return id;
 }

 public void setId(java.lang.Integer id) {
  this.id = id;
 }

 public com.lzy.forum.domain.User getLastUpdateBy() {
  return lastUpdateBy;
 }

 public void setLastUpdateBy(com.lzy.forum.domain.User lastUpdateBy) {
  this.lastUpdateBy = lastUpdateBy;
 }

 public java.util.Date getLastUpdateTime() {
  return lastUpdateTime;
 }

 public void setLastUpdateTime(java.util.Date lastUpdateTime) {
  this.lastUpdateTime = lastUpdateTime;
 }

 public com.lzy.forum.domain.Article getParent() {
  return parent;
 }

 public void setParent(com.lzy.forum.domain.Article parent) {
  this.parent = parent;
 }

 public java.lang.String getTitle() {
  return title;
 }

 public void setTitle(java.lang.String title) {
  this.title = title;
 }
 public java.util.Date getCreateTime(){
  return createTime;
 }

 public void setCreateTime(java.util.Date createTime) {
  // TODO Auto-generated method stub
  this.createTime = createTime;
 }
 

}

接下来将会在web中加入Spring支持和ؓ实体cL供DAO支持。(未完待箋Q?/font>

all gone 2006-07-18 09:54 发表评论
]]>
EJB 3.0 学习W记——Entity Beanhttp://www.aygfsteel.com/felicity/archive/2006/05/20/47229.htmlall goneall goneSat, 20 May 2006 14:38:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/05/20/47229.htmlhttp://www.aygfsteel.com/felicity/comments/47229.htmlhttp://www.aygfsteel.com/felicity/archive/2006/05/20/47229.html#Feedback4http://www.aygfsteel.com/felicity/comments/commentRss/47229.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/47229.html阅读全文

all gone 2006-05-20 22:38 发表评论
]]>
JavaScript和Applet互相调用http://www.aygfsteel.com/felicity/archive/2006/05/04/44502.htmlall goneall goneThu, 04 May 2006 01:41:00 GMThttp://www.aygfsteel.com/felicity/archive/2006/05/04/44502.htmlhttp://www.aygfsteel.com/felicity/comments/44502.htmlhttp://www.aygfsteel.com/felicity/archive/2006/05/04/44502.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/44502.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/44502.html Java Script 调用 java 可以在网里使用

<script language=javascript>

       document.applet_name.method_name();

</script>

可以?/span> applet q行控制Q也可以?/span> applet q回倹{?/span>

 

 

Java 调用 Java Script

需要导?/span> netscape.javascript.jsobject q个c?/span> Qjre/lib/plugin.jar)

比如Q?/span>

JSObject window=JSObject.getWindow(this);

JSObject window=(JSObject)window.getMember("document");

来获取对当前H口的控制权?/span>

 

当点击链?/span> MakeCall Ӟ会触?/span> Java Script 函数

 

function makeCall(s){

  window.document.ctiApplet.testJavascript(s);

  alert("call maked!");

 }

 

在这?/span> Java Script 函数中, ctiApplet 是一?/span> Applet Q这样完成了 java script 调用

Applet ?/span>

以下?/span> ctiApplet 中的 testJavascript 函数和运行结果,其中又调用了 Java Script ?br /> public void testJavascript(String msg){

      

 

       try {

              // create JSObject

 

                  JSObject.getWindow (this).eval ("javascript:alert('Java Script in Applet!')") ;

       }

       catch (Exception ex) {

              // Error on create JSObject

                  showStatus( "Error call javascript err=" + ex );

       }

 

       System.out.println(msg);

}

 

 

 



all gone 2006-05-04 09:41 发表评论
]]>
EJB 3.0 学习W记——准备工?/title><link>http://www.aygfsteel.com/felicity/archive/2006/03/26/37510.html</link><dc:creator>all gone</dc:creator><author>all gone</author><pubDate>Sun, 26 Mar 2006 15:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/felicity/archive/2006/03/26/37510.html</guid><wfw:comment>http://www.aygfsteel.com/felicity/comments/37510.html</wfw:comment><comments>http://www.aygfsteel.com/felicity/archive/2006/03/26/37510.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/felicity/comments/commentRss/37510.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/felicity/services/trackbacks/37510.html</trackback:ping><description><![CDATA[ <p> <br />在开发EJB3.0 之前Q首先应该去下蝲它的一个实现和一个相应的支持EJB3的服务器Q我下蝲的是jboss-EJB-3.0_RC5-PFD和JBoss 4.0.3SP1 Qjboss-EJB-3.0_RC5-PFD里面有安装说明和一些不错的tutorial?/p> <p>Ҏ安装说明QJBoss 4.0.3SP1中的EJB3实现不是最新的Q应用下载的jboss-EJB-3.0_RC5-PFD中的一些包L换?/p> <p>jboss-EJB-3.0_RC5-PFD中lib目录下的 <br /> (1)ejb3.deployer/<br /> (2)ejb3-clustered-sfsbcache-service.xml<br /> (3)ejb3-interceptors-aop.xml<br /> (4)jboss-aop-jdk50.deployer/<br />拯到jboss-4.0.3SP1/server/all/deploy目录?/p> <p>jboss-EJB-3.0_RC5-PFD中lib目录下的 <br /> (5)jboss-remoting.jar<br /> (6)jboss-serialization.jar<br /> (7)jboss-j2ee.jar<br />拯到jboss-4.0.3SP1/server/all/lib目录?/p> <p> <br />删除jboss-4.0.3SP1/server/all/lib 下的<br /> (1)ejb3-persistence.jar <br /> (2)hibernate3.jar<br /> (3)hibernate-annotations.jar<br /> (4)hibernate-entitymanager.jar<br />和jboss-4.0.3SP1/server/all/deploy下的<br /> (5)jboss-aop.deployer/ <br />到此EJB3 的运行环境准备好了,你可以用jboss-4.0.3SP1\bin\run -c all 试JBoss是否能成功启动?/p> <p>我用的IDE是Eclipse 3.2QJDK 1.5 Qؓ了方便在Eclipse中新Z个User LibraryQEJB3_JBossQ?br />jboss-EJB-3.0_RC5-PFD\lib下的<br /> jboss-j2ee.jar<br />和jboss-EJB-3.0_RC5-PFD\lib\ejb3.deployer下的<br /> ejb3-persistence.jar<br /> jboss-ejb3x.jar<br /> jboss-ejb3.jar<br /> jboss-annotations-ejb3.jar<br /> hibernate3.jar<br /> hibernate-annotations.jar<br /> hibernate-entitymanager.jar<br />d到EJB_JBoss中,现在环境基本上搭好了?/p> <img src ="http://www.aygfsteel.com/felicity/aggbug/37510.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/felicity/" target="_blank">all gone</a> 2006-03-26 23:05 <a href="http://www.aygfsteel.com/felicity/archive/2006/03/26/37510.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JSP 处理MySQL数据库时的中文问?/title><link>http://www.aygfsteel.com/felicity/archive/2005/12/18/24542.html</link><dc:creator>all gone</dc:creator><author>all gone</author><pubDate>Sun, 18 Dec 2005 14:57:00 GMT</pubDate><guid>http://www.aygfsteel.com/felicity/archive/2005/12/18/24542.html</guid><wfw:comment>http://www.aygfsteel.com/felicity/comments/24542.html</wfw:comment><comments>http://www.aygfsteel.com/felicity/archive/2005/12/18/24542.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/felicity/comments/commentRss/24542.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/felicity/services/trackbacks/24542.html</trackback:ping><description><![CDATA[<P>以前遇到JSP 处理MySQL数据库时的中文问题时Q采取的是很W的一U方法,直接用字W串~码转换函数q行转换Q这ơ从|上搜了一下,扑ֈ了一个用Filter的可行方法。在Tomcat 5.5Q?MySQL4.0.16下通过?BR><BR>filtercL码是从网上找的,如下<BR>/**<BR> * <BR> */<BR>package com.lzy;</P> <P>import java.io.IOException;<BR>import javax.servlet.Filter;<BR>import javax.servlet.FilterChain;<BR>import javax.servlet.FilterConfig;<BR>import javax.servlet.ServletException;<BR>import javax.servlet.ServletRequest;<BR>import javax.servlet.ServletResponse;</P> <P>/**<BR> * @author lzy<BR> *<BR> */<BR>public class SetCharacterEncodingFilter implements Filter {<BR> <BR> protected String encoding = null;<BR>    protected FilterConfig filterConfig = null;<BR>    protected boolean ignore = true;</P> <P><BR> /* (non-Javadoc)<BR>  * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)<BR>  */<BR> public void init(FilterConfig filterConfig) throws ServletException {<BR>  // TODO Auto-generated method stub<BR>  this.filterConfig = filterConfig;<BR>     this.encoding = filterConfig.getInitParameter("encoding");<BR>     String value = filterConfig.getInitParameter("ignore");<BR>     if (value == null)<BR>      this.ignore = true;<BR>     else if (value.equalsIgnoreCase("true"))<BR>      this.ignore = true;<BR>     else if (value.equalsIgnoreCase("yes"))<BR>      this.ignore = true;<BR>     else<BR>      this.ignore = false;</P> <P><BR> }</P> <P> /* (non-Javadoc)<BR>  * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)<BR>  */<BR> public void doFilter(ServletRequest request, ServletResponse response,<BR>   FilterChain chain) throws IOException, ServletException {<BR>  <BR>  // TODO Auto-generated method stub<BR>  if (ignore || (request.getCharacterEncoding() == null)) {<BR>   String encoding = selectEncoding(request);<BR>   if (encoding != null)<BR>    request.setCharacterEncoding(encoding);<BR>  }<BR>  chain.doFilter(request, response);<BR> }</P> <P> /* (non-Javadoc)<BR>  * @see javax.servlet.Filter#destroy()<BR>  */<BR> public void destroy() {<BR>  // TODO Auto-generated method stub<BR>  <BR>  this.encoding = null;<BR>     this.filterConfig = null;</P> <P><BR> }<BR> <BR>  protected String selectEncoding(ServletRequest request) {</P> <P>         return (this.encoding); </P> <P>     }</P> <P><BR>}</P> <P>在web.xml 文g中作如下讄Q(我用的是Struts框架Q?BR><filter><BR><filter-name>Encoding</filter-name><BR><filter-class>com.lzy.SetCharacterEncodingFilter</filter-class><BR><init-param><BR><param-name>encoding</param-name><BR><param-value>GBK</param-value><BR></init-param><BR></filter></P> <P><filter-mapping><BR><filter-name>Encoding</filter-name><BR><servlet-name>action</servlet-name><BR></filter-mapping><BR><filter-mapping><BR><filter-name>Encoding</filter-name><BR><url-pattern>*.jsp</url-pattern><BR></filter-mapping><BR><BR><BR>最后,q接数据库时Q用下面的urlQ?BR>jdbc:mysql://localhost:3306/数据库名?useUnicode=true&characterEncoding=GBK</P><img src ="http://www.aygfsteel.com/felicity/aggbug/24542.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/felicity/" target="_blank">all gone</a> 2005-12-18 22:57 <a href="http://www.aygfsteel.com/felicity/archive/2005/12/18/24542.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Spring之Hello Worldhttp://www.aygfsteel.com/felicity/archive/2005/12/14/23948.htmlall goneall goneWed, 14 Dec 2005 14:07:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/14/23948.htmlhttp://www.aygfsteel.com/felicity/comments/23948.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/14/23948.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23948.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23948.html1.下蝲Spring相关的开发包
下蝲地址Q?A >http://sourceforge.net/project/showfiles.php?group_id=73357
有spring-framework-1.2.6-with-dependencies.zipQ一個是spring-framework-1.2.6.zipQ最好下载withQdependencies的,里面有另外一些附加包Q下载后解压~,dist目录下是spring自n的jarQlib目录下是附加的jar?BR>2.新徏Java ProjectQ将spring.jarQdist目录下)和commons-logging.jarQlib目录下)d到project的build path中?BR>3.新徏POJO Beanc:HelloBean
//HelloBean.java
/**
 *
 */
package com.lzy;

/**
 * @author lzy
 *
 */
public class HelloBean{
 
 private String hello;
 
 public void sayHello(){
  System.out.println(this.getHello());
 }

 /**
  * @return Returns the hello.
  */
 public String getHello() {
  return hello;
 }

 /**
  * @param hello The hello to set.
  */
 public void setHello(String hello) {
  this.hello = hello;
 }
 

}


4.新徏文gbean.xmlQ将在这个XML文g中ؓ一个HelloBean的实例的hello属性赋倹{?BR>//bean.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "<beans>
<description>Spring Quick Start</description>
<bean id="helloBean" class="com.lzy.HelloBean">
  <property name="hello">
   <value>hello world</value>
  </property>
</bean>
</beans>

5.新徏试c:TestSpring
//TestSpring.java
/**
 *
 */
package com.lzy;

import java.util.Locale;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * @author lzy
 *
 */
public class TestSpring {

 /**
  * @param args
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  
  ApplicationContext ctx=new FileSystemXmlApplicationContext("bean.xml");
    HelloBean hello=(HelloBean)ctx.getBean("helloBean");
  hello.sayHello();
 }

}


6.q行试c:
    如果没有出错Q输Z会看到“hello world”?BR>



all gone 2005-12-14 22:07 发表评论
]]>
Eclipse下Hibernate入门http://www.aygfsteel.com/felicity/archive/2005/12/10/23253.htmlall goneall goneSat, 10 Dec 2005 04:50:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/10/23253.htmlhttp://www.aygfsteel.com/felicity/comments/23253.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/10/23253.html#Feedback3http://www.aygfsteel.com/felicity/comments/commentRss/23253.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23253.html
1.开发环?
     Eclipse 3.2QMySQL 4.0.16QHibernate3.0
    首先应该安装好Eclipse和MySQLQ此外准备好MySQL的JDBC Driver和Hibernate3.0,相关下蝲地址如下Q?BR>     Eclipse SDKQ?
        http://www.eclipse.org/downloads/index.php 
       MySQL及MySQL的JDBC Driver:
           http://www.mysql.org
       Hibernate:
          http://www.hibernate.org
       此外我还安装了Eclipse的一个Hibernate插gQ?BR>     Hibernate synchronizer
           http://hibernatesynch.sourceforge.net


       Plugin Search:
         http://eclipse-plugins.2y.net/eclipse/search.jsp 

       Hibernate synchronizer插g的安装和配置有问题请直接Google?

     在工E中其实只用CHibernate synchronizer插g的一部分功能QHibernate依赖的相关jar包最好还是手动添加,因ؓ最开始用Hibernate synchronizerd时L发生错误?BR>     下载的Mysql driver和Hibernate包解压羃Q我们需要的只是里面相关的jarQ在Eclipse中新建Mysql_Driver和Hibernate两个user library,mysql-connector-java-3.0.15-ga-bin.jar加入Mysql_Driver中,hibernate3.jarQ?BR>Qlog4j-1.2.11.jarQantlr-2.7.5H3.jarQasm.jarQasm-attrs.jarQcglib-2.1.2.jarQcommons-collections-2.1.1.jarQcommons-logging-1.0.4.jarQdom4j-1.6.1.jarQehcache-1.1.jarQjta.jar加入到Hibernate中?/P>

2.开?
在Mysql中新建test数据库(Mysql其实有个I的test数据库)Q然后新Z面的Table

create table user (
 id int(10) not null auto_increment primary key,
 name varchar(20) not null,
 password varchar(20) not null,
 email varchar(50),
 address varchar(100)
)type=innodb;


新徏Java ProjectQ将Mysql_Driver,Hibernate两个user libraryd到该工程的java build path中?/P>

新徏与数据表对应的POJOc:User和Contact

/**
 *
 * 
 */
package com.user;

/**
 * @author lzy
 *
 */
public class User{
    private Integer id;
    private String name;
    private String password;
    private Contact contact;
   

 /**
  * @return Returns the id.
  */
 public Integer getId() {
  return id;
 }
 /**
  * @param id The id to set.
  */
 public void setId(Integer id) {
  this.id = id;
 }
 /**
  * @return Returns the name.
  */
 public String getName() {
  return name;
 }
 /**
  * @param name The name to set.
  */
 public void setName(String name) {
  this.name = name;
 }
 /**
  * @return Returns the password.
  */
 public String getPassword() {
  return password;
 }
 /**
  * @param password The password to set.
  */
 public void setPassword(String password) {
  this.password = password;
 }
 /**
  * @return Returns the contact.
  */
 public Contact getContact() {
  return contact;
 }
 /**
  * @param contact The contact to set.
  */
 public void setContact(Contact contact) {
  this.contact = contact;
 }
   
   
}
/**
 *
 */
package com.user;

/**
 * @author lzy
 *
 */
public class Contact {
 private String email;
    private String address;

 /**
  * @return Returns the address.
  */
 public String getAddress() {
  return address;
 }
 /**
  * @param address The address to set.
  */
 public void setAddress(String address) {
  this.address = address;
 }
 /**
  * @return Returns the email.
  */
 public String getEmail() {
  return email;
 }
 /**
  * @param email The email to set.
  */
 public void setEmail(String email) {
  this.email = email;
 }
}

之后可以用synchronizer插g生成Hibernate配置文g和映文Ӟ相关q程可以参?A >http://www.ideagrace.com/html/doc/2005/08/01/00315.html)Q不q映文件必ȝ作修攏V?/P>

hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "

<hibernate-configuration>
    <session-factory >

  <!-- local connection properties -->
  <property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
  <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  <property name="hibernate.connection.username"></property>
  <property name="hibernate.connection.password"></property>
  <!-- property name="hibernate.connection.pool_size"></property -->

  <!-- dialect for MySQL -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <property name="hibernate.show_sql">True</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
     <mapping resource="User.hbm.xml"/>


    </session-factory>
</hibernate-configuration>

User.hbm.xml

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD//EN"
 "

<hibernate-mapping package="com.user">
 <class
  name="User"
  table="user"
 >
  <id
   name="Id"
   type="integer"
   column="id"
  >
   <generator class="native"/>
  </id>

  <property
   name="Name"
   column="name"
   type="string"
   not-null="true"
   length="20"
  />
  <property
   name="Password"
   column="password"
   type="string"
   not-null="true"
   length="20"
  />
  <component name="Contact" class="Contact">
   <property
   name="Email"
   column="email"
   type="string"
   not-null="false"
   length="50"
  />
  <property
   name="Address"
   column="address"
   type="string"
   not-null="false"
   length="100"
  />
  </component>
  


 </class> 
</hibernate-mapping>

 

3.试
d一个测试类QHibernateTest

package com.user;

import java.util.List;
import java.util.ListIterator;

import org.hibernate.*;
import org.hibernate.cfg.*;

public class HibernateTest {
    public static void main(String[] args) throws HibernateException {
        SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
       
        //
        //testInsert(sessionFactory);
       
        //
        testQuery(sessionFactory);
       
         
        sessionFactory.close();
       
    }
    public static void testInsert( SessionFactory sessionFactory )throws HibernateException {
     
      Session session = sessionFactory.openSession();
        Transaction tx= session.beginTransaction();
        User user = new User();
        Contact contact=new Contact();
        contact.setEmail("email");
        contact.setAddress("address");
       
        user.setName("caterpillar");
        user.setPassword("password");
        user.setContact(contact);
       
        session.save(user);
        tx.commit();
        session.close();
        System.out.println("OKQ?);
   }
   
    public static void testQuery( SessionFactory sessionFactory )throws HibernateException {
     
     Session session = sessionFactory.openSession();
        Transaction tx= session.beginTransaction();
        User user = new User();
        Contact contact=new Contact();
                 
        Query query=session.createQuery("from User as user");
        //query.setCharacter(1, 'M');
        List names =query.list();
        for(ListIterator it=names.listIterator();it.hasNext();){
           user= (User)it.next();
           System.out.println("Id: " + user.getId());
            System.out.println("name: " + user.getName());
            System.out.println("password: " + user.getPassword());
            if(user.getContact()!=null){
             
             if(user.getContact().getEmail()!=null){
              System.out.println("Email: " + user.getContact().getEmail());
             }
             if(user.getContact().getAddress()!=null){
              System.out.println("Address: " + user.getContact().getAddress());
               
             }
            }
           
           
           
        }
         
      
        tx.commit();
        session.close();
     
    }
}

 

  

 



all gone 2005-12-10 12:50 发表评论
]]>
Eclipse下JSF入门http://www.aygfsteel.com/felicity/archive/2005/12/10/23251.htmlall goneall goneSat, 10 Dec 2005 04:05:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/10/23251.htmlhttp://www.aygfsteel.com/felicity/comments/23251.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/10/23251.html#Feedback2http://www.aygfsteel.com/felicity/comments/commentRss/23251.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23251.html   与Eclipse下Struts的开发类|安装好Eclipse和Tomcat之后Q还需要两个插Ӟtomcat 插g和JSF插gQ如果相x件还没有安装Q,以下是相关下载地址Q?
    Eclipse SDKQ?
        http://www.eclipse.org/downloads/index.php 
    JSF:
     https://sourceforge.jp/projects/amateras/files/  
      FaceIDE+htmlEditorQhtmlEditer也是必要?
    Tomcat :
         http://www.sysdeo.com/eclipse/tomcatplugin 
    Plugin Search:
         http://eclipse-plugins.2y.net/eclipse/search.jsp 
   插g的安装和配置有问题请直接Google?
2.开?
    入门嘛,我们找一个最单的Login可以了

    新徏Tomcat project
    加入JSF支持

    新徏一个ManagedBeanQ?


/**
 *
 */
package com.jsf;




/**
 * @author lzy
 *
 */
public class UserBean {
private String name;
    private String password;
public String verify() {
     if(this.name.equals("name")&&this.password.equals("password"))
     
        return "failure";

   else
        return "success";
}

 
/**
* @return Returns the name.
*/
public String getName() {
return name;
}

/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}


/**
* @return Returns the password.
*/
public String getPassword() {
return password;
}

/**
* @param password The password to set.
*/
public void setPassword(String password) {
this.password = password;
}


}

     新徏两个JSP面Qlogin.jsp,welcom.jsp

login.jsp
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<link href="main.css" rel="stylesheet"/>
<title></title>

</head>
<body>
    <f:view>
    <f:loadBundle basename="com.jsf.MessageResources" var="msgs"></f:loadBundle>
   
        <h:form>
        <h:panelGrid columns="3" headerClass="header" rowClasses="evenRow,oddRow">
        <f:facet name="header" >
        <h:outputText value="#{msgs.header}"/>
        </f:facet>
       
        <h:outputText value="#{msgs.namePromt}"></h:outputText>
        <h:inputText id="name"  required="true" value="#{user.name}">
        <f:validateLength minimum="2" maximum="10"></f:validateLength>
        </h:inputText>
        <h:message for="name" errorClass="errors"/>
       
       
        <h:outputText value="#{msgs.passwordPromt}"></h:outputText>
       
        <h:inputSecret id="password" value="#{user.password}" required="true" redisplay="true">
        <f:validateLength minimum="2"></f:validateLength>
        </h:inputSecret>
        <h:message for="password"/>
       
       
              <f:facet name="footer" >
        <h:outputText value="#{msgs.footer}"/>
        </f:facet>
        </h:panelGrid>          
            <h:commandButton value="#{msgs.submitPromt}" action="#{user.verify}"/>
            <h:commandButton value="#{msgs.resetPromt}" type="reset"/>
        </h:form>
    </f:view>
</body>
</html>



welcome.jsp


<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK"/>
<title></title>
</head>
<body>
    <f:view>
        <h:outputText value="#{user.name}"/>  is a good boyQ?
        <h3>welcome JavaServer Faces</h3>
    </f:view>
</body>

</html>
     ~辑WEBQINF/lib下的facesQconfig.xml

struts-config.xml

<?xml version="1.0"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<faces-config>
<navigation-rule>
        <from-view-id>/login.jsp</from-view-id>
        <navigation-case>
            <from-outcome>success</from-outcome>
            <to-view-id>/welcome.jsp</to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>failure</from-outcome>
            <to-view-id>/login.jsp</to-view-id>
        </navigation-case>
</navigation-rule>


<managed-bean>
<managed-bean-name>user</managed-bean-name>
<managed-bean-class>com.jsf.UserBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>


       最后是资源文g

# --login.jsp--
header=Welcom
namePromt=Name:
passwordPromt=Password:
amountPromt=Amount:
datePromt=Date:
submitPromt=Submit
resetPromt=Reset
footer=Thank you!


3.试
在test工程中选择tomcat projectQ?gt;Update context definition
然后q行Tomcat
http://127.0.0.1:8080/jsfTest/login.jsf

all gone 2005-12-10 12:05 发表评论
]]>
Eclipse下Struts开发入?/title><link>http://www.aygfsteel.com/felicity/archive/2005/12/10/23244.html</link><dc:creator>all gone</dc:creator><author>all gone</author><pubDate>Sat, 10 Dec 2005 03:10:00 GMT</pubDate><guid>http://www.aygfsteel.com/felicity/archive/2005/12/10/23244.html</guid><wfw:comment>http://www.aygfsteel.com/felicity/comments/23244.html</wfw:comment><comments>http://www.aygfsteel.com/felicity/archive/2005/12/10/23244.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/felicity/comments/commentRss/23244.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/felicity/services/trackbacks/23244.html</trackback:ping><description><![CDATA[<P> </P> <P>1.开发环?BR>   开发之前首先应该准备好开发环境,Eclipse 3.X是一个不错的Java IDEQ有很多插g可以供我们选择Q服务器用Tomcatp了。安装好Eclipse和Tomcat之后Q还需要两个插Ӟtomcat 插g和Struts插gQ以下是相关下蝲地址Q?BR>     Eclipse SDKQ?BR>        <A >http://www.eclipse.org/downloads/index.php</A> <BR>    Struts: <BR>     <A >https://sourceforge.jp/projects/amateras/files/</A>         StrutsIDE+htmlEditorQhtmlEditer也是必要?BR>    Tomcat : <BR>         <A >http://www.sysdeo.com/eclipse/tomcatplugin</A> <BR>    Plugin Search: <BR>         <A >http://eclipse-plugins.2y.net/eclipse/search.jsp</A> <BR>   插g的安装和配置有问题请直接Google?BR>2.开?BR>    入门嘛,我们找一个最单的Login可以了</P> <P>    新徏Tomcat projectQ如下图</P> <P>    加入struts支持<BR>    新徏一个FormBean:LoginForm</P> <P><BR>/**<BR> * <BR> */<BR>package com.test;</P> <P>import javax.servlet.http.HttpServletRequest;</P> <P>import org.apache.struts.action.ActionErrors;<BR>import org.apache.struts.action.ActionForm;<BR>import org.apache.struts.action.ActionMapping;<BR>import org.apache.struts.action.ActionMessage;</P> <P>/**<BR> * @author lzy<BR> *<BR> */<BR>public class LoginForm extends ActionForm {</P> <P> private String name=null;<BR> private String password=null;<BR> /* (non-Javadoc)<BR>  * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)<BR>  */<BR> @Override<BR> public void reset(ActionMapping arg0, HttpServletRequest arg1) {<BR>  // TODO Auto-generated method stub<BR>  name=null;<BR>  password=null;<BR> }<BR> /* (non-Javadoc)<BR>  * @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)<BR>  */<BR> @Override<BR> public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {<BR>  // TODO Auto-generated method stub<BR>ActionErrors errors=new ActionErrors();<BR>  <BR>  if(name==null||name.length()<1){<BR>   errors.add("username",new ActionMessage("errors.login.name.empty"));<BR>   <BR>  }<BR>  if(password==null||password.length()<1){<BR>   errors.add("password",new ActionMessage("errors.login.password.empty"));<BR>   <BR>  }<BR>  <BR>  return errors;<BR> }<BR> /**<BR>  * @return Returns the name.<BR>  */<BR> public String getName() {<BR>  return name;<BR> }<BR> /**<BR>  * @param name The name to set.<BR>  */<BR> public void setName(String name) {<BR>  this.name = name;<BR> }<BR> /**<BR>  * @return Returns the password.<BR>  */<BR> public String getPassword() {<BR>  return password;<BR> }<BR> /**<BR>  * @param password The password to set.<BR>  */<BR> public void setPassword(String password) {<BR>  this.password = password;<BR> }<BR>}</P> <P> </P> <P> </P> <P>     新徏一个Action:LoginAction</P> <P>/**<BR> * <BR> */<BR>package com.test;</P> <P><BR>import javax.servlet.http.HttpServletRequest;<BR>import javax.servlet.http.HttpServletResponse;<BR>import javax.servlet.http.HttpSession;<BR>import org.apache.struts.*;<BR>import org.apache.struts.action.Action;<BR>import org.apache.struts.action.ActionForm;<BR>import org.apache.struts.action.ActionForward;<BR>import org.apache.struts.action.ActionMapping;<BR>import org.apache.struts.action.ActionMessage;<BR>import org.apache.struts.action.ActionMessages;</P> <P>/**<BR> * @author lzy<BR> *<BR> */<BR>public class LoginAction extends Action {<BR> public ActionForward execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception {<BR>  // TODO Auto-generated method stub<BR>  LoginForm loginForm=(LoginForm)actionForm;<BR>  String name=loginForm.getName();<BR>  String password=loginForm.getPassword();</P> <P><BR> if(name.equals("name")&&password.equals("password")){<BR>   HttpSession session=request.getSession(true);<BR>   session.setAttribute("LOGGED_USER",name);</P> <P>   <BR>   return mapping.findForward("success");<BR>   <BR>  }<BR>  else{<BR>   ActionMessages errors=new ActionMessages();<BR>   errors.add("login.failure",new ActionMessage("errors.login.failure")); <BR>   this.saveErrors(request,errors);<BR>   <BR>   return mapping.findForward("failure"); <BR>   <BR>  }<BR>  <BR> }</P> <P>}</P> <P>     新徏两个JSP面Qlogin.jsp,index.jsp</P> <P>login.jsp<BR><%@ page contentType="text/html; charset=GBK" %><BR><%@ taglib uri="/tags/struts-html" prefix="html" %><BR><%@ taglib uri="/tags/struts-tiles" prefix="tiles" %></P> <P><html:html><BR> <head><BR>  <html:base /><BR>          </head><BR> <body><BR> <center><BR> <html:errors /><BR>  <html:form action="/login.do" method="POST"><BR>  <table border="1"><BR>   <tr><BR>    <td colspan="2"><bean:message key="login.jsp.form.title"/></td><BR>   </tr><BR>   <tr><BR>    <td align="right"><bean:message key="login.jsp.name"/></td><BR>    <td><html:text property="name" size="20"></html:text></td><BR>   </tr><BR>   <tr><BR>    <td align="right"><bean:message key="login.jsp.password"/></td><BR>    <td><html:password property="password" size="20"></html:password></td><BR>   </tr><BR>   <tr><BR>    <td colspan="2"><BR>     <html:submit><bean:message key="form.submit"/></html:submit><BR>     <html:reset><bean:message key="form.reset"/></html:reset><BR>    </td><BR>   </tr><BR> <BR>  </table><BR> <BR>  </html:form><BR>  <BR> </center><BR> </body><BR></html:html></P> <P><BR>index.jsp</P> <P><BR><%@ page contentType="text/html; charset=GBK" %><BR><%@ taglib uri="/tags/struts-bean" prefix="bean" %><BR><%@ taglib uri="/tags/struts-logic" prefix="logic" %><BR><%@ taglib uri="/tags/struts-html" prefix="html" %><BR><%@ taglib uri="/tags/struts-nested" prefix="nested" %></P> <P><html:html><BR> <head><BR>  <meta http-equiv="Content-Type" content="text/html; charset=GBK"/><BR>  <title></title><BR> </head><BR> <body><BR> hello<BR>  <logic:present name="LOGGED_USER">,<bean:write name="LOGGED_USER"/><BR>  </logic:present><BR> </body><BR></html:html></P> <P><BR>     ~辑WEBQINF/lib下的strutsQconfig.xml</P> <P>struts-config.xml</P> <P><?xml version="1.0"?><BR><!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "<A ><BR><struts-config><BR>  <data-sources><BR>  </data-sources><BR>  <form-beans><BR>    <form-bean name="loginForm" type="com.lzy.LoginForm"/><BR>  </form-beans><BR>  <global-exceptions><BR>  </global-exceptions><BR>  <global-forwards><BR>  </global-forwards><BR>  <action-mappings><BR>      <action path="/login" name="loginForm" type="com.lzy.LoginAction" scope="session" validate="true" input="/login.jsp"><BR>      <forward name="failure" path="/login.jsp"/><BR>      <forward name="success" path="/index.jsp"/><BR>    </action><BR>  </action-mappings><BR>  <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/><BR>  <message-resources parameter="MessageResources"/></P> <P></struts-config></P> <P><BR>       最后是资源文g</P> <P># -- standard errors --<BR>errors.header=<UL><font color="red"><h2>Errors:</h2><BR>errors.prefix=<LI><BR>errors.suffix=</LI><BR>errors.footer=</font></UL><hr></P> <P><BR>form.submit=Submit</P> <P>form.reset=Reset</P> <P><BR># -- login.jsp --<BR>login.jsp.title=Login<BR>login.jsp.form.title=Login<BR>login.jsp.name=Name:<BR>login.jsp.password=Password:</P> <P># -- login errors --<BR>errors.login.name.empty=The name can not be empty!<BR>errors.login.password.empty=The password can not be empty!<BR>errors.login.failure=Login failed!<br> Please check your username and password!</P> <P> </P> <P>3.试<BR>在test工程中选择tomcat projectQ?gt;Update context definition<BR>然后q行Tomcat<BR><A >http://127.0.0.1:8080/test/login.jsp</A></P> <P><BR>   </P><img src ="http://www.aygfsteel.com/felicity/aggbug/23244.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/felicity/" target="_blank">all gone</a> 2005-12-10 11:10 <a href="http://www.aygfsteel.com/felicity/archive/2005/12/10/23244.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java Web Service 之SOAP入门 http://www.aygfsteel.com/felicity/archive/2005/12/09/23204.htmlall goneall goneFri, 09 Dec 2005 11:39:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/09/23204.htmlhttp://www.aygfsteel.com/felicity/comments/23204.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/09/23204.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23204.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23204.html       ~程的hLq么一个爱好,开始的时候总要拿一个HelloWorld似的例子试试Q我也不例外?要试当然要有SOAP的运行环境。按照书上的指示Q装好了TomcatQ下载了相关的包Q将soap.jar ,mail.jar,activatio.jar,xercesImpl.jar 加入C环境变量classpath中,soap.war拯CTOMCAT的webapps目录下?BR>       q行SOAP的测试目录:HTTP://127.0.0.1:8080/soap/发现soap已经正常工作?接着便是部v新的SOAP服务了,按照书上的源码,写好了测试用的部|类和客Lc,~译通过。在部v新的SOAP的web面下按照书上的步骤d表单q|完成。将试所在目录添加到classpath中?重启tomcat?q行刚才~译好的客户端类Q结果NoClassDefError?BR>       试了好几遍,都是q样Q很是让我郁闷啊?看了另一本书《java web服务应用开发详解》终于找C{案Q?q行客户端测试程序时Q?**Client.class是在Package test中的 q行旉回到test的上U目录,java test.***Client 卛_?我想遇到cM问题Q还是对java的包不熟悉?

all gone 2005-12-09 19:39 发表评论
]]>
Eclipse 使用结 http://www.aygfsteel.com/felicity/archive/2005/12/09/23203.htmlall goneall goneFri, 09 Dec 2005 11:38:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/09/23203.htmlhttp://www.aygfsteel.com/felicity/comments/23203.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/09/23203.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23203.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23203.html         Eclipse 是一个基于插件的开发^収ͼ很多功能都是通过插g来完成的。比如说要做Java囑Ş界面开发,如用AWT和SWING的开发,需要下载相应的插gQ因此用Eclipse旉了基本的Eclipse SDKq需要下载安装相应的插g?
下面是一些相关的下蝲地址Q?BR>    Eclipse SDKQ?BR>          http://www.eclipse.org/downloads/index.phpQv3.1.1Q?nbsp; 
  
    SWING+AWT: 
         Visual Editor: http://www.eclipse.org/vep/ (v1.1.0.1 released) 

    Struts: 
         StrutsIDE+htmlEditor: https://sourceforge.jp/projects/amateras/files/( v1.1.7+1.6.7) 
   J2EE: 
         Tomcat : http://www.sysdeo.com/eclipse/tomcatplugin 
         Lomboz: http://forge.objectweb.org/project/showfiles.php?group_id=97 

   JSF:
       faceIDE https://sourceforge.jp/projects/amateras/files/( v1.1.7+1.6.7) 

   Hibernate: 
         Hibernate synchronizer http://hibernatesynch.sourceforge.net

 Plugin Search: 
         http://eclipse-plugins.2y.net/eclipse/search.jsp

all gone 2005-12-09 19:38 发表评论
]]>
JBuilder 开发J2MEE序W一?http://www.aygfsteel.com/felicity/archive/2005/12/09/23202.htmlall goneall goneFri, 09 Dec 2005 11:33:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/09/23202.htmlhttp://www.aygfsteel.com/felicity/comments/23202.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/09/23202.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23202.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23202.htmlConfigure JDKs 之后Q新建工E,选择刚才的jdk? 打开Project->Project Properties,在run 选项卡中点New 在弹出框中选择run, type改ؓMIDlet(原来为Application)? 之后可以新建MIDlet了?

all gone 2005-12-09 19:33 发表评论
]]>
JSP实现留言板的JavaBeancd分页昄的源?http://www.aygfsteel.com/felicity/archive/2005/12/09/23199.htmlall goneall goneFri, 09 Dec 2005 11:30:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/09/23199.htmlhttp://www.aygfsteel.com/felicity/comments/23199.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/09/23199.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23199.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23199.html 

//留言bean
package userinfobean;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class memoBean {

  private String id;//1.用户?BR>  private String email;//2.密码
  private String content;//3.留言 

  public memoBean() {
  }
  //1.用户?BR>  public void setId(String s){
    this.id=s;
  }
  //2.密码
  public void setEmail(String s){
    this.email=s;
  }
  //3.留言
   public void setContent(String s){
    this.content=s;
  }
 

  //1.用户?BR>   public String getId( ){
     return this.id;
   }
   //2.密码
   public String getEmail(){
     return this.email;
   }
   //3.留言 
   public String getContent(){
     return this.content;
   }
}
//// 用于数据库操作的bean          
package userinfobean;

import userinfobean.*;
import java.io.*;
import java.util.*;
import java.sql.*;


public class databaseBean{
  private String dbName;
  private String dbUser;
  private String dbPass;
   private Vector memoVector;

   Connection connection;

  public databaseBean(){
    dbName=new String("×××××××");
    dbUser=new String("××××××");
    dbPass=new String("×××××××");
    String connectionUrl="jdbc:mysql://localhost/"+dbName;
    try{
      Class.forName("org.gjt.mm.mysql.Driver");
      connection=DriverManager.getConnection(connectionUrl,dbUser,dbPass);
    }
    catch(Exception e){
      System.out.println(e.toString());
      }
  }

  public void dbQueryMemos(){
    try{
       memoVector=new Vector();
      Statement stmt=connection.createStatement();
      ResultSet rs=stmt.executeQuery("select * from memo;");
      while(rs.next()){
        memoBean temp=new memoBean();
        temp.setId(rs.getString(2));
        temp.setEmail(rs.getString(3));
        temp.setContent(rs.getString(4));
        memoVector.add(temp);
      }

   }
   catch(SQLException e){
     System.out.println(e.toString());
   }

 

  }

    public void setDbName(String s){
    this.dbName=s;
  }
  public void setDbUser(String s){
    this.dbUser=s;
  }
  public void setDbPass(String s){
    this.dbPass=s;
  }

  public String getDbName(){
    return this.dbName;
  }
  public String getDbUser(){
    return this.dbUser;
  }
  public String getDbPass(){
    return this.dbPass;
  }
    public Vector getMemoVector(){
    return this.memoVector;

  }

}

///以下是网|?BR>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" import="java.util.*" %>
<%@ page  import="java.text.*" %>
<%@ page  import="userinfobean.*" %>
<jsp:useBean id="memoInfo" scope="page" class="userinfobean.memoBean"/>
<jsp:useBean id="memoQuery" scope="page" class="userinfobean.databaseBean"/>
<%!
int totalPages;
int countPerPage=3;
int totalCount;
int currentPage=0;
int currentStart;
%>
<%
memoQuery.dbQueryMemos();
Vector vt=memoQuery.getMemoVector();
totalCount=vt.size();
totalPages=totalCount/countPerPage;
if(totalCount%countPerPage>0)totalPages=totalPages+1;
if(request.getParameter("page")==null)
{
currentPage=1;
}
else
{
currentPage=Integer.parseInt(request.getParameter("page"));
if(currentPage>totalPages)currentPage=totalPages;
if(currentPage<1)currentPage=1;
}
currentStart=totalCount-1-countPerPage * (currentPage-1);
%>
<html>
<head>
<title>NetGreen</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  <link rel="stylesheet" href="main.css">                            
</head>
<script language="JavaScript" >
function page_check()
{
if(document.pageForm.page.value=="")
{alert("误入页?);
document.pageForm.page.focus();
return false;
}
return true;
}</script>
<body bgcolor="ffffff"  >

<center>
  <table width="800" border="0" height="622">
    <tr>
      <td height="71" align="center" valign="middle"> <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#0099CC">
          <tr>
            <td width="19%" height="60" align="left" valign="bottom" bgcolor="#FFFFFF"><b><font size="4" color="#00cc66" ><img src="image/logo.gif" width="156" height="60"></font></b></td>
            <td width="57%" align="left" valign="bottom" bgcolor="#FFFFFF"><img src="image/banner.gif" width="100%" height="60"></td>
            <td width="24%" align="left" valign="bottom"> <table width="102%" height="60" border="1" cellpadding="0" cellspacing="0" bordercolor="#0099CC" bgcolor="#FFFFFF">
                <tr>
                  <td width="50%" height="27" align="center">??lt;/td>
                  <td width="50%" align="center">收藏本页</td>
                </tr>
                <tr>
                  <td height="21" align="center" bgcolor="#FFFFFF" >退 ?</td>
                  <td align="center"><a href="memoForm.htm" target="_self">我要留言</a></td>
                </tr>
              </table></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="31"><table width="100%" border="1" bordercolor="#0099CC">
          <tr bgcolor="#00CC66">
            <td width="12%" height="23" align="center" bgcolor="#CCFFFF"><a href="index.htm" >首页</a></td>
            <td width="12%" align="center" bgcolor="#CCFFFF"><a href="loginForm.htm" >登陆</a></td>
            <td width="12%" align="center" bgcolor="#CCFFFF">&nbsp;</td>
            <td width="12%" align="center" bgcolor="#CCFFFF">&nbsp;</td>
            <td width="12%" align="center" bgcolor="#CCFFFF" >&nbsp; </td>
            <td width="12%" align="center" bgcolor="#CCFFFF">&nbsp;</td>
            <td width="12%" align="center" bgcolor="#CCFFFF"><a href="memoDisplay.jsp" >留言?lt;/a></td>
            <td width="12%" align="center"  bgcolor="#CCFFFF"><a href="registForm.htm">注册</a></td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td height="435" align="center" valign="top" nowrap>
        <table width="100%"  border="1" cellpadding="0" cellspacing="0" bordercolor="#0099CC">
          <tr>
            <td width="18%" height="431" align="center" valign="middle" bgcolor="#CCFFFF">
            </td>
            <td width="83%" align="center" valign="top" bgcolor="#FFFFFF"><table width="100%" border="1"><form name="pageForm" method="post"  onSubmit="return page_check();"action="memoDisplay.jsp">
                <tr>
                  <td width="36%">共有留言<%out.print(totalPages);%> ,现在是第<%out.print(currentPage);%>  ?lt;/td>
                    <td width="64%">
     <a href="memoDisplay.jsp?page=<%=currentPage-1%>" >上一?</a>
     <a href="memoDisplay.jsp?page=<%=currentPage+1%>" >下一?nbsp; </a>
     <a href="memoDisplay.jsp?page=1" >首页 </a>
      <a href="memoDisplay.jsp?page=<%=totalPages%>" >N  </a>
      <input type="submit" name="Submit" value="G0">
                      <input name="page" type="text" size="10">
                      ?lt;/td>
                </tr>
              </form></table>
              <%
    
    for(int i=0;i<countPerPage&&currentStart-i>=0;i++)
    {
     memoInfo.setId(((memoBean)vt.get(currentStart-i)).getId());
     memoInfo.setEmail(((memoBean)vt.get(currentStart-i)).getEmail());
     memoInfo.setContent(((memoBean)vt.get(currentStart-i)).getContent());
     
     
     
   out.print("<table width='100%' border='1' ><tr><td width='19%'>");
   out.print(memoInfo.getId());
   out.print("</td><td width='81%'>");
   out.print(memoInfo.getEmail());
   out.print("</td></tr><tr><td height='44' colspan='2'>");
   out.print(memoInfo.getContent());
   out.print("</td></tr></table> ");
   out.print("<br>");
     
    }
  
   %>
   </td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="73" align="center" valign="top" nowrap>
        <table width="100%" border="0">
          <tr>
            <td height="21" align="center" bgcolor="#FFFFFF"><hr width="85%" noshade  color="#00CC66"></td>
          </tr>
          <tr>
            <td height="12" align="center">Copyright @ HomeLee. All rights reserved.
            </td>
          </tr>
          <tr>
            <td height="12" align="center" bgcolor="#FFFFFF">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
  </table>
  </center></body>
</html>



all gone 2005-12-09 19:30 发表评论
]]>
JDBCq接MySQL数据?http://www.aygfsteel.com/felicity/archive/2005/12/09/23198.htmlall goneall goneFri, 09 Dec 2005 11:29:00 GMThttp://www.aygfsteel.com/felicity/archive/2005/12/09/23198.htmlhttp://www.aygfsteel.com/felicity/comments/23198.htmlhttp://www.aygfsteel.com/felicity/archive/2005/12/09/23198.html#Feedback0http://www.aygfsteel.com/felicity/comments/commentRss/23198.htmlhttp://www.aygfsteel.com/felicity/services/trackbacks/23198.html      查找驱动E序 MySQL目前提供的java驱动E序为Connection/JQ可以从MySQL官方|站下蝲Qƈ扑ֈmysql-connector-java-3.0.15-ga-bin.jar文gQ此驱动E序为纯java驱动E序Q不需做其他配|?
Step2Q?BR>      动态指定classpath 如果需要执行时动态指定classpathQ就在执行时采用Qcp方式。否则将上面?jar文g加入到classpath环境变量中?BR> Step3Q?BR>      加蝲驱动E序
       try{ 
               Class.forName("com.mysql.jdbc.Driver"); 
                System.out.println("Success loading Mysql Driver!"); 
       } 
      catch(Exception e) { 
               System.out.println("Error loading Mysql Driver!");
                e.printStackTrace(); 
        }
Step4Q?BR>        讄q接的url jdbcQmysqlQ?/localhost/databasename[?pa=va][&pa=va]

all gone 2005-12-09 19:29 发表评论
]]>
վ֩ģ壺 | ٰ| | | Ҧ| | Ĭ| | ߰| | | ͭ| ľ| | | | żҿ| ͬ| ¹| ˮ| ˮ| | | | | | | ˮ| ̩| | Ĵʡ| | | | ̩| | | | ʯ¥| | ܿ|