问题描述
- 在一个自定义标签中利用out.write输出里一个自定义标签失效
-
public void doTag() throws JspException, IOException { Book book = null; JspContext jc = super.getJspContext(); JspWriter out = jc.getOut(); Object value = jc.getAttribute(bookMap); // if (value instanceof Map) { Map<String, Object> bookMap = (Map<String, Object>) value; try { int row = bookMap.size() - 2; for (int i = 0; i < row;) { out.write("<div class='row'>"); for (int j = 0; j < 3 && i < row; j++, i++) { book = (Book) bookMap.get("line" + i); out.write("<div class='col-xs-5 col-md-4'>"); out.write("<a href='#' >"); **_ out.write("<lms:bookpic book_id='"+book.getBook_id()+"' width='160px' height='200px'>");_** out.write("</a>"); out.write("<div class='caption'>"); out.write("<h4>" + book.getBook_name() + "</h4>"); out.write("<p class='text-left text-muted'>" + book.getBook_abstract() + "</p>"); out.write("<p>"); out.write("<a href='bookServlet?actionCode=modifyBook&book_id=" + book.getBook_id() + "' class='btn btn-primary'>修改图书</a>"); out.write("<b> </b>"); out.write("<a class='btn btn-info' onclick='deleteBook("+book.getBook_id()+")' >删除图书</a>"); out.write("</p>"); out.write("</div>"); out.write("</div>"); } out.write("</div>"); } } catch (final Exception e) { e.printStackTrace(); } } }
时间: 2024-10-31 02:54:03