ViewIPTag.java public class ViewIPTag extends TagSupport { public int doStartTag() throws JspException { String ip = pageContext.getRequest().getRemoteAddr(); try { pageContext.getOut().write(ip); } catch (Exception e) { e.printStackTrace(); } return super.doStartTag(); } } xu.tld <?xml version="1.0" encoding="UTF-8"?> 1.01.0wangtongtaglib/wangtongtaglibviewiptag.ViewIPTagempty
My JSP 'index.jsp' starting page This is my JSP page.