日期:2014-05-18  浏览次数:20872 次

action中拿不到页面发来的参数!
ACTION类

@SuppressWarnings("serial")
@Controller("ConditionQueryAction")
// 指定该类的对象在spring容器中的作用域为prototype
@Scope("prototype")
@Transactional
public class ConditionQueryAction extends ActionSupport implements ModelDriven<Client>{
@Resource
private ClientDao clientdao;
private Client client;
private Pager pager;
private int  page;


public Client getModel() {
if(client == null){
client=new Client();
}
return client;
}
//不定条件查询 将返回的pagers对象 传送到页面
public String execute(){

System.out.println("page1是======="+page);//这里有问题 每次不管点击下一页 还是最后一页 总是显示 page1是======= 0 !!

if(page==0)
page=1;

pager = clientdao.query(getModel(),page,5);
ActionContext.getContext().put("pager", pager);

ActionContext.getContext().put("models", getModel());
return SUCCESS;
}


public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}

}



jsp

<form action="querys" method="post" name="theform">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td class="trTitle">单位名称:</td>
      <td><label for="textfield"></label>
        <input type="text" name="clientName" id="textfield" value="${models.clientName}"/></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td class="trTitle">客户编号:</td>
      <td><input type="text" name="clientId" id="textfield5" /></td>
      <td>&nbsp;&nbsp;&nbsp;</td>
      <td class="trTitle">电&nbsp;&nbsp;话:</td>
      <td><label for="textfield2"></label>
        <input type="text" name="telphone" id="textfield2" /></td>
    </tr>
    <tr>
      <td class="trTitle">客户分类:</td>
      <td><label for="select"></label>
        <select name="clientType" id="select">
          <option value="0">托运客户</option>
          <option value="1">收货客户</option>
        </select></td>
      <td>&nbsp;</td>
      <td class="trTitl