my dog learned polymorphism*
The moose likes Struts and the fly likes Runing an example struts application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Runing an example struts application" Watch "Runing an example struts application" New topic
Author

Runing an example struts application

sudhakar Tadepalli
Ranch Hand

Joined: Dec 27, 2001
Posts: 130
I am trying to run rr_lesson1 project on WSAD5.0.
"http://www.reumann.net/struts/lesson1.do."
After enetering name and age and press submit button i am getting blank page and log shows like this.Can any one tell me what this means? and how to fix it?. I tried all the lessons and getting the same problem whn submits.


[4/11/05 19:02:52:661 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Processing a GET for /setUpEmployeeForm
[4/11/05 19:02:52:661 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Setting locale 'en_US'
[4/11/05 19:02:52:661 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Looking for ActionForm bean under attribute 'employeeForm'
[4/11/05 19:02:52:661 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Creating new ActionForm instance of class 'net.reumann.EmployeeForm'
[4/11/05 19:02:52:691 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Storing instance under attribute 'employeeForm' in scope 'request'
[4/11/05 19:02:52:701 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Populating bean properties from this request
[4/11/05 19:02:52:701 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Validating input form properties
[4/11/05 19:02:52:701 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Looking for Action instance for class net.reumann.SetUpEmployeeAction
[4/11/05 19:02:52:721 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Double checking for Action instance already there
[4/11/05 19:02:52:721 PDT] 2df70b40 WebGroup I SRVE0180I: [Struts rr lesson 2] [/rrlesson2] [Servlet.LOG]: action: Creating new Action instance

Thanks
Sudhakar
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
One possible cause of the problem of a blank page being returned in a Struts application is that of returning a null forward from the execute() method of an action class. Check to see that you have a statement similar to this:

return mapping.findForward("xyz");

at the end of your execute() method. Then check to see that the "xyz" represents a valid global forward, or a local forward for this action as defined in your struts-config.xml file.


Merrill
Consultant, Sima Solutions
sudhakar Tadepalli
Ranch Hand

Joined: Dec 27, 2001
Posts: 130
Thank you for your suggetion. It is a local forward and looks like this.

public final class InsertEmployeeAction extends Action {

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
System.out.println("Here ..11");
EmployeeService service = new EmployeeService();
EmployeeForm employeeForm = (EmployeeForm) form;
EmployeeDTO employeeDTO = new EmployeeDTO();
BeanUtils.copyProperties( employeeDTO, employeeForm );
service.insertEmployee( employeeDTO );
request.setAttribute("employee",employeeDTO);
return (mapping.findForward("success"));
}
}

///struts-config.xml

<struts-config>
<!-- Form Bean Definitions -->
<form-beans>
<form-bean name="employeeForm" type="net.reumann.EmployeeForm"/>
</form-beans>
<!-- Action Mapping Definitions -->
<action-mappings>
<action path="/setupEmployeeForm" forward="/employeeForm.jsp"/>

<action path="/insertEmployee"
type="net.reumann.InsertEmployeeAction"
name="employeeForm"
scope="request"
validate="false"
>
<forward
name="success"
path="/confirmation.jsp"/>
</action>
</action-mappings>
<!-- message resources -->
<message-resources
parameter="ApplicationResources"
null="false" />
</struts-config>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Here are some more things to check:

  • use the browser's "view source" function to look at the blank page. Sometimes a page is being produced, but it has malformed html, and doesn't display.
  • Verify that action="insertEmployee" is specified on your <html:form> tag.

  • Put System.out.println() statements in your execute() method to verify that it is actually getting called.
  • change the way you're getting the forward so you can see whether it's successful or not, as in this example


  • sudhakar Tadepalli
    Ranch Hand

    Joined: Dec 27, 2001
    Posts: 130
    I just figured the problem..Actually there is no problem with the WAR file, I just installed WSAD5.1.1 and ran the application it just works fine. Thank you for your help...I need one more help..I neeed to write left navigation jsp which i can in clude in my tiles lay out. I need a navigation which will have child links when you click on main link..and highliting the selected one etc..can some one give me an example or URL's ? Appreciate it.

    Thanks
    Sudhakar
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: Runing an example struts application
     
    Similar Threads
    Stopping/Starting through WAS admin console
    Action Mapping not found- Please help
    WSAD + Struts File Upload doesn't work?
    issue with struts1.0 to 1.1 upgrade
    how to prepopulate FormBean