Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
removeAttribute() Method Of The Request Object 
 

This section introduces for the method removeAttribute() of the request object.

 

removeAttribute() Method Of The Request Object

                         

This section introduces for the method removeAttribute() of the request object. This method removes the attribute. This method takes a string type parameter i.e. the attribute name that has to be removed. After applying this method you can't access the attribute. If you specify the method for getting the value of the attribute what has removed, you will get the null value.

In this section, you will see more about the removeAttribute() method of the request object in JSP by learning through the provided description and the JSP code of the example. You can understand very efficiently the JSP code of the example.

Here is the JSP code of the RemoveAttributeMethod.jsp file:

<%
	request.setAttribute("UName", "chandan");
	request.setAttribute("Password", "chand");
	String pageName = "RemoveAttributeMethod1.jsp";
	RequestDispatcher requestDispatcher = request.getRequestDispatcher
(pageName);
	if(requestDispatcher != null){
		requestDispatcher.forward(request, response);
	}
%>

Here is the JSP code of the RemoveAttributeMethod1.jsp file:

<b>
<%
	out.println("User Name: " + request.getAttribute("UName") + "<br/>");
	out.println("Password: " + request.getAttribute("Password") + "<br/>");
	request.removeAttribute("Password");
	out.println("Your name: " + request.getAttribute("UName") + "<br/>");
	out.println("Your password: ");
	if(request.getAttribute("Password") == null)
		out.println("\'Password\' attribute is removed.");
	else
		out.println(request.getAttribute("Password"));
%></b>

Output for the both examples:

Download the RemoveAttributeMethod.jsp file.

Download the RemoveAttributeMethod1.jsp file.

 

                         

» View all related tutorials
Related Tags: java c string jsp ide class strings script object io objects method get char ip using sequence id declaration length

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

1 comments so far (
post your own) View All Comments Latest 10 Comments:

pls do it for php also

Posted by prabhu on Thursday, 07.26.07 @ 17:37pm | #21996

Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.