增加机房页面需求之问题汇总

1、删除



需求:点击删除超连接,弹出确认框,确认后删除,否则不动
问题:<a href=" ">删除</a>,怎么用href来动态的确认删除
解决:<a href="javascript:delWarn('<s:property value="#roomList.room_id"/>');">删除</a>
这是超链接,下面是调用的js代码:
function delWarn(roomId)
{
if(confirm("真的要删除该机房吗?\n本操作所删除的不能恢复!!!")==false){
return;
}else{
var form11 = document.forms['frm'];
form11.action = "<s:url value='/liposs/resource/roommanage/action/RoomMagAction!delete.action'/>?roomId="+roomId;
form11.submit();
}

}
注意点:参数用函数的形参传进去。<s:url value=""/>,<s:property value=""/>标签的使用。


2、mapper.xml文件的位置



报错:nested Exception
注意:application中的配置,放包的时候加个sybase包


3、页面编码



问题:页面出现乱码
解决:
jsp页面中设置如下:
<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
在head标签中加入:<meta http-equiv="Content-Type" content="text/html; charset=GBK">


注意:保存的时候编码与页面中设置的要一致,否则会乱码!上面设置为GBK,则保存为ASIN.


4、添加日志

private static final Logger LOG = Logger.getLogger(RoomMagAction.class);
LOG.info("xxx-->"+xxx);


5、xxxDAOImp.java



例子:查询
/**
* 查询机房数据
*/
@Override
public List<Map> getList(Map map, int startRow, int rowNum) {
List<Map> list = null;
try
{
list = getSqlSessionTemplate().selectList(NAMESPACE + ".getList", map,
new RowBounds(startRow, rowNum));
}
catch (Exception e)
{
LOG.error("getList Exception:" + e.getMessage(), e);
}
return list;
}


对应的mapper.xml中的代码:
<!-- 查询机房信息 -->
<select id="getList" parameterType="map" resultType="map">
select 
room_id,
room_name,
staff_id,
remark
from 
tab_room
<where>
<if test="roomId!=null and roomId!=''">
and room_id like '%${roomId}%'
</if>
<if test="roomName!=null and roomName!=''">
and room_name like '%${roomName}%'
</if>
</where>
</select>


注意: <!-- 跳转到编辑 -->
<select id="toEdit" parameterType="String" resultType="map">
select 
room_id,
room_name,
staff_id,
remark
from 
tab_room
where room_id='${_parameter}'
</select>
这里的where后面参数使用的是_parameter,什么时候使用这个参数?而且必须是用户这个参数?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值