加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

积累

发布时间:2020-12-14 02:05:21 所属栏目:百科 来源:网络整理
导读:s:property标签的escape属性默认值为true,即不解析html代码,直接将其输出。 若想要输出html的效果,则要改为false a href="javascript:history.go(-1);"后退/a a href="javascript:history.go(1);"前进/a select * from tab_content_info where con_id = (
<s:property>标签的escape属性默认值为true,即不解析html代码,直接将其输出。
若想要输出html的效果,则要改为false

<a href="javascript:history.go(-1);">后退</a>
<a href="javascript:history.go(1);">前进</a>


select * from tab_content_info where con_id = (
select c.n
from
(select con_id,lag(con_id,1,0)over(order by con_id) as n from tab_content_info) c where c.con_id=3010)
查询当前id3010的前一条记录


select * from tab_content_info where con_id = (
select c.n
from
(select con_id,lead(con_id,0)over(order by con_id) as n from tab_content_info) c where c.con_id=3010)
后一条记录


@SuppressWarnings可以抑制一些能通过编译但是存在有可能运行异常的代码会发出警告,你确定代码运行时不会出现警告提示的情况下,可以使用这个注释。
("serial") 是序列化警告,当实现了序列化接口的类上缺少serialVersionUID属性的定义时,会出现黄色警告。可以使用@SuppressWarnings将警告关闭


document.getElementById("xxlb").value= ${cct.ctid};


直接选择下拉列表项

过滤HTML标签
//正则表达式过滤html标签
for (int i = 0; i <lc.size(); i++) {

String htmlStr=lc.get(i).getTitle();
java.util.regex.Pattern p_html;
java.util.regex.Matcher m_html;
String regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式
p_html = Pattern.compile(regEx_html,Pattern.CASE_INSENSITIVE);
m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); //过滤html标签
lc.get(i).setTitle(htmlStr);

}


如何删除CKEditor中自动添加的段落P标签去除CKEditor自动添加的<p></p>标签的方法,其实很简单,有两种办法:

1.在ckeditor目录下的config.js添加以下配置参数即可:

config.enterMode = CKEDITOR.ENTER_BR;

config.shiftEnterMode = CKEDITOR.ENTER_P;

2.直接更改编辑器默认模式为源代码模式,在ckeditor目录下的config.js添加以下配置:

config.startupMode = ‘source’;

生成表的时候出现 标示符无效
查看表中是否用了关键字。。


:@OneToOne or @ManyToOne on vo.StuCour.student references an unknown entity: vo.Student

解答:错误原因(1):配置文件没有添加映射
方法:加上配置:在hibernta.hfg.xml<mapping class="vo.Student"/>
错误原因(2):在实体类public class ClassName上面没有加实体注解,
方法:加上注解:@Entity
@Table(name = "Student",catalog = "sms")

Student student = (Student)query.uniqueResult(); //当确定返回的实例只有一个或者null时 用uniqueResult()方法


这两个方法,是数据类型转化的方法。
intValue()
如Integer类型,就回有intValue()方法意识是说,把Integer类型转化为Int类型。其他类似,都是一个意思
valueOf()
如String就有valueOf()方法,意识是说,要把参数中给的值,转化为String类型,Integer的valueOf()就是把参数给的值,转化为Integer类型。其他类似,都是一个意思。


java注解
当查询两个表之间的关联的时候
第一种方法 用left join 查出来的是一个对象 可以直接取值
String hql = "from Log l left join fetch l.logtype where l.id="+id+"";
List li = super.getHibernateTemplate().find(hql);
Log log =(Log)li.get(0);


第二种方法 用拼接条件 查出来是两个对象 需要先转换成object数组 然后再取对象。


String hql = "from Log l,LogType t where l.logtype.id=t.id and l.id="+id+"";
List li = super.getHibernateTemplate().find(hql);
Object [] obj = (Object[])li.get(0);
Log log =(Log)obj[0];


判断一个集合是否为空
<s:if test="user.isEmpty()">
暂无数据
</s:if>
<s:else>
    
</s:else>
判断一个对象是否为空

<s:if test="user==null">
暂无数据
</s:if>

<s:else>
    
</s:else>


No result defined for action com.test.action.UserAction and result input


遇到这个错误 首先检查 前台传的值是否为字符。 比如 uid=‘66’


然后再检查struts配置文件。。。


异常错误:org.hibernate.HibernateException: No Hibernate Session bound to thread,and configuration does not allow creation of non-transactional one here
没有配置事物通知方法。


ActionContextClearUp
ActionContextClearUp其实是Defer ClearUP.作用就是延长action中属性的生命周期,包括自定义属性,以便在jsp页面中进行访问,让actionContextcleanup过滤器来清除属性,不让action自己清除。

另外注明一下UtilTimerStack的push和pop是用来计算调用方法所执行的开始和结束时间,用来做性能测试的。用法如下:

String timerKey = "ActionContextCleanUp_doFilter: ";
UtilTimerStack.setActive(true);
UtilTimerStack.push(timerKey);
//调用要测试的方法。
UtilTimerStack.pop(timerKey);


oracle创建表时:ORA-00904: : 标识符无效

关键字问题 使用了保留字,必须用的话就用引号吧



Struts Spring com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1

严重: Exception starting filter struts2
Class: com.opensymphony.xwork2.spring.SpringObjectFactory
File: SpringObjectFactory.java
Method: getClassInstance
Line: 220 - com/opensymphony/xwork2/spring/SpringObjectFactory.java:220:-1


解决方法:把struts2-spring-plugin-2.2.3.jar.删除就可以!!!如果不删除这个jar包 就必须的配置spring监听

取得两个List的交集,retainAll()方法

//判断截取字符串并处理中文和数字、英文总长度 保持一致
function jqlen(len,zf){
var t =0;
var xzf='';
var s=zf.split("");
for(var i=0;i<s.length;i++){
if(t<=len){
//判断是否是英文
if(s[i].charCodeAt(0)<299){
t++;
}else{
t+=2;
}
xzf=xzf+s[i];
}else{
break;
}
if(t>len){
xzf+="...";
}
}
return xzf;
}
function jszf(s){
$("["+s+"]").each(function(){
this.innerHTML=jqlen(26,this.innerHTML);
});
}

<a ss="a" ></a>
<script >
jszf("ss=a");
</script>

//获取当前鼠标点击的位置
var lefts = $(obj).offset().left;
var tops = $(obj).offset().top;
//div showdiv延迟1秒后隐藏 jquery
$("#showdiv").delay(1000).hide(0);
BeanUtils.copyProperties(tm,ttt);//复制实体类
style = "word-wrap:break-word;" 换行样式

如果form表单正常情况下 提交不了 抛异常
解决办法是查看自己设置的name属性值 与 后台实体属性的类型是否一致。
//获取一个字符串中有多少个1
String content = "1_2,1_3,1_4,2_1,2_2";
int count = 0;
if(null != content && !"".equals(content)){
Pattern p = Pattern.compile("2_");
Matcher m = p.matcher(content);
while (m.find()) {
count++;
}
System.out.println(count);
}
//获取项目路径
String path = System.getProperty("user.dir")+" src";
System.out.println(path);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读