日期:2014-05-17 浏览次数:20754 次
BookDao bookDao=new BookDao(); //查询 public String selectBook() throws Exception{ if (book.getId()==null||book.getId().equals("")) { System.out.println("a4"); this.setMessage("请输入id号"); return INPUT; }else if (bookDao.selectBook(book.getId())==null) { System.out.println("a3"); this.setMessage("不存在该id号"); System.out.println(message); return INPUT; } System.out.println("a1"); String bh=book.getId(); Book book2=bookDao.selectBook(bh); System.out.println(book2.getName()); // Map request=(Map) ActionContext.getContext().get("request"); // request.put("book", book2); book.setName(book2.getName()); System.out.println(book.getId()); System.out.println(book.getName()); return SUCCESS; }
<body> <form action="selectBook.action" method="selectBook"> <tr>输入id号:<input type="text" name="book.id"/><input type="submit" value="查询"></tr> <s:property value="message"/> </form> </body>
<body> <form action="selectBook.action" method="selectBook"> <tr>输入id号:<input type="text" name="book.id"/><input type="submit" value="查询"></tr> ${message} </form> </body>