You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rajat Nayer <ra...@yahoo.com> on 2003/06/19 13:26:36 UTC
Perform() of action class is not called
Hi!!!
I am trying to invoke an EJB from the Action class
thru the perform() method. However, the perform method
is not called - the println's do not show up on the
server console nor is any error thrown.
---------<<<<!-- ========== Form Bean Definitions
================= -->
<form-beans>
<form-bean name="submitForm"
type="hansen.playground.SubmitForm"/>
</form-beans>
<!-- ========== Action Mapping Definitions
============ -->
<action-mappings>
<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>
</action-mappings>
-----------------------------------
-------<<<Action class's perform method>>>-------
public ActionForward perform(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)throws IOException,
ServletException {
System.out.println("perform called !!!");
SubmitForm f = (SubmitForm) form; // get the form
bean
// and take the last name value
String lastName = f.getLastName();
// Translate the name to upper case
//and save it in the request object
request.setAttribute("lastName",
lastName.toUpperCase());
/***** Calling EJB ***************************/
String op="";
try {
System.out.println("getting initial context");
Context ctx = getInitialContext();
System.out.println("initial context got !!");
DemoHome home = (DemoHome) ctx.lookup("Demo");
System.out.println("home got !!");
Demo ac = null;
try {
ac = (Demo) home.create();
System.out.println("create called!!");
if (ac==null)
System.out.println("ac is null!");
}
catch (Exception ee) {
System.out.print("exception 1");
}
System.out.println("going to call method!");
if (ac!= null)
op = ac.demoSelect();
else
System.out.println("ac is null->error!!");
//out.println(ac.demoSelect());
//out.println("string got!!");
System.out.println("String="+op);
}
catch (Exception e) {
e.printStackTrace();
System.out.println("error 2");
}
/*********************************************/
// Forward control to the specified success target
return (mapping.findForward("success"));
}
---------------------------------------
What is wrong???
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org