Posts

Showing posts from April, 2017

Struts2 actionError and actionMessage.

Image
Download code and jars :  Link. File : index.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>Index page</title> </head> <body> <center> <s:if test="hasActionErrors()"> <div> <span style="text-align: center; color: red; font-size: 17px;"><s:actionerror /></span> </div> </s:if> <s:if test="hasActionMessages()"> <div> <span style="text-align: center; color: green; font-size: 17px;"><s:acti

Upload Profile Picture or File using JSP, Struts2 | Code Factory

Image
Download code and jars :  Link. File : temp.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1"     pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.action"> <title>Insert title here</title> </head> <body> </body> </html> File : index.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=&qu

How to get full path of an file or image in Struts2?

String filePath = ServletActionContext.getServletContext().getRealPath("/");

How to implement methods of extended class or implemented interface in java?

Image
In Eclipse right click in class file -> source -> Override/Implement methods...