• Post Reply Bookmark Topic Watch Topic
  • New Topic

Forward from java class  RSS feed

 
Fouad Fares
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
I have the following scenario :
I have jsp that call a java class with the following code :
-----------------------
<jsp:useBean id="ssoObj" scope="application" class="SSOEnablerJspBean" />
String usrInfo = ssoObj.getSSOUserInfo(request, response);
-----------------------
This class make some business rule .
I want to make a forward to another jsp from this java class .
How can i make it without using the response.getwriter.println("<Html>...,/html>")
i'm using the Jdeveloper 3.2.3 and i want to deploy my web application
to the 9iAS realese 2 .
Thank you in advance ,
fouad fares .
 
Eelco den Heijer
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the forward( request, response) method from the RequestDispatcher interface.

Make sure you don't write anything to the output before doing a forward (otherwise the servlet container will raise an IllegalStateException).
Also make sure to do 'nothing' after the method call to forward (after the forward, the method will return as a normal method call).
Hope this helps.
 
Fouad Fares
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Phil ,
thank you for your reply .
I insert the following code as your email in java class :
try
{
String s_url = "Login.jsp";
p_request.setAttribute("REQUESTURL",m_requestedUrl);
p_request.setAttribute("ERROR",l_userName[0][1]);
RequestDispatcher requestDispatcher = p_request.getRequestDispatcher(s_url );
requestDispatcher.forward( p_request, p_response)
}
catch (Exception e)
{
system.out.println(e.getmessage());
}
But when the cursor try to execute the forward method it handles an exception and the error message is null ;
Could you please advise the nature of this problem ?
Thank uou in advance,
fouad
 
Nagendra Prasad
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May need some troubleshooting.. and perhaps you have already addressed this in a new thread you have posted...
one suggestion would be to provide a specific hard coded message to see if it works.
If the l_username parameter is null, try assigning an empty string instead.
 
Fouad Fares
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
i make changes like you say me .
l_username[0][1] = "test" ;
But always on running mode it catches the exception .
and when i try to read the message getMessage it returns null .
All the variables are filled and valid .
Thank you
best regards .
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!