Services | Updates | Contact
Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
RMI Plugin for Eclipse
The RMI Plug-in for Eclipse is the most comprehensive solution for developing Java RMI systems using the Eclipse platfor
 
Ensemble Glider for Eclipse
An Eclipse plugin for rapid J2EE application development and debugging. Create and test EJBs and JSPs without deploying
 
More Tutorials...


    Loan Information     Struts     Open Source

Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

 
 
JSP

 
Comments
 
 

 

INTRODUCTION TO JSP TAGS

                         

In this lesson we will learn about the various tags available in JSP with suitable examples. In JSP tags can be devided into 4 different types. These are:
    
  1. Directives
    In the directives we can import packages, define error handling pages or the session information of the JSP page.
        
  2. Declarations
    This tag is used for defining the functions and variables to be used in the JSP.
       
  3. Scriplets
    In this tag we can insert any amount of valid java code and these codes are placed in _jspService method by the JSP engine.
       
  4. Expressions
    We can use this tag to output any data on the generated page. These data are automatically converted to string and printed on the output stream.
       
Now we will examine each tags in details with examples. DIRECTIVES

Syntax of JSP directives is:

<%@directive attribute="value" %>

Where directive may be:

  1. page: page is used to provide the information about it.
    Example: <%@page language="java" %> 
       
  2. include: include is used to include a file in the JSP page.
    Example: <%@ include file="/header.jsp" %> 
      
  3. taglib: taglib is used to use the custom tags in the JSP pages (custom tags allows us to defined our own tags).
    Example: <%@ taglib uri="tlds/taglib.tld" prefix="mytag" %> 
       

and attribute may be:

  1. language="java"
    This tells the server that the page is using the java language. Current JSP specification supports only java language.
    Example: <%@page language="java" %> 
       
  2. extends="mypackage.myclass"
    This attribute is used when we want to extend any class. We can use comma(,) to import more than one packages.
    Example: <%@page language="java" import="java.sql.*,mypackage.myclass" %> 
       
  3. session="true"
    When this value is true session data is available to the JSP page otherwise not. By default this value is true.
    Example: <%@page language="java" session="true" %> 
      
  4. errorPage="error.jsp"
    errorPage is used to handle the un-handled exceptions in the page.
    Example: <%@page language="java" session="true" errorPage="error.jsp"  %> 
       
  5. contentType="text/html;charset=ISO-8859-1"
    Use this attribute to set the mime type and character set of the JSP.
    Example: <%@page language="java" session="true" contentType="text/html;charset=ISO-8859-1"  %> 
        

                         

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

Current Comments

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

http:status 500
how can i solve this error?

Posted by avinash on Friday, 04.4.08 @ 14:24pm | #55301

i want to store a text value which is entered in jsp to some other file example(.txt file) and i need to retive a file in jsp when ever needed

Posted by girija on Friday, 02.8.08 @ 13:44pm | #47599

u r tutorials are very useful for me. I want custom tags in jsp but along with u r tutorial not avaialable

Posted by m.subbarao on Saturday, 01.19.08 @ 17:03pm | #45589

its very useful tutorial

Posted by srinu on Wednesday, 01.16.08 @ 11:42am | #45328

Well my question is as we al know that jsp is converted in servlet and then it is compiled and executed and we get the output but can we see this servlet which is converted from jsp .
If yes then how.
I am eagerly waiting for the answer.

Posted by SANJAY SHUKLA on Thursday, 10.18.07 @ 01:52am | #34305

HTTP Status 404
how can clear this error
please help me urgent

Posted by ramesh on Wednesday, 08.22.07 @ 14:28pm | #23899

OK so to save stuff into tomcat save in webapps\folder\file. ROOT is something that shows up with http://localhost:8080/file and any other folder there shows up as http://localhost:8080/folder/file thats saving now startup:
I have my JDK in this folder: C:\jdk
JRE is here: C:\jdk\jre
I have my TOMCAT in this folder: C:\tomcat
startup is here: C:\tomcat\bin
My CMD prompt looks like this for startup:

C:\my\start\path\in\cmd>cd C:\tomcat\bin

C:\tomcat\bin>set CATALINA_HOME="C:\tomcat"

C:\tomcat\bin>set JRE_HOME="C:\jdk\jre"

C:\tomcat\bin>startup
Using CATALINA_BASE: "C:\tomcat"
Using CATALINA_HOME: "C:\tomcat"
Using CATALINA_TMPDIR: "C:\tomcat"\temp
Using JRE_HOME: "C:\jdk\jre"
C:\tomcat\bin>


And thats startup. If you keep that prompt open until you wish to shut TOMCAT down, use the command 'shutdown' as long as you didn't switch folders. Else Rename the TWO variables and go back to the bin folder. If you specified CATALINA_HOME then where ever you are in the cmd, unless you are in tomcat's bin, you can put the path like this in the command: 'C:\tomcat\bin\startup' and 'C:\tomcat\bin\shutdown'

Please replace the paths I have placed in this post with your very own paths.

Posted by Andrew on Monday, 08.13.07 @ 01:41am | #23253

OK so to save stuff into tomcat save in webapps\folder\file. ROOT is something that shows up with http://localhost:8080/file and any other folder there shows up as http://localhost:8080/folder/file thats saving now startup:
I have my JDK in this folder: C:\jdk
JRE is here: C:\jdk\jre
I have my TOMCAT in this folder: C:\tomcat
startup is here: C:\tomcat\bin
My CMD prompt looks like this for startup:

C:\my\start\path\in\cmd>cd C:\tomcat\bin

C:\tomcat\bin>set CATALINA_HOME="C:\tomcat"

C:\tomcat\bin>set JRE_HOME="C:\jdk\jre"

C:\tomcat\bin>startup
Using CATALINA_BASE: "C:\tomcat"
Using CATALINA_HOME: "C:\tomcat"
Using CATALINA_TMPDIR: "C:\tomcat"\temp
Using JRE_HOME: "C:\jdk\jre"
C:\tomcat\bin>


And thats startup. If you keep that prompt open until you wish to shut TOMCAT down, use the command 'shutdown' as long as you didn't switch folders. Else Rename the TWO variables and go back to the bin folder. If you specified CATALINA_HOME then where ever you are in the cmd, unless you are in tomcat's bin, you can put the path like this in the command: 'C:\tomcat\bin\startup' and 'C:\tomcat\bin\shutdown'

Please replace the paths I have placed in this post with your very own paths.

Posted by Andrew on Monday, 08.13.07 @ 01:41am | #23252

OK what I want you to do is go to the folder where you keep tomcat. go into the tomcat folder, and you should see various folders such as bin and webapps... First step is saving the files... Go into webapps. The root file is something you can access as "http://localhost:8080/filename"
Or you can make a new folder E.G. "tryit"
and access a file in it with "http://localhost:8080/tryit/filename"...
That is saving files. Now to start tomcat. First open a DOS window, in Windows, Start>Run><type in cmd and hit run> Now type in the following command where $CATALINA_HOME is where you saved tomcat. CATALINA_HOME is different in this case.
$JDK is where you saved jdk here. Replace my variables.
1:cd $CATALINA_HOME/bin
2:set JRE_HOME="$JDK\jre"
3:set CATALINA_HOME="$CATALINA_HOME"
4:startup

To turn off, please keep your DOS window open until it is time to turn off or you will repeat every step except for #4. then type in this command:

5:shutdown

That should do it.
Example:

C:\this\is\my\cmd\start\path>cd C:\tomcat\bin

C:\tomcat\bin>set CATALINA_HOME="C:\tomcat"

C:\tomcat\bin>set JRE_HOME="C:\jdk\jre"

C:\tomcat\bin>startup
Using CATALINA_BASE: "C:\tomcat"
Using CATALINA_HOME: "C:\tomcat"
Using CATALINA_TMPDIR: "C:\tomcat\temp"
Using JRE_HOME: "C:\jdk\jre"
C:\tomcat\bin>shutdown
Using CATALINA_BASE: "C:\tomcat"
Using CATALINA_HOME: "C:\tomcat"
Using CATALINA_TMPDIR: "C:\tomcat\temp"
Using JRE_HOME: "C:\jdk\jre"
C:\tomcat\bin>exit
--DOS OFF AFTER exit COMMAND

Posted by Andrew on Sunday, 08.12.07 @ 08:40am | #23210

i m begineer these tutorials are very helpful they are very easy to understand.
thanks

Posted by Mahalakshmi on Sunday, 08.5.07 @ 12:32pm | #22700

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

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.

  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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

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

Copyright © 2007. All rights reserved.