Hi Pratik Machchar

Here you are.

1) newPO.jsp
        ...........
        <new:newPO rowBgColor = "#FFDDDD">
        <td align = "center">
                <input type = "checkbox">OK
                <a href = "<new:updateURL/>">Update</a>
        </td>
        </new:newPO>
        ..........

2) taglib descriptor
        ...
        <tag>
                <name>newPO</name>
                <tagclass>com.asus.NewPO</tagclass>
                <bodycontent>JSP</bodycontent>
                <attribute>
                        <name>rowBgColor</name>
                        <required>false</required>
                        <rtexprvalue>false</rtexprvalue>
                </attribute>
                <info>generates new PO list</info>
        </tag>

        <tag>
                <name>updateURL</name>
                <tagclass>com.asus.UpdateURL</tagclass>
                <bodycontent>empty</bodycontent>
                <info>generates URL for PO update</info>
        </tag>
        ...

3) NewPO.java
        public int doAfterBody() throws JspException {
        body = bodyContent.getString();
        if (lineCount <= 1) return EVAL_BODY_TAG;
                return SKIP_BODY;
        }

        public int doEndTag() throws
javax.servlet.jsp.JspException {
                ...
                try {
                        listNewPO();
                } catch (IOException e) {
                        throw new JspException("IO error : " +
e.getMessage());
                }
                return EVAL_PAGE;
        }

        private void listNewPO() throws IOException {
                ...
                pageContext.getOut().print(body);
                ...
        }

        protected String getUpdateURL() {
                return "schedule.jsp?row=" + ++lineCount;
        }

4) UpdateURL.java
        public class UpdateURL extends BodyTagSupport {
                private NewPO parent;
                public int doEndTag() throws
javax.servlet.jsp.JspException {
                try {
                        pageContext.getOut().print(parent.getUpdateURL());
                } catch (IOException e) {
                        throw new JspException("IO error : " +
e.getMessage());
                }
                return EVAL_PAGE;
        }

                public void setParent(final Tag parent) {
                        this.parent = (NewPO) parent;
                }
        }

_________________________________________________________
Do You Yahoo!?
�n�O�K�O�� @yahoo.com.tw �q�l�l�� @ http://mail.yahoo.com.tw
Get your free @yahoo.com.tw address at http://mail.yahoo.com.tw

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to