JBOSS 点滴

丰丰的博客

#

StringTokenizer 类

http://www.leftworld.net/online/j2sedoc/javaref/java.util.stringtokenizer_dsc.htm

StringTokenizer 类允许一个应用把字符串分解成一个个标记。标记化方法比 StreamTokenizer 类使用的方法简单的多。 StringTokenizer 方法不区分标识符、数字和引用字符串,它们也不识别和跳过注释。

下面是一个使用 tokenizer 的例子。代码:

     StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
println(st.nextToken());
}

打印下列输出结果:

     this
is
a
test
通过编码找名称:
   <tr>
        <td align="left" bgcolor="#ececf4">丙方单位</td>
        <td colspan="3" align="left" bgcolor="#FFFFFF">
  <%
   String gs_bfs="";
         if(!CM.getAttrValue("gs_bf").equals("")){
     String tmpStr="";
        StringTokenizer Str = new StringTokenizer(CM.getAttrValue("gs_bf"),",");
     while(Str.hasMoreTokens()){
                  sql="select dwmc from HT_DW where dw_code='" + Str.nextToken() + "'";
                  rsVector1 = CCommonDAO.select(sql,"ESYSDATACON");
      if(rsVector1.size()>0){
                     CM1=(CommonModel)rsVector1.elementAt(0);
                     tmpStr =CM1.getAttrValue("dwmc");
      }
                   gs_bfs +=tmpStr+",";
     }
     out.println(gs_bfs.substring(0,gs_bfs.lastIndexOf(",")));
  }
  if(!gs_bf_mc.equals("")){
   gs_bfs=gs_bf_mc;
   out.println(gs_bfs);
  }
  %>
  &nbsp;
  </td>
      </tr>

posted @ 2009-11-12 11:04 半导体 阅读(112) | 评论 (0)编辑 收藏

复选框传值

复选框全选,全不选,反选
<SCRIPT Language="JavaScript">
<!--
var put=document.getElementsByName("checkboxName");
//全选
function selall(){
 for (i=0;i<put.length;i++){
   put[i].checked=true;
 }
}

//全不选
function Nselall(){
 for(i=0;i<put.length;i++){
   put[i].checked=false;
 }
}
//反选
function selfx(){
 for(i=0;i<put.length;i++){
   put[i].checked=(put[i].checked)?false:true;
 }
}
//复选框取值
function getValue(){
var materialArray=new Array();
var j=0;
for (i=0;i<put.length;i++){
    if(put[i].checked){
       materialArray[j]=put[i].value;
       j++;
     }
 }
}
 -->
</SCRIPT>

 

后台的取值方法:

String no[] = request.getParameterValues("no");

posted @ 2009-11-04 16:48 半导体 阅读(247) | 评论 (0)编辑 收藏

javascript insertAdjacentHTML

下面的例子使用 INPUT type=checkbox 元素创建了两个带有解释文本的复选框。onclick 事件将调用两个脚本函数。第一个复选框默认选中。

This example uses the INPUT type=checkbox element to create two check boxes with explanatory text. The onclick events call two script functions. The first check box is checked.

<INPUT TYPE=checkbox CHECKED ID=chk1 onclick="choosebox1()">Uncheck 
    this check box for some free advice.
<P><INPUT TYPE=checkbox ID=chk2 onclick="choosebox2()">Or check 
    this check box for a message from our sponsors.
<P ID=SampText>

下面的例子就是用户单击复选框时调用的脚本。

This example implements the script when the user clicks either check box.

<SCRIPT>
function choosebox1(){
  alert("Never play leapfrog with a unicorn!")
}
function choosebox2(){
 SampText.insertAdjacentHTML("AfterBegin","Buy WonderWidgets! ");当点击复先框时,在复选框后自动增加语句Buy WonderWidgets
}
</SCRIPT>

posted @ 2009-11-04 16:04 半导体 阅读(212) | 评论 (0)编辑 收藏

Unhandled Exception thrown: class java.lang.ClassCastException

14:12:25,309 WARN  [RequestProcessor] Unhandled Exception thrown: class java.lang.ClassCastException
14:12:25,309 ERROR [[action]] Servlet.service() for servlet action threw exception
java.lang.ClassCastException: org.apache.struts.action.DynaActionForm
 at com.hs.standardbill.struts.action.FbtestAction.queryList(FbtestAction.java:115)
 at com.hs.standardbill.struts.action.FbtestAction.execute(FbtestAction.java:58)
 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at com.hs.util.common.HSCharsetFilter.doFilter(HSCharsetFilter.java:24)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
 at java.lang.Thread.run(Thread.java:595)
