假定页的基 URL 为:
http://test.siroe.com/testcases/html/form.html
页内容
假定页 URI 是 form.html,并且它位于服务器的根目录下。
<form name=form1 method=POST action= "http://test.siroe.com/testcases/html/form.html"> <input type=hidden name=abc1 value="0|1234|/test.html"> </form>
要重写 form1 中名为 abc1 的隐藏字段值中出现的 /text.html,需要下列规则。
规则
<Form source="*/form.html" name="form1" field="abc1" valuePatterns="0|1234|"/> <Attribute name="action"/>
输出
<FORM name="form1" method="POST" action="gateway-URL/ http://test.siroe.com/testcases/html/form.html"> <input type=hidden name=abc1 value="0|1234|gateway-URL/ http://test.siroe.com/test.html"> </FORM>
描述
action 标记是用某些已定义的 HTML 属性规则进行重写的。
输入标记属性值的 value 的重写方式如输出中所示。将会查找指定的 valuePatterns,并通过在前面加上网关 URL 以及页的基 URL 来重写紧随在匹配的 valuePatterns 之后的所有内容。参见在规则中使用模式匹配。