Struts2 Exception Handling - exception

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

Related

Could anyone help me understand as to why my code won't work for redirecting one page to another, without the use of JavaScript?

I made two separate HTML4 files on WebStorm, and I need to redirect this one to the second one. All I did was copy the URL from Google from the second page and add it to the url meta tag. Is this not correct?
P.S. For some reason it displays the <u> tag as obsolete, even though I'm writing on HTML4 files. Why is that?
This is the first HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="mk">
<head>
<meta name="description" content="This is a test page">
<meta name="keywords" content="Web Design, FCSE, 2011, HTML, CSS">
<meta http-equiv = "refresh" content = "5; url = http://localhost:63342/BWD_Lab_01/HTML%20page%202.html?_ijt=n5m9mhg1hijdt8f1ssmgkv0en&_ij_reload=RELOAD_ON_SAVE" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="mk">
<title>First Page for the task 3</title>
</head>
<body>
In 5 seconds you will be redirected to the next page!
</body>
</html>
And this is the second page that it should redirect to:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="mk">
<head>
<meta name="description" content="This is a second test page">
<meta name="keywords" content="final page, HTML, second page">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Language" content="mk">
<title>Second page for task 3</title>
</head>
<body>
<h1> Welcome to the second page.</h1>
<p> This is my first time working with Webstorm.</p>
</body>
</html>

Background image not showing in jsp dynamic web project

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.

Codification in JSP Imports

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>

HTML redirect to about:newtab

I simply want to do whats posted below but nothing happens when opening the HTML file.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="1;url=about:newtab"></HEAD>
<BODY>
Optional page text here.
</BODY>
</HTML>

Embedding and HTML document in another: how do I make it auto-size?

I have a bunch of html help files and my boss wants them to be all in one giant file as well, for printing. I want to just embed them all into a single html page and I need the <object/> to auto-size to fit the entire page within the page.
doing it this way:
<object type="text/html" data="My.html"/>
Open to doing it another way if anyone has better suggestions, but this is just a real simple task so I want to keep it as simple as I can.
Thanks all!
EDIT:
This is all the html I'm using just for testing purposes.
<!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">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Default</title>
</head>
<body>
<iframe style="height:100%;width:100%" src="test.html"/>
</body>
</html>
The embedded document:
<!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">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Default</title>
</head>
<body>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
<p>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</p>
</body>
</html>
Use :
<object style="width:100%;height:100%;" type="text/html" data="My.html"/>
That works for me (IE 9.0, Firefox 7.0.1).