Posts

Showing posts matching the search for struts

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=...

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...

Struts2 Hibernate Example With XML

Image
Download code and jars :  Link. File : index.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="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <center> <br> <br> <form action="insertData" method="post"> First Name : <input type="text" name="firstName"> <br> <br> Last Name : <input type="text" name="lastName"> <br> <br> <input type="submit" value="Submit"> </form> </center> </body> </html> ...

DisplayTag with Struts2 | Code Factory

Image
Part 1 : Part 2 : Download code and jars :  Link. File : emp.java package com.codeFactory; public class emp { private String name; private String email; public emp(String name, String email) { this.name = name; this.email = email; } public String getName() { return name; } public String getEmail() { return email; } } File :  getData .java package com.codeFactory; package com.codeFactory; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import org.apache.struts2.interceptor.ServletRequestAware; import com.opensymphony.xwork2.ActionSupport; public class getData extends ActionSupport implements ServletRequestAware{ HttpServletRequest request; public String execute() { List empList = new ArrayList (); empList.add(new emp("parth", "parth@p.co")); empList.add(new emp("patel", "patel@p.co")); empList.add(new emp("emp1", ...