Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Assigning value to anchor tag using custom tag

Ads

 
 

Share on Google+Share on Google+

Divyashree
Assigning value to anchor tag using custom tag
0 Answer(s)      4 years and a month ago
Posted in : JSP-Servlet

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();

    }
}
Ads
View Answers
Ads









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 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.      
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
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
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...; Declaration Syntax : Declaration syntax of target attribute in anchor tag.  
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 />
Display Current Date using JSP Custom(user define) Tag
Display Current Date using JSP Custom(user define) Tag In this section, we... & time will display using custom tag. Tag Handler File :  Build... define) tag. JSP Custom Tags : Provide a mechanism to a Web programmer
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... in anchor tag.           
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
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.
Hreflang Attribute, Use of hreflang attribute of anchor tag in HTML5.... Declaration Syntax : Declaration syntax of hreflang attribute in anchor tag... href attribute is available. hreflang Attribute : Attribute Value
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
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
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
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
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.jsp <...;/head> <body><h2>Ajax_Anchor_Tag
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
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
JSF commandLink Tag
which is rendered as a anchor tag. And this tag behaves as a command button... of using the tag. Code Description... a hypertext. This is not only a anchor tag. This link behaves like a command
Set Tag (Data Tag) Example
; tag as  shown in the setTag.jsp page. The set tag is used to assign a value to a variable in a specified scope. The parameters name and value in the tag... Set Tag (Data Tag) Example      
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>
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> <
include tag
am learning struts2 but i have a small doubt i am using include tag. ex welcome to rose India.net include value="myBirthday.jsp" but only display... i am develop one example. ex: welcome to include tag include value=example.jsp
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
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