Hi I am trying to use a background image in home.jsp page.when i run the project image is not loading a red cross mark is showing instead of the image
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%#taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="ac-styles.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Home Page</title>
</head>
<body >
<img src="img/bg.png">
<p> Hello This Is The Home Page For your J2ee Spring Application</p>
</body>
</html>
I had placed the image under
when i run the application the result is
please help..
Thanks in advance..
The JSP file is not in the same folder as of image file root folder is present. So either you have to move your .jsp file in web-content folder or you should use backspace commands like:
<img src="../../img/bg.png">
This should work.
Conversely the best method would be to migrate your image file in web-inf/views folder.That would be easy but not recommended for big projects.
note that I included "../" two times. In your directory structure it
is needed. For more information read the refering manual for HTML
src's.
Related
Its my first introduction into using aspx pages from originally creating html pages.
I am trying to link an external CSS page to the index.aspx page and it is not pulling through anything.
Maybe im not referencing it correctly or it needs to be in a specific directory, Im not too sure.
See below
<%# Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<meta name="viewport" content="width=device-width" />
<title>TestTitle</title>
<link href="Styles/Main.css" type="text/css" rel="stylesheet" />
</head>
<body>
<p class="testp">HI MY NAME IS HARRY</p>
</body>
</html>
And this is the CSS code
body {
font-size: 36px;
}
.testp {
font-family:'Bradley Hand ITC';
}
Nothing hectic, im just testing the waters.
See directory below
If i could please get som help , or maybe a better way of doing it correctly.
Thanks
I have written some Gujarati text as follows in html page.
Test Prescribbed/તપાસ કરાવવી
But the browser shows like
Test Prescribed/તપાસ કરાવવી.
Please give the solution
Add request.setCharacterEncoding("utf-8"); to your HTML page.
Actually gujarati fonts are in utf-8 format. If you are using Gujarati then in your html page following line should be there.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
But you should remove other specifications like if you are using jsp page than
<%# page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
line should be removed because you are specifying in meta tag. You need only meta tag.
Add the following line in your HTML.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
How can I set single error page for every errors occured during
Execution in Struts2. My error page is as below.
error.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%# taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>HOME</title>
</head>
<body>
<center>
<h2 style="color: red;">Error Occurred during processing your Request...!!!!</h2>
</center>
<hr/>
</body>
</html>
You need global exception configuration. Take a look at this
Good night.
I'm having trouble import static html page to a JSP page with UTF-8.
My JSP is UTF-8. I Write my HTML fragment with UTF-8, but I include with <%#include file="includes/menu.html"%>, the text is with the wrong encoding.
My JSP is complex, but my html is, an simple example:
<div>
<ul>
<li>Text with Á (acentuation)</li>
</ul>
</div>
Is very simple html, containing the application menu, but this error is occurring.
A very simple JSP is:
<%# page contentType="text/html;charset=UTF-8" language="java" %>
<%# taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<title>Example</title>
</head>
<body>
<%#include file="includes/menu.html"%>
</body>
PS: if I put directly in JSP, it works normally.
The solution to this problem is to change the menu.html to menu.jsp and on the top of the new file add
<%#page contentType="text/html" pageEncoding="UTF-8"%>
and then include this jsp in your page
<body>
<%#include file="includes/menu.jsp"%>
</body>
I have what amounts to very basic HTML inside of a JSP page of my Java web-app. The crux of what I'm trying to do is wrap text in an input button of fixed width (IE7). It does not work in my JSP (the text is cutoff). However, if I create an HTML file and open it with the same browser, it works fine. The contents of the .JSP and .HTML are the same, as posted below. What am I missing here? Shouldn't they behave the same?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test</title>
</head>
<body>
<input type="button" value="A lot of descriptive text on a button" style="width:100px; white-space:normal;" />
</body>
</html>