//页面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> </div><div class="tips">点击选择</div><div class="ok" title="已选择"></div></li>
</s:iterator>
</ul>
在页面的ready时先调用一次loadconts(),然后搜索按钮的onclick也绑定loadconts()
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> </div><div class="tips">点击选择</div><div class="ok" title="已选择"></div></li>
</s:iterator>
</ul>
在页面的ready时先调用一次loadconts(),然后搜索按钮的onclick也绑定loadconts()