tianyalinfeng
tianyalinfeng · 共 355 篇文章
hibernate实现翻页
final DetachedCriteria detachedCrit = DetachedCriteria .forClass(Query.class); List<Query> list = getHibernateTemplate().execute( new HibernateCallback() { public List doInHibernate(Session session) throws HibernateException { Criteria criteria = detachedCrit .getExecutableCriteria(session); List i…
struts2 jsp取不到action里对象的属性
user.username user.password 通过表单提交到action里User对象 但action跳转到另一个页面后${user.username}取不到值 必须在跳转之前将user再次加入ActionContext里 ActionContext ac = ActionContext.getContext(); ac.getSession().put("user", user);
2012-07-21 15:48 · Struts · 评论(0)
struts2 if
<s:if test="%{#attr.user.username!=null}">${user.username}</s:if> <s:else><script type='text/javascript'>top.location='login.jsp';</script></s:else> 这里一定要用%{#attr.user.username!=null}这个格式来判断,要加上attr,其他格式的判断结果都不对
2012-07-21 14:58 · Struts · 评论(0)
table样式
body { font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #4f6b72; background: #E6EAE9; } a { color: #c75f3e; } #mytable { width: 700px; padding: 0; margin: 0; } caption { padding: 0 0 5px 0; width: 700px; font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica…
2012-07-20 13:33 · Html · 评论(0)
struts iterator
action List<User> list; 要有get,set方法 jsp中用法 <s:iterator value="list" id='user'> <span id="<s:property value='#user.username' />"><s:property value='#user.username' /></span> <s:property value='#user.password' /> </s:iterator>
2012-07-20 13:26 · Struts · 评论(0)
jquery弹出层里的文本框无法输入内容
$("#div_test").html("<input type='text'/>"); 用上面代码弹出的div里的input无法输入内容(不是所有的浏览器都这样) 原因是部分浏览器里无法获取动态添加的文本框的焦点,所以必须要在上面代码下面添加以下代码 $("input").click(function(){$(this).focus();});
2012-07-19 16:50 · Jquery · 评论(0)
jquery-ui sortable用法
所有的事件回调函数都有两个参数:event和ui,浏览器自有event对象,和经过封装的ui对象 ui.helper - 表示sortable元素的JQuery对象,通常是当前元素的克隆对象 ui.position - 表示相对当前对象,鼠标的坐标值对象{top,left} ui.offset - 表示相对于当前页面,鼠标的坐标值对象{top,left} ui.item - 表示当前拖拽的元素 ui.placeholder - 占位符(如果有定义的话) ui.sender - 当前拖拽元素的所属sortable对象(仅当元素是从另一个sortable对象传递过来时有用) ·参数(参数名 : …
2012-07-18 16:05 · Jquery · 评论(0)
控制div里面span的间距
<div style='border:#E4EDF8 1px solid;padding:5px;line-height:30px;'> <span style='margin:5px;'></span> <span style='margin:5px;'></span> <span style='margin:5px;'></span><br/> <span style='margin:5px;'></span> <span style='margin:5px;'></span> <span style='margin:5px;'></span> </div> div中 padding控制…
2012-07-18 10:32 · Html · 评论(0)
Words of flowers
(Red)Rose - Desire Aloe - Friendship Daisy - Innocence (Striped)Carnation - Faithfulness (Yellow)Rose - Beauty (Orange)Lily - True Love (Blue)Violet - Grief (Yellow)Tulip - Refusal Orchid - Uncertainty Daffodil - Hopeless Love
2012-07-18 08:44 · English · 评论(0)
struts2 提交到action里的数据不会清除
struts2 提交到action里的数据即使在浏览器关掉也不会清除 因此需要在execute函数里用完这些数据后自行清理一些数据 如设置username=null;等 否则会出现错误 例如当系统退出后直接在浏览器请求login,系统仍然可以登录,因为原来的用户名,密码等数据仍然存在于该action类里,并没有被清理掉,这就导致不需要输入用户名密码也能登录系统
frameset里让顶层窗口跳转
top.location="xxx.jsp"; 让父窗口跳转 window.parent.location="xxx.jsp";
2012-07-14 09:59 · Js · 评论(0)
数组转为Set或List
String[] strs = { "ace"``, "boom", "crew", "dog", "eon"; Set<String> set= new HashSet<String>(); Collections.addAll(set, strs ); 转为list也可以用上面方法,同时还可以用 List<String> list= Arrays.asList(strs); 参考: http://www.chahushequ.com/read.bbscs?action=topic&id=402882463a61dbf0013a621cee1e0009&bid=92&fcpage=1&fc…
2012-07-11 11:24 · Java · 评论(0)
Dijkstra最短路径算法
Dijkstra最短路径算法 http://baike.baidu.com/view/7839.htm
Graphics2D去掉drawLine画出来线的锯齿
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING , RenderingHints.VALUE_ANTIALIAS_ON); 去掉锯齿可以使画出来的线条更平滑美观
2012-07-04 15:23 · Java · 评论(0)
java程序生产的图片流输出到jsp在火狐中显示IE中不显示
java程序生产的图片流输出到jsp在火狐中显示IE中不显示 原因 1.老的浏览器只对RGB模式的图片支持较好 2.看下程序里面是否有如下代码,它可能改变了RGB模式 BufferedImage bi = g2.getDeviceConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT);
2012-07-04 14:05 · 评论(0)