CodesJava

Easy learning with example program codes

contentType attribute in JSP page directive

This attribute is used to set the content type of the current JSP page.

Syntax:

<%@ page contentType="value"%>

Example:

welcome.jsp

<%@ page  contentType="application/msword" %>  
 
<html>
	<head>
		<title>contentType page directive example</title>
	</head>
	<body>
	  <h3>Hello this is a contentType page directive example.</h3>
	</body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>welcome.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 10
 
Download this example.
 
Next Topic: isErrorPage and errorPage attribute in JSP page directive with example.
Previous Topic: autoFlush attribute in JSP page directive with example.

 

Please follow and like us:
error
Posted in JSP   








Copyright © 2019 CodesJava DMCA.com Protection Status