Assigning value to anchor tag using custom tag

Assigning value to anchor tag using custom tag

hi,

I am trying to assign a value to anchor tag within a custom tag and redirecting the link to ReadPDF.jsp a show in the code . I want to display the value in the jsp , while retreiving the value and displaying its either null or empty . I think im not assiging the value properly , please help. I am stuck with this problem for a long time.

I think the problem is im assigning in custom tag .

package com.k.customtags;

import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.k.dao.impl.ReceiptgenerationDAO;
import com.k.execeptions.KBusinessException;
import com.k.execeptions.KException;
import com.k.vo.ReceiptVO;

public class PrintReceiptTag extends SimpleTagSupport{

    ReceiptgenerationDAO dao;
    List<ReceiptVO> receipt_list ;

    @Override
    public void doTag() throws JspException, IOException {
        // TODO Auto-generated method stub
        final JspWriter out = getJspContext().getOut(); // gets the output stream to
        PageContext pageContext = (PageContext)getJspContext();
        HttpSession session = pageContext.getSession();

        try {
            dao = new ReceiptgenerationDAO();
            receipt_list = dao.printReceipt();
            ReceiptVO vo ;
            Iterator<ReceiptVO> io = receipt_list.iterator();
            out.print("<table border='1'>");
            out.print("<tr>");
            out.print("<th>receipt no</th>");
            out.print("<th>Date</th>");
            out.print("<th>Details</th>");
            out.print("<th>Read File</th>");
            out.print("</tr>");

            while(io.hasNext()){
                vo = io.next();
                String receiptno = vo.getReceipt_id() + "_" + vo.getReceipt_date();
                //System.out.println("receiptno : " + receiptno);
                out.print("<tr>");
                out.print("<td>"+ vo.getReceipt_id()+"</td>");
                out.print("<td>"+ vo.getReceipt_date() + "</td>");
                out.print("<td>"+ vo.getDetails()+ "</td>");
                **out.print("<td><a href='readPDF.jsp?&RNO='"+receiptno+"'' >open</a></td>");**
                out.print("</tr>");
            }   
            out.print("</table>");


        } catch (KException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (KBusinessException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        super.doTag();

    }
}
View Answers









Related Tutorials/Questions & Answers:
Assigning value to anchor <a></a> tag using custom tag
Assigning value to anchor tag using custom tag  hi, I am trying to assign a value to anchor tag within a custom tag and redirecting the link... time. I think the problem is im assigning in custom tag . package
anchor tag in HTML
anchor tag in HTML  Explain anchor tag in HTML
Advertisements
Example of struts2.2.1 anchor tag.
Example of struts2.2.1 anchor tag. In this tutorial, we will introduce you to about the anchor tag of struts2.2.1. It provides a hyperlink from current page to another page. It works as anchor tag of html, but syntax is different
HTML5 Anchor Tag Example, Definition of &lt;a&gt;anchor tag in HTML5.
HTML5 Anchor Tag Example, Definition of <a> anchor tag in HTML5. In this tutorial, we will introduce you to the <a> anchor tag of HTML5. An Anchor tag is a hyper link. It is used to create a link from one page to another
Anchor tag attributes in HTML5, Define the href attribute of anchor tag.
Anchor tag attributes in HTML5, Define the href attribute of anchor tag. In this tutorial, we will see the use of href attribute of anchor tag . The href attribute of anchor tag holds URL of destination document, which we want
Anchor tag attributes in HTML5, Define the type attribute of anchor tag.
  In this tutorial, we will see the use of type attribute of anchor tag . The type attribute of anchor tag specifies the MIME (multipurpose internet... syntax of type attribute in anchor tag.      
how to get the anchor field in hidden field tag
how to get the anchor field in hidden field tag  I have a following code I need to have the value of property "emp" in a hidden field also. when i try to put the following code, I cant get the hidden tag when i see the source
Display Current Date using JSP Custom(user define) Tag
Display Current Date using JSP Custom(user define) Tag In this section, we... In this Example, Current date & time will display using custom tag. Tag... define) tag. JSP Custom Tags : Provide a mechanism to a Web programmer
Change Background color using Custom Tag
Change Background color using Custom Tag In this program, We will create a Custom Tag which changes the background color. JSP Custom Tags : Provide.... The following code snippet shows an empty custom tag:   <td:welcome />
Target attribute in anchor tag, Use of target attribute of anchor tag in HTML5.
Target attribute in anchor tag, Use of target attribute of anchor tag in HTML5. In this tutorial, we will see the use of target attribute of anchor tag... Value Description target _blank _self _parent _top
Rel attribute in anchor tag, Use of rel attribute in anchor tag.
Rel attribute in anchor tag, Use of rel attribute in anchor tag. Description:You will see the use of rel attribute of anchor tag and how to implement... Value Description   alternate Indicates
JSP CUSTOM TAG - Design concepts & design patterns
by using a single tag. For getting information on Custom Tags, visit the following...JSP CUSTOM TAG   I am Barani Kumar I am trying to use jsp custom tag in my web application I want to now advantages in jsp custom tag I want
How to read the body content of custom tag?
How to read the body content of custom tag?  I'm unable to read the body content specified between start tag and end tag of a JSP custom tag...); method. I want to read the body content of any custom tag and manipulate
checkbox custom tag creation in jsf
checkbox custom tag creation in jsf  how to create check box custom tags with the following functionality: 1.there must be two checkboxes 2.when the first box is checked it must populate the names of bikes,when the second
how to call servlet from html page at anchor tag ?
how to call servlet from html page at anchor tag ?  I have a very different problem as i am using netbeans ide 6.9 ml to make a website in java... buttons image and for referrence i use anchor tag {for ex: ()} to go
Custom Iterator Tag in JSP
Custom Iterator Tag in JSP       Example program to make custom iterator tag in JSP This example will demonstrate you how you can make a custom iterator tag in JSP? You can
What is a Tag Library in JSP
, multiple actions are accessed by using the tags of the JSP whether the tag is standard tag of the JSP or the custom tag that is made by you. Actions in JSP..., you can say that the tag library is a collection of custom tags. The Tag
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5... href attribute is available. hreflang Attribute : Attribute Value.... Declaration Syntax : Declaration syntax of hreflang attribute in anchor
How to add another option to the select tag using struts2 tag - Struts
How to add another option to the select tag using struts2 tag  Hi, How to add another option to select tag using tag. My scenario... + one additional value in drop down or else normal user to view only drop down
Error in Custom tag program - JSP-Servlet
Error in Custom tag program  Dear Sir,This is my problem concern to custom tag.Please review.. Browser show: Browser show: Parsing of JSP... be terminated by the matching end-tag "". (line 12, column 3). probably occurred due
Exporting to excel using display tag?
Exporting to excel using display tag?  Hai , I am implementing pagination in struts.It has export to excel option.When I am clicking on it ,it is displaying a alert box stating "the file you are trying to open
Custom Tag example with no attribute and no body
Custom Tag example with no attribute and no body... to make custom tag with no attribute and no body This example demonstrates how one can make custom tag in JSP that has no attribute and no body. There are only
Assign value from a <bean:write> tag to a variable
Assign value from a tag to a variable  I am calling a stored procedure from JSP page which needs an input parameter. This input parameter needs to get the value from bean write tag . How can i do that ?   Please go
Set Tag (Data Tag) Example
;using <s:set> tag as  shown in the setTag.jsp page. The set tag is used... and value in the tag <s:set name="technologyName" value="... Set Tag (Data Tag) Example      
Example of anchor(Ajax) in struts2.2.1
, you will see the use of Ajax(anchor) tag.  Here, we are changing value of div tag with the help of Ajax anchor tag.   1- index.jspADS...;html> <head><title>Ajax_Anchor_Tag_Example<
JSF commandLink Tag
which is rendered as a anchor tag. And this tag behaves as a command button...; is looking like a hypertext. This is not only a anchor tag. This link behaves...JSF commandLink Tag     
ModuleNotFoundError: No module named 'anchor-custom'
ModuleNotFoundError: No module named 'anchor-custom'  Hi, My... 'anchor-custom' How to remove the ModuleNotFoundError: No module named 'anchor-custom' error? Thanks   Hi, In your python
include tag
am learning struts2 but i have a small doubt i am using include tag. ex... one example. ex: welcome to include tag include value=example.jsp it is only work example.jsp but not work on(welcome to include tag) above "include value
how to get the value of a label field of option tag in javascript?
how to get the value of a label field of option tag in javascript?  example <select> <option label="2" value="A">A</option> <option label="5" value="B">B</option> <
Tag extension in JSP
Tag extension in JSP  What is Tag extension in JSP model?   JSP supports the authors to add their own custom tags that perform custom actions. This is performed by using JSP tag extension API. A java class is written
Struts2 tag
Struts2 tag  function of hidden tag?   Hi Friend, <s:hidden> tag create a hidden value field.It means it stores the value but cannot be visible. For more information, visit the following link: Struts2 Tutorial
Store image from html img tag into mysql db using java
Store image from html img tag into mysql db using java  Hi. How to get the image displayed in the < img > tag of HTML and store it in the mysql database using java? Thanks in advance
Create URL using <c:url> tag of JSTL Core tag library
Create URL using <c:url> tag of JSTL Core tag library... to create a url according to the user's given parameter by using <c:url> tag...; : This is a member of JSTL core tag library and used to create url with some optional
Generator Tag (Control Tags) Using Count Attributes
Generator Tag (Control Tags) Using Count Attributes   ... tag using the count attribute.  Add the following code snippet... and <s:iterator> tag prints it out using the  <s
Tag Handler in JSP
;    What is a custom tag: The custom tag library... of a tag library, which defines a set of related custom tags and contains the objects that implement the tags. Custom tag libraries allow the java programmer
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i... action class? And i have no idea how to implement this. I am using jsp. Any help
include tag
include tag  good morning sir. This is venu sir.i am pursing mca . I am learning struts2 but i have a small doubt i am using include tag. ex... include tag ..... is not displayed Thanks venuADS_TO_REPLACE_1
Anchor Tags
Anchor Tags  coding for one link to another new page using anchor tag   Example of Anchor Tag in HTML <a href="http://www.roseindia.net/">RoseIndia Home Page</a>
jsp tag - JSP-Servlet
stream.A custom action is invoked by using a custom tag in a JSP page. A tag... TagLibrary in Jsp : Tag libraries are declared by using the directive.... This attribute must have the value as Tag Library Descriptor (TLD). prefix
JSP tag lib directive
JSP tag lib directive   What is tag lib directive in the JSP?   Hi, The answer is:ADS_TO_REPLACE_1 Defines a tag library and prefix for the custom tags used in the JSP page. Thanks
tag handler
tag handler  what is the diff bt simple and classic tag? which is more benifit to implement the handler? can we make use of any of these two to imlement the tag handler
dynamic generation of html:select tag from textbox value
dynamic generation of html:select tag from textbox value  Hi, I am a newbie to java and struts. In my application, I have a requirement like when i give some input in a textbox and click on a add link. It should be added
Achor tag. Struts2 code - Struts
Achor tag. Struts2 code  Hi All, How to send the values form one jsp page to another using anchor tag (or any which is similar to achor) in Struts? Please help me. I am waiting for the answer. Regards, Sandeep
Logic Equal Tag (<logic:equal>...</logic:equal>)
tag - if the requested variable is equal to the specified value... of this tag. Compares the variable passed against the specified constant value. The nested body content of this tag is evaluated if the variable and value
Expression tag
Expression tag  Defined Expression tag in JSP ?   Expression tag is used to display output of any data on the generated page. The data placed in Expression tag prints on the output stream and automatically converts
Tomahawk validateEqual tag
Tomahawk validateEqual tag          This tag is used to validate the value against the other component. In the for attribute we specify
HTTP 500 Internel server error in Custom tag program on Weblogic 8.1 - Java Beginners
HTTP 500 Internel server error in Custom tag program on Weblogic 8.1  ... error when I run the custom tag program on weblogic 8.1. My program Structure... JSPProgram>Home.jsp Home.jsp: It is a Tag Body taglib.tld: 1.0 1.2
The password tag
In this section, you will learn about the password tag of the Spring form tag library
The radiobuttons tag
In this section, you will learn about radiobuttons tag of Spring form tag library
The options tag
In this section, you will learn about the options tag of Spring form tag library

Ads