jsp/get/set/struts.xml存取
get
jsp url ${param.serialID}
action jsp String commentId = ServletActionContext.getRequest().getParameter("commentId");
---------------------------------------
action ServletActionContext.getRequest().setAttribute("searchContent", searchContent);
jsp action <s:property value="searchContent"></s:property>
---------------------------------------
function hanshu(num)
{
window.location.href="<%=request.getContextPath()%>/a.action?num="+num;
}
<a href="javascript:hanshu('${param.url参数名}')"></a>
=====================
post
//使用trim()
String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function hanshu()
{
var selectValue = document.getElementById("selectId").value;
var textValue = document.getElementById("textId").value;
//必填
if(!selectValue)
{
alert("必填");
}
else if(selectValue.trim().length<1)
{
alert("长度");
}
}
<form action="${pageContext.request.contextPath}/getAction.action" method="post" name="nameForm">
<select name="seledtName" id="selectId">
<option value="1">博客</option>
</select>
<input type="text" name="textName" id="textId"&g
相关文档:
XML文件
<?xml version="1.0" encoding="utf-8"?>
.......
因为原因很多,所以这个方法不一定能解决问题
XMLDocument1.LoadfromFile('test.XML');
XMLDocument1.Active:=TRUE;
XMLDocument1.Encoding:='gb2312';
memo1.Text:=XMLDocument1.XML.Text; ......
今天试了个XML和JavaBean转换的软件JOX,之前一直有这样的需求,但比较来比较去还是这个比较简单实用。我想除非我有WS的需求,否则象JIBX和APACHE 的WS工具对我来说都是重量级的。
先看看输出结果:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ApproxItem java-class="com.greatwall.csi.np.model.Approx ......
解析xml文档的类库有很多种,比较常用的就是SimpleXML,DOM Document,XMLReader,基于SAX的xml_parse函数。
根据xml文档结构,以及需求的不同,要选择好对应的类库。
解析小的文档的话,使用SimpleXML比较合适,简单的几个函数就可以搞定。
如果文档非常巨大,最好是XMLReader打开,中间转换成DOM来解析,感觉DOM与XPat ......