ITeye博客

JSP

共 23 篇文章

Form的onsubmit

1. <form class="form" method="post" id="form" onsubmit="return checkForm(this)" action=""> 电话号码:<input id="tel" type="text" maxlength="11" name="tel"/> <button type="submit" name="submit" value="提交"/> </form> function checkForm(o){ var re=/^(13[0-9]{9})|(15[89][0-9]{8})$/; if(!re.test(o.tel.value))…

2015-02-05 11:06 · JS · JSP

使文本框不可编辑[不太常用的方法]

为了使本框不可编辑,我们可以使用下面几种方法 解决思路: 文本框的内容只用来显示而不允许用户随意编辑的时候是很有必要。 方法一:设置<input>标签的readonly属性为true。 <input type="text" value="readonly" readonly=“true"/> 方法二:设置disabled属性为true。 disabled掉后字会变灰,因此第三种方法比较好。 方法三:在对象focus时立刻让它blur,使它无法获得焦点。 <input type="text" onfocus="this.blur()" > onfocus当对象获得焦点时触发。 focus使对象…

2012-09-10 11:17 · JSP

C 标签使用

<title>虚拟机管控</title> <% String hostId = (String)request.getAttribute("hostId"); System.out.println("================================"+hostId); %> <script> var _a='<%=hostId%>'; alert(_a); </script> 关于JSTL标签下面描述或使用正确的是 A.<c:out value=”<test>” escapeXML=”true”> 将会输出 <test>; B.<c:set var=”count” value…

2012-07-26 12:16 · JSP · JSTL

显示结果排序

<td width="9%" style="text-align: center;cursor:hand;" onclick="doSorting('airlineCode');"> <span T:values="@TW航班@@CN航班@@ENAirline@"></span> <script type="text/javascript">showIcon("airlineCode");</script> </td> <td width="17%" style="text-align: center;cursor:hand;" onclick="doSorting('name');"> <…

2012-05-04 14:15 · JSP

select级联操作的简便方法

<script type="text/javascript"> window.onload=function(){ translate(); var continentsSelect = document.getElementById("continents"); var countrySelect = document.getElementById("country"); var citySelect = document.getElementById("city"); continentsSelect.value="AS"; doContinentsChang(continentsSel…

2012-04-18 15:07 · JSP

GuestName处理方法

主要考虑如何设计,如何实现,如何思考! 效果: 数据库: Java代码: List<Map<String,List<Hotelbookpaxdetail>>> groupRoomTypePaxList = new ArrayList<Map<String,List<Hotelbookpaxdetail>>>(); int groupKey = 0; for (Iterator iter1 = paxDetailsSet.iterator(); iter1.hasNext();) { Hotelbookpaxdetail pax = (Hotelbookpaxdetail) iter1.nex…

2012-01-31 10:39 · JSP

[基础]Map在JSP中的两种显示方式

1、 Java: for(EglSpecialRequest req : list){ for(String idStr : ids){ if(StringUtils.isEmpty(idStr)) continue; Integer id = Integer.parseInt(idStr); if(id - req.getId() == 0){ idsMap.put(req.getId(), req.getRequestNameEn()); } } } return idsMap; bookingHotelForm.set("idsMap", idsMap); JSP: <c:forEac…

2011-10-27 09:36 · JSP

JSP自定义标签

实际使用: <td style="text-align: center;"> <b:Call type="com.techson.util.DateUtil" method="dateToStr" var="checkin"> <b:Param paramclass="java.util.Date" value="${vo.checkin}" /> <b:Param paramclass="java.lang.String" value="@dd@-@MMM@-@yy@" /> </b:Call> ${checkin} </td> 输出的日期是Date类型,在dateToStr方法中将其格式…

2011-09-01 12:07 · JSP

[转]如何用div+css布局页面

如今web2.0炒的很厉害,先不去管它web2.0究竟是什么东西,反正div+css好像是火的不行了.各大 知名站点都赶时髦似的把原来的表格布局翻新成了div+css,并美其名曰"本站符合web2.0标准",以便让别人觉得他们的网站用的是最先进的技 术.div布局真有那么先进么?这个问题仍在争论之中.在这里咱们不参与这种无聊的争论,学会它自己感觉一下不就清楚了么? 实际上div布局并不是什么高深的东西,如果你知道一点css就变得更简单了.首先我要说明几点: 1.这里的div并不是我们所说的层,虽然他们的标签都是<div>,在这里你可以把div理 解成一个容器,它可以放文字,图片,表格等等. …

2011-08-01 17:58 · CSS · JSP

iframe总结 + window.open

从frame中跳出并转向: parent.window.location.href = "<%=basePath%>package.do"; 或top.window.location.href = "<%=basePath%>package.do"; <iframe name="myFrame" src="child.html"></iframe> 1、方法调用: 父窗口调用子窗口:myFrame.window.functionName(); 子窗品调用父窗口:parent.functionName(); 2、属性调用: 1、IE中使用方法: 父窗口调用子窗口:iframe_ID.ifram…

2011-06-20 11:47 · JS · JSP · HTML · JSP · Firefox · JavaScript · IE

window.showModalDialog()

window.open() 打开一个普通窗口 window.showModalDialog() 打开一个模态对话框, 必须先关闭它, 才能关闭打开它的父窗口. window.showModelessDialog() 打开一个非模态对话框, 它的存在依赖于打开它的父窗口, 如果父窗口关闭, 此窗口也被关闭. window.showModalDialog(): vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures]) 参数说明: sURL 必选参数,类型:字符串。用来指定对话框要显示的文档的URL。 vArg…

2011-06-01 15:23 · JS · JSP · HTML

一个星期中某一天存在即显示的思路

1、 days: 1,2,3,4,5,6,0 //数据库中的每条数据对应一条记录 或1,2,3,4,0 或5,6 ... rateRecord[rateRecord.length] = (isDayExist(days, 1)==true) ? '<td style="color:#4a6129; width:20px; text-align:center;">M</td>' : '<td style="font-weight:bold;font-size:14px;">&nbsp; </td>'; rateRecord[rateRecord.length] = (isDayExist(da…

2011-05-31 17:48 · JSP · F#

某一模块动态+、—效果的实现

代码(去掉部分css细节,只关注主要功能): <tr> <td><br />Additional charges item(s)</td> </tr> <tr> <td> <table id="additionalItemsPanel" name="additionalItemsPanel" border="0"> <tr> <td width="5%"></td> <td width="29%">Type</td> <td width="1%"></td> <td width="39%">Description</td> <td width="1%"></td> <td width="19…

2011-04-21 11:08 · JSP · C · C++ · J# · jQuery · JSP

批量更新时判断哪个需要更新

<input type="checkbox" id="updateRateDesc" name="updateRateDesc" onclick="clickCheckbox(this,'rDesc')" value="update"/> 该批量复选框选中的情况下,后台可以接收到updateRateDesc的值,说明该模块要批量更新,这样就可以只更新需要更新的模块 String updateRateDesc =request.getParameter("updateRateDesc"); if("update".equals(updateRateDesc)){ tariff = update…

2011-04-06 16:03 · JSP · jQuery

JSP中循环二维数组 + 循环Map

代码如下: <C:forEach items="${array}" var="a"> ${a[0]} ${a[1]} ${a{2]} ${a[3]} ................. </c:forEach> 碰到的问题: http://zhidao.baidu.com/question/141378176、 <!-- 完全迭代 --> <c:forEach items="${map}" var="mymap" > <c:out value="${mymap.key}" /> <c:out value="${mymap.value}" /> </c:forEach> <!-- 根据map的…

2011-04-01 16:46 · JSP · C · C++ · C# · JSP

使用Table的insertRow实现某一模块的复制

实现的效果:点击+号添加一组 JSP页面: <table style="width:100%"> <tr> <td colspan="2" style="font-weight:bold; padding-left:2px; color:red; width:200px; padding-bottom:10px;"> <span style="text-decoration:underline;">Cancellation Policy</span> <input style="width:20px;" class='cancellationPolicy' type="button" val…

2011-03-21 14:16 · JSP · CSS · prototype · jQuery · Firefox · JavaScript

[基础]由复选框实现的批量删除

批量删除: 选中多个复选框: 每一条记录:<input type="checkbox" name="delete" value="${Hotel.id}"/> function doDelete(){ var inputs = document.getElementsByName("delete"); var flag = false; var ids = ""; for(var i =0 ; i<inputs.length;i++ ){ if(inputs[i].checked){ flag = true; if(ids == ""){ ids = inputs[i].value; }el…

2011-03-21 11:31 · JSP

table总结insertRow、deleteRow

表格有几行: var trCnt = table.rows.length; (table为Id ) 每行有几列:for (var i=0; i<trCnt; i++) table.rows[i].cells.length; javascript操作table: insertRow(),deleteRow(),insertCell(),deleteCell()方法 table.insertRow()在IE下没问题 但在firefox下就得改为table.insertRow(-1) 同样其相应的insertCell()也要改为insertCell(-1) insertRow() 方法 定义和用法…

2011-03-16 16:13 · JSP · HTML · Ajax · json · JavaScript · IE

js实现的复选框选中时的批量操作

1. var checkedList = []; // save for all checked box var tmpHotel = new Hotel(); tmpHotel.setHotelId("${item.key}"); checkedList[tmpHotel.getHotelId()] = []; //将每个hotelId对应的行也初始化为一个数组 <td class="htbl_td1_'+tr_border+'"> <input onclick="modifyCheckedList(\''+ hotels[i].getHotelId() +'\', this, '+ ho…

2011-03-04 14:22 · JSP · J#

利用getParameterNames实现一个按钮所有模块数据都提交

1. 总结: 1、注意页面的name为emails.host,这样才可把 group和相应属性分开 2、作为Value的Map需转化为JSON类型数据后再插入数据库 3、把从数据库中读出的数据先转换为JSON类型,再由JSON类型转换为Map类型,最后放入作为Map的Setting中 三个模块共用一个确定按钮! 页面如下: <table class="form-table"> <tr> <td class="label"> 主机: </td> <td> <input type="text" name="emails.host" value="${emails.host}"/> </td> <…

2010-11-27 13:13 · JSP · 正则表达式 · json · SQL · QQ