正在加载图片...
import org. springframework. web. struts. ActionSupport import ca excel. books. beans. Book import ca. nexcel books business Book Service public class SearchSubmit extends ActionSupport (1) public Action Forward execute( Action Mapping mapping Action Form form HttpservletreqUest request HttpservletresPonse response throws IOException, ServletException I DynaActionForm searchForm =(DynaAction Form) form String isbn =(String) searchForm get(isbn") //the old fashion way //BookService book Service new BookServiceImp1o ApplicationContext ctx getWebApplication Contexto:(2) Bookservice book service (Book Service) ctx getBean ("bo vIce Book book bookService. read (isbn trimo) f (null = book)I ActionErrors errors new ActionErrors o: errors. add(Action Errors. GLOBAL ERROR, new ActionError saveErrors (request, errors return mapping. findForward(failure") request setAttribute( book", book)import org.springframework.web.struts.ActionSupport; import ca.nexcel.books.beans.Book; import ca.nexcel.books.business.BookService; public class SearchSubmit extends ActionSupport { (1) public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { DynaActionForm searchForm = (DynaActionForm) form; String isbn = (String) searchForm.get("isbn"); //the old fashion way //BookService bookService = new BookServiceImpl(); ApplicationContext ctx = getWebApplicationContext(); (2) BookService bookService = (BookService) ctx.getBean("bookService"); (3) Book book = bookService.read(isbn.trim()); if (null == book) { ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR,new ActionError ("message.notfound")); saveErrors(request, errors); return mapping.findForward("failure") ; } request.setAttribute("book", book);
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有