posts - 4, comments - 10, trackbacks - 0, articles - 2

2007年7月5日

structs2 的 if标签怎么做判断???请各位帮帮看看!!!谢谢了.
我在jsp里写

 <s:label label="中文名" value="${artistVO.chineseName}"/>

我要在页面输出"中文名"的时候,做一个判断,就是中文名不是 "无"或"缺" 的时候再输出.
用<s:if test="">该怎么写?
structs2文档里有一段关于<s:if test="">的例子

<s:if test="'foo' in {'foo','bar'}">
   muhahaha
</s:if>
于是我照葫芦画瓢
 <s:if test="${'artistVO.chineseName' not in {'null','','无','缺','未知'}}">
 <s:label label="中文名" value="${artistVO.chineseName}"/>
</s:if>

没有中文的时候还都正确,遇到中文的时候就不对了.这难道是中文问题吗?


posted @ 2007-07-05 16:39 samfree 阅读(2021) | 评论 (2)编辑 收藏

2007年4月23日

我在用hibernate对mysql进行分页的方法
/**
  * 函数说明:获得所有的信息
  * 参数说明:
  * 返回值:信息的集合
  */
 public List getProducts(final int pageSize, final int startRow) throws HibernateException { 
     return this.getHibernateTemplate().executeFind(new HibernateCallback(){

         public Object doInHibernate(Session session) throws HibernateException, SQLException {
        
             Query query=session.createQuery("FROM Products as p");
             query.setMaxResults(pageSize);
             query.setFirstResult(startRow);    
    
             List list = query.list();
       
             return list;
         }
        });

 }

运行时怎么老给出异常阿?请帮帮我看看好吗?
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.SQLGrammarException: could not execute query
java.sql.SQLException: Syntax error or access violation,  message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '40 products0_.game_id as game1_0_, products0_.game_name_en as game2_0_, products' at line 1"

posted @ 2007-04-23 15:11 samfree 阅读(2198) | 评论 (5)编辑 收藏

2007年1月24日

最近使用ant时,遇到了一个小难题,在一个名为冰浪的blog的提示下解决了.现在把它贴出来.
首先判断cvs下有没有tag文件,如果有,就copy到当前目录,如果没有就调用java类创建,并写入当前
日期,然后在copy
<condition property="exist.tag"> 
    <and> 
        <available file="Tag" filepath="CVS/"/> 
    </and>
</condition>
<target name="copytag" if="exist.tag"> 
    <copy file="CVS/Tag" todir="temp"/>
</target>
<target name="createtag" unless="exist.tag" depends="copytag"> 
    <java classname="com.xxx.pub.Tag">
        <classpath>
              <pathelement location="${build}"/>          
         </classpath>
    </java>
 <copy file="Tag" todir="temp" failonerror="false"/>
</target>

posted @ 2007-01-24 14:57 samfree 阅读(1129) | 评论 (0)编辑 收藏

2007年1月4日

我现在做一个socket客户端的接口,有这么一个问题。
1,如果在30秒内接收到服务器端返回的消息,就认为是一次成功的连接。否则断开此次连接
2,采用短连接方式。即每次往服务器端发消息都建立一次连接
3,每个发送请求最多允许3次连接。
问题:怎样判断30秒内没有接收到消息和收到消息时没有超出30秒就断开连接呢?
        请给小弟一个思路吧。

posted @ 2007-01-04 17:58 samfree 阅读(929) | 评论 (3)编辑 收藏