troubleshooting Question

<action forward request on jsp page is null

Avatar of komlaaa
komlaaa asked on
JSPJava EE
1 Comment1 Solution732 ViewsLast Modified:
This is a continuation of:question Q_23427531.html  At
https://www.experts-exchange.com/Programming/Languages/Java/J2EE/JSP/Q_23427531.html

my Action class and failure.jsp page  look like shown below.

when i am forwarded to failure.jsp, my screen shows:
Errors occurred:
null

meaning there were no exception, but i am unable to print the request set in action class JUST go to success page,  Also see, customer.jsp and a snippet of strut-config.xml



try {
    	request.setAttribute("errorMessage" , "++++++ Before HibernateTransaction");
			// perform list customer operations
			CommandExecutor.getInstance().executeHibernateCommand(
							new CreateCustomer(currentCustomer));
			request.setAttribute("customer",currentCustomer );
		request.setAttribute("Inside try block -- customer", currentCustomer );
		}
    	catch (Exception e) 
    	{
    		System.out.println("######Inside catch block########");
    		request.setAttribute("errorMessage", "#Inside catch block#" + e.getMessage());
			throw new ServletException(e);
		}
    	
    	request.setAttribute("errorMessage", "everything seem fine -- After Catch block");
		return mapping.findForward("success");
 
	}
 
failure.jsp look
 
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Failure has occurred</title>
</head>
<body>
 
<B>Errors occurred: <br></B>
<%= request.getParameter("errorMessage") %>
<html:errors/>
</body>
</html>
 
===== strut-config snippet =====
<action 
      path="/createCustomer"      
      name="createCustomerForm"
      input="/form/createCustomer.jsp"
      scope="request"       
      type="actions.CreateCustomerAction">
      <forward name="success" path="/form/createdOrder.jsp" />
      <forward name="failure" path="/failure.jsp"></forward>
    </action>
 
======== customer.jsp where the request comes from ==========
<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
 
<html> 
	<head>
		<title>JSP for CreateCustomerForm form</title>
	</head>
	<body>
		<html:form action="/createCustomer"  method="post">
			Email : <html:text property="email"/><html:errors property="email"/><br/>
			FirstName : <html:text property="firstName"/><html:errors property="firstName"/><br/>
			LastName : <html:text property="lastName"/><html:errors property="lastName"/><br/>
			<html:submit/><html:cancel/>
		</html:form>
	</body>
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros