分享

LR 事务+集合点+参数化+检查点

 10的自留地 2012-03-08

lr_rendezvous("login"); /*集合点*/

 lr_start_transaction("login"); /*事务开始*/

 web_reg_find("Text=CACname","SaveCount=num","Search=Body",LAST); /*检查点*/

 web_submit_form("VerifyServlet",
  "Snapshot=t2.inf",
  ITEMDATA,
  "Name=username", "Value={user}", ENDITEM,
  "Name=password", "Value=admin", ENDITEM,
  "Name=Button1", "Value=登  录", ENDITEM,
  EXTRARES,
  "URL=resources/menu.json?_dc=1331175664185&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22type%22%2C%22value%22%3A%22base%22%7D%5D", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=resources/menu.json?_dc=1331175664232&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22type%22%2C%22value%22%3A%22data%22%7D%5D", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=resources/menu.json?_dc=1331175664232&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22type%22%2C%22value%22%3A%22sys%22%7D%5D", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tip/tip-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tip/tip-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/toolbar/toolbar-default-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/logo.PNG", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/home.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/user_suit.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/refresh.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/favorite.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/global.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/key.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/hmenu-unlock.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/help.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/panel-header/panel-header-default-top-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tools/tool-sprites.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/util/splitter/mini-left.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/list-items.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-active-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-active-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-active-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/homepage.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/column-header-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/dd/drop-no.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/green.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/red.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/grid3-hd-btn.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/sort_asc.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/column-header-over-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/yellow.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-top-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/templates.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/tab/tab-default-close.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/add.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=images/delete.png", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-disabled-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-disabled-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-over-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-over-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-over-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-pressed-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-pressed-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-pressed-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-focus-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-focus-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-toolbar-small-focus-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/form/text-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/form/exclamation.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/form-invalid-tip/form-invalid-tip-default-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/form-invalid-tip/form-invalid-tip-default-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/form/trigger.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/panel/panel-default-framed-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-over-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-over-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-over-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-pressed-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-pressed-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-pressed-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-focus-sides.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-focus-bg.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/btn/btn-default-small-focus-corners.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/dirty.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  "URL=ext4/resources/themes/images/default/grid/loading.gif", "Referer=http://localhost/cacms/main.jsp", ENDITEM,
  LAST);

 web_custom_request("TimeServlet",
  "URL=http://localhost/cacms/TimeServlet",
  "Method=POST",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://localhost/cacms/main.jsp",
  "Snapshot=t3.inf",
  "Mode=HTML",
  "EncType=",
  LAST);

 

 web_url("Virtual_listServlet",
  "URL=http://localhost/cacms/Virtual_listServlet?type=read&stationno=dadeb&_dc=1331175665339&page=1&start=0&limit=25",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://localhost/cacms/main.jsp",
  "Snapshot=t4.inf",
  "Mode=HTML",
  LAST);

 web_url("SensorinfoServlet",
  "URL=http://localhost/cacms/SensorinfoServlet?type=read&stationno=dadeb&_dc=1331175665371&page=1&start=0&limit=25&sort=%5B%7B%22property%22%3A%22sensorname%22%2C%22direction%22%3A%22ASC%22%7D%5D",
  "Resource=0",
  "RecContentType=text/html",
  "Referer=http://localhost/cacms/main.jsp",
  "Snapshot=t6.inf",
  "Mode=HTML",
  LAST);

 web_url("CagServlet",
  "URL=http://localhost/cacms/CagServlet?type=read&stationno=dadeb&_dc=1331175665339&page=1&start=0&limit=25",
  "Resource=0",
  "Referer=http://localhost/cacms/main.jsp",
  "Snapshot=t5.inf",
  "Mode=HTML",
  LAST);

 lr_end_transaction("login", LR_AUTO); /*事务结束*/

 lr_log_message("用户名:%s", lr_eval_string("{user}")); /*日志输出*/

 if(strcmp(lr_eval_string("{num}"),"0")==0) /*将num与0比较,如果num=0,则返回值==0,则为真,执行登录失败语句;如果num!=0,则返回值!=0,执行登录成功语句*/
  lr_log_message("登录失败!");
 else
  lr_log_message("登录成功!");
 
ps:那如果num<0呢、、、、、
 
可以换成语句:
if(atoi(lr_eval_string("{num}"))==0)

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多