0

i have written a simple code to display an image using Jsp XHTML template but it is not working but same is working when i am using Jsp HTML template ....

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Car Details</title>
</head>
<body>
<f:view>
<h:graphicImage id="root" value="http://www.allbestwallpapers.com/tagwallpaper/convertible%20car-wallpapers.jpg"></h:graphicImage>
</f:view>
</body>
</html>

please Help....

zytham
  • 594
  • 1
  • 11
  • 27
  • There should be no scriplets, see also http://stackoverflow.com/questions/4441713/migrating-from-jsf-1-2-to-jsf-2-0 or use the New JSP File(xhtml,xml syntax, JSP 2.0) template – Ravi Kadaboina Jul 12 '12 at 16:00

1 Answers1

1

You're mixing JSP (foo.jsp) with Facelets (foo.xhtml).

JSP is the ancient view technology which was the default in JSF 1.x. It is not XML based. Facelets is the successor of JSP and is the default view technology since JSF 2.0 (and JSP became deprecated). Facelets is XML based. Those xmlns XML namespace declarations don't work in JSP, but in Facelets only.

Rename the filename from the .jsp extension to .xhtml extension and get rid of that JSP specific @page declaration and it'll work.

BalusC
  • 992,635
  • 352
  • 3,478
  • 3,452