• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some problem with local Forward

 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have one action in which I am trying to forward to three different pages depending on three different conditions.

Its working fine for success and failure but it doesnt work with the third codition. I get blank page.


<action path="/testAction" type="com.test.TestAction" parameter="action"
input="/TestInput.jsp" name="TestBean" scope="request">

<forward name="success" path="/success.jsp"/>
<forward name="getQuestion" path="/GetQuestion.jsp" />
<forward name="failure" path="/failure.jsp"/>
</action>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A blank page generally means that the action class returned a null ActionForward, which can happen if the findForward method doesn't find anything. My best guess is that the problem is a misspelling in your Action class. Are you 100% sure that the statement is spelled correctly, and that it actually gets executed?
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill,

I rechecked it, it is spelled correctly and getting executed too.
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two modules in this applicaton, is it creating problem. But then it should create for success and failure also. But success and failure is working. getQuestion is not working
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you post the relevant portion of your action class? That might provide some insight.
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public ActionForward process( ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response)
throws Exception
{


...
...
...
...
...

if (user.getSecretQuestionId() == null || user.getSecretQuestionId().intValue() <= 0) {
log.debug("Forwarding to getQuestion");
//return new ActionForward("success1");
return mapping.findForward("getQuestion");

//return mapping.findForward("failure");
}

log.debug( "forward to input page" );
return new ActionForward( mapping.getInput() );
)
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming that the debug statement "Forwarding to getQuestion" is getting logged.

Do you have any debug statements in your JSP "GetQuestion.jsp"?

Do you have a try catch in your JSP? Are you eating up exceptions that might be thrown in your JSP?

Do you see any output on your server console? or in the server logs?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The next thing I'd look at would be the GetQuestion.jsp. Are you sure it exists and is coded properly? Try renaming the current one and substituting it with one that has nothing in it but "This is GetQuestion.jsp". If this JSP displays correctly and the other one doesn't, you know it's a problem with the JSP.
 
Sandeep Awasthi
Ranch Hand
Posts: 597
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Merrill & Sheldon,

Thank you very much for trying to help me. I did very stupid mistake. I added <forward name="getQuestion" ....... /> to some other action in action mapping than the intended one. But really thanks alot.

Kind Regards

Rajesh
[ March 22, 2007: Message edited by: Rajesh Thakare ]
 
Sheldon Fernandes
Ranch Hand
Posts: 157
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome. Glad that you found the problem.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic