Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to avoid using formbean and redirect to another JSP ?

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In one of my JSP pages, I need to press a button and move to another JSP. There is no business logic to put in an action, nor any request parameters to be captured by the form bean. I know that I can forward using html:link and ForwardAction class, but I want to do this from a button press and not from a link. How do I do that ?

Thanks
Devi
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way to do it would be like this:

<html:button property="myButton" value="click me" onklick="location.replace('myOtherPage.jsp')" />
 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but I didn't want to link directly from one JSP to another, since thats not a good practice. Every redirection should happen through the controller. So finally I used a blank form bean along with ForwardAction and posted to it using html:form. That worked, but now I have another problem.
I have a flash movie on the JSP page to which I'm redirecting. This flash movie is not playing when I redirect like this through the ActionServlet.
The page keeps loading as shown by the progressbar on the browser, but never completes rendering. The title and text at the top does appear. Why could this be happening ? However, it loads the page and plays the flash movie immediately when I provide a direct link to the JSP page itself.
Please advice.

Thanks
Devi
 
Manesh Kumar
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use..



Then using Javascript (write within the function which will be called by click of the button) to redirect to the url
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic