What's Your Question?

How Does HTML Code Work?

HTML is to a website what a solid foundation is to a house. Without HTML code, web developers wouldn’t have anything to build on. In other words, you wouldn’t be able to read this article without proper HTML code. Learn more about how this important language works.

What Is HTML?

HTML stands for hypertext markup language, and it’s used to lay out the basic structure of a website. You can build a simple website with HTML alone, including different font sizes and types, paragraphs, photos, background colors and other basic features. If you want to make your site look modern and nicely organized, though, you’ll need to learn additional languages like CSS and JavaScript.

The Basics of How HTML Works

Writing HTML code is basically like writing instructions for a web browser on how to display a website. For example, if you write HTML background color code specifying that your site should have a blue background, browsers read the code you’ve written and follow those instructions. The actual processes behind this are complicated and involve the transfer of data through the internet. If you’re interested in designing your own websites without using templates, though, it’s not so important to understand the technical specifics of how websites are rendered in a browser. It’s enough to know that HTML is an important part of this process, and that you need to have a good HTML structure in place if you want to build a functional, attractive website.

Understanding HTML Code

HTML is often taught as an introductory coding language because it’s ultimately pretty simple. To write HTML code, all you have to do is understand the proper syntax for communicating with a computer. You’ll also need to know the right instructions to include. These instructions are known as elements. Elements consist of tags and content. There are two tags, opening and closing, that must always bookend your content. The content between these tags is what you want to display on your site, and consist of text you write, hyperlinks to other websites, links to photos and more. If you fail to use the right symbols and characters in your opening and closing tags, your HTML will not work properly. If you do use the right tags, only the content will display on a web browser.

HTML Essentials

This is content for HTML code.

Learning HTML

HTML is an important building block for a website, but the good news is that it really isn’t that complicated to learn. There are a lot of free online resources available for those who want to dig in and learn how to use HTML to build websites, and that means not only that you’ll have guidance getting started but also that you’ll have plenty of resources to turn to for information as you learn on your own.


how to write html code in jsp

How to write HTML code faster

Speed up your HTML and CSS workflow with Emmet and Pug.

Write HTML faster

Modern websites require lots of HTML code. Complex layouts with multiple different views and states can be difficult to create with just a simple text editor. Thankfully, there are a host of HTML generation tools out there to work with. Here we take a quick look at two of the more popular tools, Emmet and Pug.

However, you still need to know your HTML to use both of these powerful time-saving tools. So, before you dive in make sure you're using the popular semantic HTML tags the right way. Also see our guide to using a HTML boilerplate .

Want to swerve the code? Try these website builders . Or for extra help along the way, choose a web hosting service with tech support. 

Generate HTML on the fly

When writing large amounts of HTML in one go, writing each tag out by hand can become very tedious, very quickly. For example, when writing out a list of links, we need to make sure that the <ul>, <li> and <a> tags all open and close in the right place. Otherwise the links may not work and the whole page layout will go completely haywire.

How to use Emmet

To make sure you reduce the chances of this happening you can employ the talents of Emmet (opens in new tab) . This is a tool that will save you lots of typing and will greatly improve your HTML & CSS workflow. Emmet allows you to create elements by typing out a CSS-like selector. It will then parse and expand that element into regular HTML. Below is the original element created in Emmet.

Emmet will detect this element, parse it and then transform the element into standard HTML as shown below. A quick look at the Emmet element suggests that <li> is multiplied by ( *3 ) and each <li> instance will be called Chapter followed by the appropriate number (up to 3). 

Note how many characters the Emmet element contains and how many the standard HTML contains. Even this small snippet of code demonstrates how much time can be saved by using the Emmet shorthand. 

Emmet is also aware of context. For example, if we are editing a <table> it is likely we will want some <tr> (these are rows) elements to fill it. All we would need to do is specify how many we need.

This is just a quick example of what Emmet can do, but there are plenty more configuration options available. These include CSS editing, BEM (Block Element Modifier) class creation and there is even a Lorem Ipsum generator. 

It's also worth noting that most code editors either have Emmet built in or support it through plugins. You can find out more about this on the Emmet Documentation (opens in new tab) page.

Use Pug for dynamic content

While Emmet is ideal for static content, what happens if content needs to be more dynamic? For example, we may need to generate personalised homepages, complex order tables or repeat common blocks of HTML. This is all possible in JavaScript, but by pre-rendering this content we can get an added speed boost without relying on the user’s browser. Remember if you've got a media-heavy page, you'll want to back it up with reliable cloud storage .

Step forward Pug. This is a templating tool for HTML. You can write pages in the “.pug” format and Pug will read that file, inject some dynamic data into it and return standard HTML. The example below is how you would write the code in Pug to create the same HTML as the Emmet example (above). 

A Pug file uses indentation alone to indicate nesting. It can iterate over values to generate large amounts of HTML in one pass. These “.pug” files are designed to be reused many times across a project. Pug is available to install from package manager npm (opens in new tab) . But, if you want more information on how to get started with Pug pay a visit to the website (opens in new tab) . 

This content originally appeared in Web Designer magazine.

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

Get Weekly Tips and Inspiration

Sign up below to get the latest from Creative Bloq, plus exclusive special offers, direct to your inbox!

Matt Crouch is a front end developer who uses his knowledge of React, GraphQL and Styled Components to build online platforms for award-winning startups across the UK. He has written a range of articles and tutorials for net and Web Designer magazines covering the latest and greatest web development tools and technologies. 

Related articles

How to Convert HTML to JSP

JSP allows you to embed snippets of the Java programming language into HTML tags to create interactive content. HTML pages are static in that each time a user loads the page, the content will appear the same. JSP allows for dynamic content to be added to HTML pages, so that each time the user reloads the page, the content changes. For example, we will go through a sample where every time a user reloads the page, the date and time are changed automatically to reflect the current date and time.


Open a new page in Notepad. Type the beginning and closing HTML tags with some space in between both tags. This specifies that the content will be in HTML.

Video of the Day

how to write html code in jsp

Type the opening body tag in the line below

Insert the following line at the top before the

This line declares that we are importing the java.util package because we will be using the date function. Java packages consist of classes of related functions.

Insert the following tag after the

Save the page with a .jsp extension.

Report an Issue

Screenshot loading...


Java server-side programming, getting started with jsp by examples, introduction.

JavaServer Page (JSP) is Java's answer to the popular Microsoft's Active Server Pages (ASP). JSP, like ASP, provides a simplified and fast mean to generate dynamic web contents. It allows you to mix static HTML with dynamically generated HTML - in the way that the business logic and the presentation are well separated.

The advantages of JSP are:

JSPs are Internally Compiled into Java Servlets

That is to say, anything that can be done using JSPs can also be accomplished using Java servlets. However, it is important to note that servlets and JSPs are complementary technologies, NOT replacement of each other. Servlet can be viewed as " HTML inside Java ", which is better for implementing business logic - as it is Java dominant. JSP, on the other hand, is " Java inside HTML ", which is superior for creating presentation - as it is HTML dominant. In a typical Model-View-Control (MVC) application, servlets are often used for the Controller (C), which involves complex programming logic. JSPs are often used for the View (V), which mainly deals with presentation. The Model (M) is usually implemented using JavaBean or EJB.

Apache Tomcat Server

JSPs, like servlets, are server-side programs run inside a HTTP server. To support JSP/servlet, a Java-capable HTTP server is required. Tomcat Server (@ ) is the official reference implementation (RI) for Java servlet and JSP, provided free by Apache (@ ) - an open-source software foundation.

First JSP Example - " Java inside HTML "

Let's begin with a simple JSP example. We shall use the webapp called " hello " that we have created in our earlier exercise. Use a programming text editor to enter the following HTML/JSP codes and save as " first.jsp " (the file type of " .jsp " is mandatory) in your webapp (web context) home directory (i.e., " webapps\hello ".

