Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Assigning value to anchor tag using custom tag

Have Programming Question? Ask it here!
 
 
 


Divyashree
Assigning value to anchor tag using custom tag
0 Answer(s)      a year and 2 months 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();

    }
}

Advertisement
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 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
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.  
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
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.           
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
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
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 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
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
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
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
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
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
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
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
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
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>
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      
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
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> <
Assigning a value to JSP variable from a bean class. - JSP-Servlet
Assigning a value to JSP variable from a bean class.  Hi, I want to know how we can assign value to a JSP variable from a Java Bean. I am using Struts, JSTL. Which tags should I use to assign the value. e.g Kindly
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
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
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
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
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
Defining and using custom tags - JSP-Servlet
Defining and using custom tags  Hi Sir, I want to know in detail how to define a custom tag and about tld files and tag libraries.I want an example code with explanation.  Hi Friend, A custom tag is a user
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 venu
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
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
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...; <C:url> : This is a member of JSTL core tag library and used
Generator Tag (Control Tags) Using Count Attributes
Generator Tag (Control Tags) Using Count Attributes   ... tag using the count attribute.  Add the following code snippet...:iterator> tag prints it out using the  <s:property />
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
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: Defines a tag library and prefix for the custom tags used in the JSP page. Thanks
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
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
Declaration tag
Declaration tag   Defined Declaration tag in JSP   ... does not reside inside service method of JSP. Declaration tag is used to define... Declaration tag example: <%! String name = "Vijay Kumar"; String date
subview with tag
subview with tag  Hi, How to access the subview of a view with the tag identifier? Thanks   Hi, Following code might useful: UIView *modalView=(UIView *) [self.view viewWithTag:101]; [modalView removeFromSuperview
 

 

 

DMCA.com