解答:
            DynaValidatorForm df = (DynaValidatorForm)form;运行这句的时候报的。
          此form非这种form
          XML文件中DynaActionForm  这个form并没有配置为ValidationForm

posted @ 2009-11-04 14:32 半导体 阅读(1497) | 评论 (0)编辑 收藏

Not all named parameters have been set:

org.hibernate.QueryException: Not all named parameters have been set: [testv] [select ps.id.hsxmCode,ps.id.spwjCode,ps.mc,ps.lx,ps.parentCode,ps.sfdc,ps.jhStart,ps.jhEnd,ps.sjStart,ps.sjEnd,ps.shdw,ps.shzt,ps.wcbl,ps.flagWc from PubSpwj as ps  where 1=1  and ps.id.hsxmCode=:hsxmCode  and ps.shzt=:testv  order by ps.id.spwjCode]
 at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:115)
 at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:102)
 at org.hibernate.impl.QueryImpl.list(QueryImpl.java:70)
 at com.hs.busimanage.buildprocess.business.EditBProcessBO.queryProcessList(EditBProcessBO.java:78)
 at com.hs.busimanage.buildprocess.struts.action.BProcessListAction.queryBProcessList(BProcessListAction.java:85)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
 at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
 at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
 at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
 at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
 at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at com.hs.util.common.HSCharsetFilter.doFilter(HSCharsetFilter.java:24)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
 at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)

解决办法:在BO里赋查询条件语句:
  if(testv!=null&&!testv.equals("")) query.setParameter("testv",testv);
   ls=query.list();

posted @ 2009-10-29 17:51 半导体 阅读(5756) | 评论 (0)编辑 收藏

javascript中数字的比较和Double、Float比较

1,符点型比较:
if ((new Number(separate_num)).valueOf() > (new Number(can_num)).valueOf()){
}
2,整型比较:t
if (parseInt(myform.t2.value) > myform.t1.value){
3,parseFloat(myform.t2.value)

Double、Float比较
Double.parseDouble("1078.2564");
结果:1078.2564
Float.parseFloat(("1078.2564");
结果:1078.2563
谁能告诉我为什么?

posted @ 2009-10-13 14:38 半导体 阅读(1484) | 评论 (1)编辑 收藏

struts错误

错误提示:
Cannot retrieve definition for form bean null on action ,
说明你的bean是空的, 并没有把formbean映射到action中,
同普通ActionForm一样,Action类和JSP都可访问动态ActionForm,而访问方法也基本一致。访问动态ActionForm与访问普通ActionForm的最大区别在于对属性的访问方式不同。在标准ActionForm中,针对每个属性都提供了getter和setter方法,来读取和设置属性。而DynaActionForm把所有的属性保存在一个Map对象中,因此访问DynaActionForm中的属性与访问Map对象中的方法类似.

<action path="/addComment" scope="request" type="angus.action.CommentLinkAction">
这里缺少了一个name="commentForm"

如下:
<action path="/addComment" name="commentForm" scope="request" type="angus.action.CommentLinkAction">

posted @ 2009-10-12 12:02 半导体 阅读(145) | 评论 (0)编辑 收藏

关闭IE窗口时自动弹出信息

关闭IE窗口时执行事件

<script language="javascript">
 //关闭窗口时自动退出
 function  window.onbeforeunload(){
  if(event.clientX>360&&event.clientY<0||event.altKey){  
   //alert("dddddddddd");
   Logout();
  }  
 }  
 function  Logout(){  
     try{  
     xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");  
     }catch(e){  
     xmlHttp = new XMLHttpRequest();  
     }  
     //数据传输,flase为非异步方式
     xmlHttp.open("post","enter.asp?Active=Logout",true);  
     xmlHttp.send(null);  
 }  
</script>  

 

posted @ 2009-09-28 15:11 半导体 阅读(264) | 评论 (0)编辑 收藏

HTML应用

链接指向:
<li><a href="#animate">Find me:Animate </a></li>

<h2 id="animate">Animate me</h2>

posted @ 2009-09-27 16:18 半导体 阅读(190) | 评论 (0)编辑 收藏

明宇报表参数设置

1,  问题:第一页的东西显示完了,第二页的东西在第一页的结尾显示。
     答案:设置PrintToPrevPage属性为true 
2,问题:行高可否根据内容多少来自动控制。
   答案:选中文本框-右键-自动折行、伸展
         然后选中文本框所在的band-伸展 

         设置了伸展的band上每一个文本框都设置伸展 

posted @ 2009-09-22 10:45 半导体 阅读(177) | 评论 (0)编辑 收藏

仅列出标题
共27页: First 上一页 13 14 15 16 17 18 19 20 21 下一页 Last