To execute the JSP script: Simply start your Tomcat server and use a browser to issue an URL to browse the JSP page (i.e., http://localhost:8080/hello/first.jsp ).

From your browser, choose the "View Source" option to check the response message. It should be either of the followings depending on the random number generated.

It is important to note that the client is not able to "view" the original JSP script (otherwise, you may have security exposure), but merely the result generated by the script.


Behind the Scene

When a JSP is first accessed, Tomcat converts the JSP into a servlet; compile the servlet, and execute the servlet. Check out the generated servlet for " first.jsp ", and study the JSP-to-servlet conversion. Look under Tomcat's " work\Catalina\localhost\hello " for " ".

The relevant part of the generated servlet is extracted as follows (with some simplifications):


Compare the JSP script and the internally generated servlet, you shall understand that servlet is " HTML inside Java ", whereas JSP is " Java inside HTML ".

Subsequent accesses to the same JSP will be much faster, because they will be re-directed to the converted and compiled servlet directly (no JSP-to-servlet conversion and servlet compilation needed again), unless the JSP has been modified.

Revisit Java Servlets

A typical Java servlet (as shown below) contains three kinds of methods: init() , destroy() , and one or more service() methods such as doGet() and doPost() . init() runs when the servlet is loaded. destroy() runs when the servlet is unloaded. service() runs once per HTTP request. The service() methods takes two arguments: request and response , corresponding to the HTTP request and response messages respectively. A PrintWriter called out is created for writing out the response to the network.

Java servlet produces HTML codes by calling out.print() methods. You have to hardcode all the HTML tags (and cannot use any WYSIWYG web authoring tools). Any change to the web page's presentation (such as background color and font size) requires re-coding and re-compilation of servlet program. Servlet, in a nutshell, is " HTML inside Java ", whereas JSP is " Java inside HTML ".

Second JSP example - Echoing HTML Request Parameters

Enter the following JSP script and save as " echo.jsp " in your webapp's root directory .

Browse the JSP page created and study the generated servlet.

JSP Scripting Elements

JSP provides the following scripting elements:

JSP Expression <%= Java Expression %>

JSP Directive <%@ page|include ... %>

To simplify the access of the HTTP request and response messages, JSP has pre-defined the following variables:

JSP comment <%-- comments --%>

JSP comments <%-- comments --%> are ignored by the JSP engine. For example,

Note that HTML comment is <!-- comments --> . JSP expression within the HTML comment will be evaluated. For example,

JSP Expression can be used to insert a single Java expression directly into the response message. This expression will be placed inside a out.print() method. Hence, the expression will be evaluated and printed out as part of the response message.  Any valid Java expression can be used.  There is no semi-colon at the end of the expression. For examples:

The above JSP expressions will be converted to:

You can use the pre-defined variables, such as request , in the expressions. For examples:

JSP Scriptlet <% Java statement(s) %>

JSP scriptlets allow you to do more complex operations than inserting a single Java expression (with the JSP expression). JSP scriptlets let you insert an arbitrary sequence of valid Java statement(s) into the service() method of the converted servlet. All the Java statements in a scriptlet are to be terminated with a semi-colon. For example:

In the converted servlet, the above will be inserted into the service() method as follows:

Notice that the Java codes inside a scriptlet are inserted exactly as they are written, and used as the programming logic. The HTML codes are passed to an out.write() method and written out as part of the response message.

JSP directives provide instructions to the JSP engine. The syntax of the JSP directive is:

JSP page Directive

The " page " directive lets you import classes and customize the page properties. For examples,

JSP include Directive

The " include " directive lets you include another file(s) at the time when the JSP page is compiled into a servlet. You can include any JSP files, or static HTML files. You can use include directive to include navigation bar, copyright statement, logo, etc. on every JSP pages. The syntax is:

For example:

JSP Database Example

Let's revisit our e-shop, which was created using Java Servlet.

Querying - " query.jsp "

Let's create the query page called " query.jsp ".

Notice that JSP carries out the presentation much better and neater than servlet. The presentation can be changed easily with JSP. The JSP pages can be created and modified using a WYSIWYG web authoring tool and reload to see the effect on the presentation.  Whereas, in the case of servlet, you have to explicitly code all the HTML tags inside the servlet program and re-compile the program.

Ordering - " order.jsp "

Let's write the " order.jsp " for processing the order, by updating the appropriate records in the database.

JSP Exercises


Latest version tested: Tomcat 7.0.32, JDK 1.7.0_07 Last modified: October, 2012

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to output HTML from JSP <%! ... %> block?

I just started learning JSP technology, and came across a wall.

How do you output HTML from a method in <%! ... %> JSP declaration block?

This doesn't work:

Server says there's no “out”.

U: I do know how to rewrite code with this method returning a string, but is there a way to do this inside <%! void () { } %> ? Though it may be non-optimal, it's still interesting.

ansgri's user avatar

8 Answers 8

You can't use the 'out' variable (nor any of the other "predeclared" scriptlet variables) inside directives.

The JSP page gets translated by your webserver into a Java servlet. Inside tomcats, for instance, everything inside scriptlets (which start "<%"), along with all the static HTML, gets translated into one giant Java method which writes your page, line by line, to a JspWriter instance called "out". This is why you can use the "out" parameter directly in scriptlets. Directives, on the other hand (which start with "<%!") get translated as separate Java methods.

As an example, a very simple page (let's call it foo.jsp):

would end up looking something like this (with a lot of the detail ignored for clarity):

Ashley Mercer's user avatar

Try this, it worked for me!

Dave's user avatar

I suppose this would help:

Anyway, it isn't a good idea to have code in a view.

paradoja's user avatar

All you need to do is pass the JspWriter object into your method as a parameter i.e.

Then call it via:

The writer object is a local variable inside _jspService so you need to pass it into your utility method. The same would apply for all the other built in references (e.g. request, response, session).

A great way to see whats going on is to use Tomcat as your server and drill down into the 'work' directory for the '.java' file generated from your 'jsp' page. Alternatively in weblogic you can use the 'weblogic.jspc' page compiler to view the Java that will be generated when the page is requested.

Garth Gilmour's user avatar

A simple alternative would be the following:

The you could simply use the variable in any way within the jsp code

Jer Yango's user avatar

You can do something like this:

This will output test 1 2 3 to the page.

Martin's user avatar

too late to answer it but this help others

Alaa Abuzaghleh's user avatar

Not the answer you're looking for? Browse other questions tagged jsp or ask your own question .

Hot Network Questions

how to write html code in jsp

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

HTML tags in JSP

In jsp we have the facility provided to use the html tag inside the JSP code.

how to write html code in jsp

In jsp we have the facility provided to use the html tag inside the JSP code. 

The code of the program is given below:

JSP Tutorial

JSP - Syntax

In this chapter, we will discuss Syntax in JSP. We will understand the basic use of simple syntax (i.e, elements) involved with JSP development.

Elements of JSP

The elements of JSP have been described below −

The Scriptlet

A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language.

Following is the syntax of Scriptlet −

You can write the XML equivalent of the above syntax as follows −

Any text, HTML tags, or JSP elements you write must be outside the scriptlet. Following is the simple and first example for JSP −

NOTE − Assuming that Apache Tomcat is installed in C:\apache-tomcat-7.0.2 and your environment is setup as per environment setup tutorial.

Let us keep the above code in JSP file hello.jsp and put this file in C:\apache-tomcat7.0.2\webapps\ROOT directory. Browse through the same using URL http://localhost:8080/hello.jsp . The above code will generate the following result −

Hello World

JSP Declarations

A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.

Following is the syntax for JSP Declarations −

Following is an example for JSP Declarations −

JSP Expression

A JSP expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP file.

Because the value of an expression is converted to a String, you can use an expression within a line of text, whether or not it is tagged with HTML, in a JSP file.

The expression element can contain any expression that is valid according to the Java Language Specification but you cannot use a semicolon to end an expression.

Following is the syntax of JSP Expression −

Following example shows a JSP Expression −

The above code will generate the following result −

Today's date: 11-Sep-2010 21:24:25

JSP Comments

JSP comment marks text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out", a part of your JSP page.

Following is the syntax of the JSP comments −

Following example shows the JSP Comments −

A Test of Comments

There are a small number of special constructs you can use in various cases to insert comments or characters that would otherwise be treated specially. Here's a summary −

JSP Directives

A JSP directive affects the overall structure of the servlet class. It usually has the following form −

There are three types of directive tag −

We would explain the JSP directive in a separate chapter JSP - Directives

JSP Actions

JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin.

There is only one syntax for the Action element, as it conforms to the XML standard −

Action elements are basically predefined functions. Following table lists out the available JSP Actions −

We would explain JSP actions in a separate chapter JSP - Actions

JSP Implicit Objects

JSP supports nine automatically defined variables, which are also called implicit objects. These variables are −

We would explain JSP Implicit Objects in a separate chapter JSP - Implicit Objects .

Control-Flow Statements

You can use all the APIs and building blocks of Java in your JSP programming including decision-making statements, loops, etc.

Decision-Making Statements

The if...else block starts out like an ordinary Scriptlet, but the Scriptlet is closed at each line with HTML text included between the Scriptlet tags.

Now look at the following block which has been written a bit differentlty using out.println() and inside Scriptletas −

It's Wednesday.

Loop Statements

You can also use three basic types of looping blocks in Java: for, while, and do…while blocks in your JSP programming.

Let us look at the following for loop example −

Above example can be written using the while loop as follows −

JSP Operators

JSP supports all the logical and arithmetic operators supported by Java. Following table lists out all the operators with the highest precedence appear at the top of the table, those with the lowest appear at the bottom.

Within an expression, higher precedence operators will be evaluated first.

JSP Literals

The JSP expression language defines the following literals −

Boolean − true and false

Integer − as in Java

Floating point − as in Java

String − with single and double quotes; " is escaped as \", ' is escaped as \', and \ is escaped as \\.

Null − null


Introduction to JSP File

JSP File is used to create dynamic and fast loading web pages over the network. The file extension used for JSP Files is “.jsp”. For example test.jsp. JSP files contain a global tag “HTML” and under that tag JAVA coding is done to get the responsive feature added to the web platform. If there would not have been JAVA code added then the web page would have been static. JSP files are often considered similar to JAVA servlets if we consider the usage but the added advantage to JSP files is the separation of page design and business logic.

Course Curriculum

How to Create a File in JSP?

One can create a JSP file just like an HTML file but the difference is that a JSP file should be saved with an extension of “.jsp”. It also should have “<html>” tags in the start or end of file. Once these tags are declared then inside html tags JAVA code can be inline. Also, a JSP file can be created separately as a standalone file and then a JSP file can be included in another file like JAVA servlets. Any IDE (Integrated Development Environment) like Eclipse or netbeans can be used to create a new “ dynamic web project”. Providing relevant information like name of main class, requirement of xml descriptors and other details a web project can be created. Once a project is created, a new JSP page can be created in the “WEB-INF” folder under the project.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

File operations in JSP, JSP pages are compiled once and well connected with servlets or JSP as per the project requirements.

There are three tags used to do file operations in JSP and these are:

Examples of JSP File

Given below are the examples mentioned :

test1JSP project

JSP File 1


JSP File 2

JSP pages are a lightweight and quick method to create dynamic web content. The content can be loaded on the fly over the network without much overheads while data exchange. The best advantage offered by JSP pages is the division of “design” and “business logic”. The business logic shows up under JAVA code while design comes from HTML (Hypertext markup language) and CSS (Cascading style sheet). This division simplifies developer’s work and promotes easier project maintenance. JSP is one of the most elegant ways of generating projects on web dynamic development.

Recommended Articles

This is a guide to JSP File. Here we discuss how to create a file in JSP along with programming examples respectively. You may also have a look at the following articles to learn more –


Related Courses


*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy .

Forgot Password?

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy


Explore 1000+ varieties of Mock tests View more

Submit Next Question


// Tutorial //

Jsp example tutorial for beginners.

Default avatar

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Welcome to the JSP Example Tutorial for Beginners. In last few posts, a wrote a lot about Java Servlet and got very good response from our readers. So I have started another series on JSP tutorials and this is the first post of the series.

JSP Example Tutorial

jsp example, jsp tutorial, jsp example programs, jsp programming, jsp tutorial for beginners

JSP Tutorial

What is jsp and why do we need jsp, advantages of jsp over servlets, life cycle of jsp page, life cycle methods of jsp, simple jsp example with eclipse and tomcat, jsp files location in web application war file, jsp api interfaces and classes, jsppage interface, httpjsppage interface, jspwriter abstract class, jspcontext abstract class, pagecontext abstract class, jspfactory abstract class, jspengineinfo abstract class, errordata final class, jspexception class, jsptagexception class, skippageexception class, jsp comments, jsp scriptlets, jsp expression, jsp directives, jsp declaration, jsp transformed servlet source code and class file location in tomcat, jsp init parameters, overriding jsp init() method, attributes in a jsp.

JSP (JavaServer Pages) is server side technology to create dynamic java web application . JSP can be thought as an extension to servlet technology because it provides features to easily create user views. JSP Page consists of HTML code and provide option to include java code for dynamic content. Since web applications contain a lot of user screens, JSPs are used a lot in web applications. To bridge the gap between java code and HTML in JSP, it provides additional features such as JSP Tags, Expression Language, Custom tags. This makes it easy to understand and helps a web developer to quickly develop JSP pages.

JSP life cycle is also managed by container. Usually every web container that contains servlet container also contains JSP container for managing JSP pages. JSP pages life cycle phases are:

JSP lifecycle methods are:

JspPage interface extends Servlet interface and declares jspInit() and jspDestroy() life cycle methods of the JSP pages.

HttpJspPage interface describes the interaction that a JSP Page Implementation Class must satisfy when using the HTTP protocol. This interface declares the service method of JSP page for HTTP protocol as public void _jspService(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException .

Similar to PrintWriter in servlets with additional facility of buffering support. This is one of the implicit variables in a JSP page with name “out”. This class extends and container provide their own implementation for this abstract class and use it while translating JSP page to Servlet. We can get it’s object using PageContext.getOut() method. Apache Tomcat concrete class for JspWriter is org.apache.jasper.runtime.JspWriterImpl .

JspContext serves as the base class for the PageContext class and abstracts all information that is not specific to servlets. The JspContext provides mechanism to obtain the JspWriter for output, mechanism to work with attributes and API to manage the various scoped namespaces.

PageContext extends JspContext to provide useful context information when JSP is used for web applications. A PageContext instance provides access to all the namespaces associated with a JSP page, provides access to several page attributes, as well as a layer above the implementation details. Implicit objects are added to the pageContext automatically.

The JspFactory is an abstract class that defines a number of factory methods available to a JSP page at runtime for the purposes of creating instances of various interfaces and classes used to support the JSP implementation.

The JspEngineInfo is an abstract class that provides information on the current JSP engine.

Contains information about an error, for error pages.

A generic exception known to the JSP container, similar to ServletException.If JSP pages throw JspException then errorpage mechanism is used to present error information to user.

Exception to be used by a Tag Handler to indicate some unrecoverable error.

Exception to indicate the calling page must cease evaluation. Thrown by a simple tag handler to indicate that the remainder of the page must not be evaluated. This exception should not be thrown manually in a JSP page.

Thats all for JSP example tutorial for beginners. I hope it helps you in understanding the basic concepts of JSPs and help you in getting started. We will look into other JSP features in future posts.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

Still looking for an answer?

very nice description sir… thanks.

- supriya kavade

can you please add some more example on custom tag

The ide i use is Intellij idea, but i cannot find the jsp transformed source files and servlet classes

Hello Pankaj, Your articles are really nice but only problem are the frequent pop-ups which really destruct the concentration. It will be really nice if you shift them to the bottom/top or on side bars. Warm Regards Rony

- Rony Ghosh

excuse me, please help i have problem in jsp thanks org.apache.jasper.JasperException: An exception occurred processing JSP page /dokter.jsp at line 14 11: 12: 13: <% 14: DokterController dk = new DokterController(); 15: String dokid = “”; 16: String doknamadokter = “”; 17: String doktempattgllahir = “”;

Java scriptlets(())have been obsolete and discredited since the introduction of JSP 2.0 and there are many good reasons not to use Java scriptlets in JSPs 1. Readability 2. Reusability 3. Maintainability 4. Scriptlets Break OOP

good Tutorial, thanks

- Cara Mengunci Folder

Thanks a lot, for posting tutorials on JSP.

- Rakhi Dhavale

Nice tutorial …

Creative Commons

Popular Topics

Try DigitalOcean for free

Join the tech talk.

Please complete your information!

write html in jsp

Report post to moderator

Life called,so here I am.<br />Cheers<br />Niki.:-)

how to write html code in jsp

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf

Javatpoint Logo

JSP Tutorial


Help Others, Please Share


Learn Latest Tutorials

Splunk tutorial


Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial



Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

Javatpoint Services

JavaTpoint offers too many high quality services. Mail us on [email protected] , to get more information about given services.

Training For College Campus

JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected] Duration: 1 week to 2 week

RSS Feed

Related Articles

Introduction to JSP


JSP pages are more advantageous than Servlet:

Features of JSP

JSP syntax Syntax available in JSP are following

Process of Execution Steps for Execution of JSP are following:-

Example of Hello World We will make one .html file and .jsp file

Advantages of using JSP

Disadvantages of using JSP

Please Login to comment...

Improve your Coding Skills with Practice

Start your coding journey now.

A Simple JSP Page Example

The web page in Figure 5–1 is a form that allows you to select a locale and displays the date in a manner appropriate to the locale.

Figure 5–1 Localized Date Form

The source code for this example is in the tut-install /javaeetutorial5/examples/web/date/ directory. The JSP page, index.jsp , appears below; it is a typical mixture of static HTML markup and JSP elements. If you have developed web pages, you are probably familiar with the HTML document structure statements ( <head> , <body> , and so on) and the HTML statements that create a form ( <form> ) and a menu ( <select> ).

The lines in bold in the example code contain the following types of JSP constructs:

A page directive ( <%@page ... %> ) sets the content type returned by the page.

Tag library directives ( <%@taglib ... %> ) import custom tag libraries.

jsp:useBean is a standard element that creates an object containing a collection of locales and initializes an identifier that points to that object.

JSP expression language expressions ( ${ } ) retrieve the value of object properties. The values are used to set custom tag attribute values and create dynamic content.

Custom tags (see Chapter 8, Custom Tags in JSP Pages ) set a variable ( c:set ), iterate over a collection of locale names ( c:forEach ), and conditionally insert HTML text into the response ( c:if , c:choose , c:when , c:otherwise ).

jsp:setProperty is another standard element that sets the value of an object property.

A function ( f:equals ) tests the equality of an attribute and the current item of a collection. (A built-in == operator is usually used to test equality.)

Here is the JSP page:

To deploy the date application with NetBeans IDE, follow these steps:

Start the Application Server.

In NetBeans IDE, select File->Open Project.

In the Open Project dialog, navigate to:

Select the date folder.

Select the Open as Main Project check box.

Click Open Project.

In the Projects tab, right-click the date project, and select Undeploy and Deploy.

To deploy the date application with the Ant tool, follow these steps:

In a terminal window, go to tut-install /javaeetutorial5/examples/web/date/ .

Type ant . This command will spawn any necessary compilations, copy files to the tut-install /javaeetutorial5/examples/web/date/build/ directory, and create a WAR file.

Type ant deploy .

To run the example, do the following:

Set the character encoding in your browser to UTF-8.

Open your browser to http://localhost:8080/date .

You will see a combo box whose entries are locales. Select a locale and click Get Date. You will see the date expressed in a manner appropriate for that locale.

Some of the characters might not display properly if you don’t have the appropriate language files installed on your machine. Consult the user guide or online help for your operating system to determine how you can install these language files.


  1. How to write html code? ~ Start your coding world

    how to write html code in jsp

  2. How to write html code? ~ Start your coding world

    how to write html code in jsp

  3. JSP Scripting Elements with Example

    how to write html code in jsp

  4. 34 How To Write Javascript Code In Jsp Page

    how to write html code in jsp

  5. JSP in Eclipse

    how to write html code in jsp

  6. 34 Write Html And Javascript Code For Multiplication Table Of 5

    how to write html code in jsp


  1. How ChatGPT write html code? #shorts

  2. Web Project in JSP Part 1 using jsp servlet jdbc and front end html css bootstrap

  3. #shorts use ChatGPT write html code . #chatgpt #openai

  4. how to write html code

  5. Important abbreviations that you should know if you write Html code

  6. HTML Tutorial For Beginner ।। সহজেই HTML শিখি ।। HTML কী? পর্ব- ০১


  1. How Does HTML Code Work?

    HTML is to a website what a solid foundation is to a house. Without HTML code, web developers wouldn’t have anything to build on. In other words, you wouldn’t be able to read this article without proper HTML code. Learn more about how this ...

  2. How to write HTML code faster

    Speed up your HTML and CSS workflow using Emmet and Pug. Creative Bloq is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more By Matt Crouch ( Web Designer ) published 9 De...

  3. How to Convert HTML to JSP

    JSP allows you to embed snippets of the Java programming language into HTML tags to create interactive content. HTML pages are static in that each time a user loads the page, the content will appear the same. JSP allows you to embed snippet...

  4. Getting Starting with JSP with Examples

    2. First JSP Example - "Java inside HTML" · A JSP script is a regular HTML page containing Java programs. Recall that JSP is "Java inside HTML" (whereas servlet

  5. How to output HTML from JSP <%! ... %> block?

    The JSP page gets translated by your webserver into a Java servlet. Inside tomcats, for instance, everything inside scriptlets (which start "<%")

  6. Include Html in JSP Page

    In this JSP Tutorial, we will see how to include html file inside a JSP page using include page directive.Code Snippet:

  7. HTML tags in JSP

    In jsp we have the facility provided to use the html tag inside the JSP code. In this example we have used the html tag inside the println() method of the out

  8. JSP

    A JSP expression element contains a scripting language expression that is evaluated, converted to a String, and inserted where the expression appears in the JSP

  9. JSP File

    The file extension used for JSP Files is “.jsp”. For example test.jsp. JSP files contain a global tag “HTML” and under that tag JAVA coding is done to get the

  10. JSP Example Tutorial for Beginners

    Since web applications contain a lot of user screens, JSPs are used a lot in web applications. To bridge the gap between java code and HTML in

  11. write html in jsp

    To add html in jsp you need to include it in the out.println() function. ... out.println("<meta HTTP-EQUIV=\"REFRESH\" content=\"1; url=http://

  12. Learn JSP Tutorial

    To create the first JSP page, write some HTML code as given below, and save it by .jsp extension. We have saved this file as index.jsp. Put it in a folder

  13. Introduction to JSP

    It stands for Java Server Pages. · It is a server side technology. · It is used for creating web application. · It is used to create dynamic web

  14. A Simple JSP Page Example (The Java EE 5 Tutorial)

    The JSP page, index.jsp , appears below; it is a typical mixture of static HTML markup and JSP elements. If you have developed web pages, you are probably