File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get blank page for "Struts IN Action" first example ?

 
steve francisco
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Tomcat 5.5 to try two examples. One is the first example "/register" in book "Struts in action" and the other is http://javaboutique.internet.com/tutorials/Struts/ example.

In both examples, I got the .jsp page but after I clicked the "submit" I saw BLANK page. I checked the code I cut/paste nothing is wrong. The URL also looks fine (..../register/submit.do?username=..&password=..), just don't know why it doesn't forward to the desired page ? Anybody encountered the same problem ?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A blank page usually means that the forward returned by your Action class was not correctly defined as a forward in your struts-config.

Common causes for this are typos, forgetting to add a particular forward to an ActionMapping, or the Action class returning null.
 
steve francisco
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe you guys don't believe, I really can't find any problem with the code I "pasted". Here are a snippet --

In the Action class, I just simply " return (mapping.findForward("success"));" at the end

In the struts-config.xml, I have <forward name="success" path="/success.html"/>

and I do have a "success.html" placed at the same level as WEB-INF.

really confused, what's wrong ? I see the URL shows "../submit.do?name=...&password=..." but the page is just blank...
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is possible that the execute method is not defined properly.

One of the most common causes that I see of this here at the ranch is when someone is trying to use an old tutorial with a newer version of Struts. The primary method of Action used to be perform but now it is execute.

The default behavior of the execute method is to return null, which will give a blank page because an ActionForward of null will not be found!
 
steve francisco
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marc Peabody:
It is possible that the execute method is not defined properly.

One of the most common causes that I see of this here at the ranch is when someone is trying to use an old tutorial with a newer version of Struts. The primary method of Action used to be perform but now it is execute.

The default behavior of the execute method is to return null, which will give a blank page because an ActionForward of null will not be found!


You're the man ! That's the reason ! Thanks a million
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic