`
huang552
  • 浏览: 99637 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

2007-5-25 工作心得

阅读更多

 

在引用样式表时,如果有继承规则关系但又想覆盖原来的规则用现定义的规则的话则加一个 !important
表示提高样式的级别,起到重定规则的作用.
如:


 

当页面显示一条连续的字符时如@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@时,页面会把它看成是一个单
词处理,也就是不会自动换行而会把页面称大,这时只要在页面上加一个样式就OK了

 

  1. style="word-break:break-all;word-wrap: break-word;"  

 



在页面上如果想引用自定义的标签则可以自己写一个
写法如下:
此例是在JSP页面中将"\r\n"替换"
"来显示(存储时有换行,但从数据库读取出来时取是"\r\n"形式,JSP页面
无法解析"\r\n",所以导致无法换行)

首先写一个类

java 代码
  1. package com.kingstargroup.utils;   
  2.   
  3. import org.apache.commons.lang.StringEscapeUtils;   
  4.   
  5. public class StringUtils {   
  6.     
  7.  public static String escapeHtml(String s){   
  8.   String resultString = StringEscapeUtils.escapeHtml(s).replaceAll("\r\n""
    "
    );   
  9.   return resultString;   
  10.  }   
  11.   
  12. }   

然后写一个tld的配置文件ks.tld

xml 代码
  1. <!---->xml version="1.0" encoding="UTF-8"?>  
  2.   
  3. <taglib xmlns="http://java.sun.com/xml/ns/j2ee"  
  4.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5.     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"  
  6.     version="2.0">  
  7.     <tlib-version>1.0tlib-version>  
  8.     <short-name>ksshort-name>  
  9.     <uri>http://www.kingstargroup.com/uri>  
  10.     <tag>  
  11.         <name>invokename>  
  12.         <tag-class>  
  13.             com.kingstargroup.web.taglib.InvokeMethodTag   
  14.         tag-class>  
  15.         <body-content>emptybody-content>  
  16.         <attribute>  
  17.             <name>namename>  
  18.             <required>truerequired>  
  19.             <rtexprvalue>truertexprvalue>  
  20.         attribute>  
  21.         <attribute>  
  22.             <name>varname>  
  23.             <required>falserequired>  
  24.             <rtexprvalue>truertexprvalue>  
  25.         attribute>  
  26.         <attribute>  
  27.             <name>methodname>  
  28.             <required>truerequired>  
  29.             <rtexprvalue>truertexprvalue>  
  30.         attribute>  
  31.     tag>  
  32.     <function>  
  33.         <name>escapeHtmlname>  
  34.         <function-class>com.kingstargroup.utils.StringUtilsfunction-class>  
  35.         <function-signature>java.lang.String escapeHtml(java.lang.String)function-signature>  
  36.     function>    
  37. taglib>  


上面的配置文件中有一个标签的配置和一个函数的配置,我们在此以function为例
标签已经写完,只要在需要用到此标签的页面上导入就行了
<!---->

uri="http://www.kingstargroup.com/"与ks.tld配置文件的http://www.kingstargroup.com/相关联

用法:${ks:escapeHtml(content)}

 


xml 代码
  1. <pre>中间内容按原格式显示pre>  

 


 在页面上想获得父类窗体的标签

js 代码
  1.   
  2. parent.document.getElementById('frame1').src=""/>?subId="+subid;  

 

 
java 代码
  1. action的返回可以NEW一个   
  2.   
  3. return new ActionForward("/datapointShowByFunctionId.do?id="+ functionid);  

 


在Action中可以直接 new  RedirectingActionForward  进行跳转

return new RedirectingActionForward("/datapoint/tablemanage.do?tablename="+createname+"&tableId="+tableId+"&method=loadTolist&view=no");


 ${param.id}   加了param则是从URL中取值。


 

设置一个高度,如果超过一个高度以后会变滚动条

<div style="height: 200px; overflow: auto;"> </div>

 

 

在JSP页面中

document.getElementById("college").value = "<c:out value="${collegeid}"/>";//不能赋值

document.forms[0].college.value = "<c:out value="${collegeid}"/>";//可以赋值

 

 

 

 

 

 ConcurrentModificationException主要原因及处理方法

 

List list = Activity.getIdAndNamesForView(subject, organization); Iterator it = list.iterator(); while(it.hasNext()){ Map map = (Map)it.next(); String activityId = map.get("id").toString(); List objectList = EvaObject.getIdAndNames(activityId,organization==null?"":organization.getId()); if(objectList.isEmpty()){ it.remove();//不能用list.remove(list.indexOf(map)); } }
写道
当使用 fail-fast iterator 对 Collection 或 Map 进行迭代操作过程中尝试直接修改 Collection / Map 的内容时,即使是在单线程下运行, java.util.ConcurrentModificationException 异常也将被抛出。   Iterator 是工作在一个独立的线程中,并且拥有一个 mutex 锁。 Iterator 被创建之后会建立一个指向原来对象的单链索引表,当原来的对象数量发生变化时,这个索引表的内容不会同步改变,所以当索引指针往后移动的时候就找不到要迭代的对象,所以按照 fail-fast 原则 Iterator 会马上抛出 java.util.ConcurrentModificationException 异常。   所以 Iterator 在工作的时候是不允许被迭代的对象被改变的。但你可以使用 Iterator 本身的方法 remove() 来删除对象, Iterator.remove() 方法会在删除当前迭代对象的同时维护索引的一致性。

 

 

从URL中取值

${param.subid}

 

struts

<form-bean name="articleForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="article" type="com.kingstargroup.content.domain.Article" /> </form-bean>

 action

Catalog catalog = (Catalog) PropertyUtils.getProperty(form, "catalog");

 

String filePath = this.getServlet().getServletContext().getRealPath("/");// 取当前系统路径 String filePath = request.getRealPath("//");// 取当前系统路径

 

 

ec:table在列中加calc="total" 和calcTitle="合计"可以在最后一行显示此列的合计

<ec:column property="rs" title="听课人次" calc="total" format="0" cell="number" calcTitle="合计"/>

 

 

中文问题 java的转码 URLEncoder.encode(name, "UTF-8")

js的转码 encodeURI 方法将文本字符串编码为一个有效的统一资源标识符 (URI)。 encodeURI 方法返回一个编码的 URI。如果您将编码结果传递给 decodeURI,那么将返回初始的字符串。encodeURI 方法不会对下列字符进行编码:":"、"/"、";" 和 "?"。请使用 encodeURIComponent 方法对这些字符进行编码。例:

JSP页面传值码乱问题

ifra.src="${ctx}/data/supervision/xspj.do?method=char_fx&fx="+encodeURI(document.getElementById("fx").value);

 

 

 

 








 








 

 

 java.text.DecimalFormat 各种格式的转换








oracle 将&替换为'||chr(38)||'

 

 

 

 

用户和表空间建好后导入20080822.dmp数据
imp userid=root/root@oracle_localhost fromuser=root touser=root file=c:/20080703.dmp

 



  


  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics