aspose file tools*
The moose likes JSP and the fly likes Problem with jsp forward Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with jsp forward" Watch "Problem with jsp forward" New topic
Author

Problem with jsp forward

nick angel
Ranch Hand

Joined: Dec 14, 2005
Posts: 39
Hello to everyone. The problem is as follows. I have a form that needs to be submitted which has the following form:



The jsp CompleteRequest.jsp does some processing to the parameters(formatting) and logs a cookie.
Then depending on the value userType received, I wish to redirect to another page.
I know that using a servlet for processing would be the ideal choice, but we were asked to use a jsp as an
intermediate for the small amount of formatting.
In the CompleteRequest.jsp I had written the following:



This however does not seem to work. I did a little checking and figured out that I cannot use absolute paths.
Also I was just wondering if it is possible to not leave any trace of html code in case the process gets held up in the intermediate page for some reason.

I was just wondering if anyone could point me in the right direction. Any help or advice would be greatly appreciated.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Originally posted by nick angel:
I know that using a servlet for processing would be the ideal choice, but we were asked to use a jsp as an intermediate for the small amount of formatting.


This makes no sense to me. Your instincts are correct -- why were youu asked to use a JSP to do a servlet's job?

In any case, you cannot forward to a resource on another server. You'll need to do a redirect.
[ March 02, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

I would rather do a send redirect from a servlet, like Bear suggested. That JSP is just sitting there with some controller logic and it was supposed to be the view. What is worse is that the user will never see any useful content on this page. He will simply be redirected to some other page, which means your view has completely been transformed to a controller. Use a servlet instead


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
nick angel
Ranch Hand

Joined: Dec 14, 2005
Posts: 39
Thank you both for your prompt response. I am glad my instincts were right.
I a still a student and I don not pretend to know all. However some of our teaching assistants
in my humble opinion, have learned a language but not how to actually use the tools they have learned.
While other T.A s are great some leave a lot to be desired, as is this particular case.
Again thank you for your time and help.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with jsp forward