云游网项目中遇到问题与解决方法.doc
文本预览下载声明
//举个例子,如果要把类似于 2005-06-15 的字符串转换成日期型格式的话,可以采用下面的方法:
var arys = new Array();
var str = ‘2005-06-15’
arys = str.split(‘-’);
var myDate = new Date(arys[0],arys[1],arys[2]);
//把日期型转换成字符串的方法
var myDate = new Date();
year = myDate.getFullYear();
month = myDate.getMonth();
date = myDate.getDate();
var str = year+‘-’+month+‘-’+date;
var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; //验证邮箱的正则表达式
判断if(!reg.test(输入的内容))
{
alert(邮箱格式不对);
return false;
}
s:select id=select name=select list=newsTypeList listKey=id listValue=typename
headerKey=1 headerValue=--请选择父类别-- /
// list 下拉框的值 listKey下拉框的值 listValue下拉框要输出显示值
//headerKey默认值 headerValue默认显示值
给select下拉框赋值:
$(#select).val(值);
//给单选按钮赋值
s:radio list=#{0:中文,1:英文} name=products.languagetype/
// 获取单选框的值
var languagetype=$(input[name=products.languagetype]:checked).val();
//验证是否选中
if(typeof(languagetype)==undefined ||languagetype==null){
alert(请选择语言类型!);
return;
}
s:radio name=student.sex list=%{#{男:男,女:女}} value=男 label=性别/s:radio
注:大括号中的一对男:男,前面的”男“写入到数据库,后面的”男“在页面显示,”女“依此类推。
value=男,表示radio的默认值为“男”,注意双引号下的单引号不能去掉。
表单内部属性的回显
加上value属性,如:
textarea id=t1 name=t1 value=%=request.getParameter(t1) ==null?:request.getParameter(t1)%/textarea
修改list对象的输出格式s:property value=phoneNums.replaceAll(,, + + ) escape=false /
跨库拷贝数据库内容
update yunnantourism.test, yunnantourism1.test set yunnantourism.test.test3 = yunnantourism1.test.test3
where yunnantourism.test.test2 = yunnantourism1.test.test2
ref元素是用在property中,来设置需要引用的容器管理的其它Bean。
动态调用两种方式:
Action节点的method
/contextPath/actionName!login.acion
Select表单值的显示问题 select name=room.breakfast id=breakfast
option value=无 s:if test=room.breakfast==无selected=selected/s:if无
/option
option value=单早 s:if test=room.breakfast==单早selected=selected/s:if单早
/option
option value=双早 s:if test=room.breakfast==双早selected=selected/s:if
显示全部