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的常用操作(增删改查),下面是程序运行效果:
增(增加节点包括创建XML):
/// <summary>
/// 创建XML文档
/// </summary>
/// <param name="path"></param>
......
1 在Action实现类方面的对比:Struts 1要求Action类继承一个抽象基类;Struts 1的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action接口不是必须实现的,只有一 ......
<asp:DropDownList ID="compactType" runat="server" AutoCallBack="True" Width="153px"> </asp:DropDownList>
<?xml version="1.0" encoding="utf-8" ?>
<roots>
<root>
<id>1</id>
<Culture> ......
解析xml文档的类库有很多种,比较常用的就是SimpleXML,DOM Document,XMLReader,基于SAX的xml_parse函数。
根据xml文档结构,以及需求的不同,要选择好对应的类库。
解析小的文档的话,使用SimpleXML比较合适,简单的几个函数就可以搞定。
如果文档非常巨大,最好是XMLReader打开,中间转换成DOM来解析,感觉DOM与XPat ......