`
lolocomee
  • 浏览: 15945 次
  • 性别: Icon_minigender_1
  • 来自: 广州
最近访客 更多访客>>
社区版块
存档分类
最新评论

ajax提交的一个post

阅读更多
//页面js提交

function loadconts(){
// keyword type area classify
$.post("action!method", {keyword:$("#contkeyword").val(),
        type:$("#type").val(),area:$("#area").val(),classify:$("#classify").val()}, function(data){
     $("#show").html(data);   
        });
}

//acction里的方法
public String showContpicmethod() {
DetachedCriteria dc = DetachedCriteria.forClass(Model.class);
if (getKeyword() != null) {
if (!getKeyword().equals("")) {
dc.add(Restrictions.like("name", getKeyword(),
MatchMode.ANYWHERE));
}
}
if (getType() != null) {
if (!getType().equals("")) {
dc.add(Restrictions.eq("type", Integer
.parseInt(getType())));
}
}
if (getClassify() != null) {
if (!getClassify().equals("")) {
dc.add(Restrictions.eq("fathertype", Integer
.parseInt(getClassify())));
}
}
if (getArea() != null) {
if (!getArea().equals("")) {
dc.add(Restrictions.eq("province", getArea()));
}
}
perList = dao.findList(dc, 50);
return "show";
}


//struts.xml配置
<result name="show">/show.jsp</result>


//show.jsp,做好界面后抽出来的
...//标签,编码等,${myTag:substr(name,0,6)}是自定义截取字符串标签

<ul class="img fl fix">
<s:iterator value="perList">
<li><img src="icon/i5.jpg" width="104" height="142" forid="${oid }" />
<div><a href="#" title="单击查看内容" target="_blank">${myTag:substr(name,0,6)}</a>&nbsp;</div><div class="tips">点击选择</div><div class="ok" title="已选择"></div></li>
</s:iterator>
</ul>


在页面的ready时先调用一次loadconts(),然后搜索按钮的onclick也绑定loadconts()
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics