This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You normally use RequestDispatcher#forward() for this.
But you say, you have raw Java code in a JSP file? Immediately move it out into a Java class like a servlet before it's too late. Scriptlets indicate in any way a design flaw and are thus a bad practice.
I know it's a bad practice, but I need to do in this way for now...
how can I get RequestDispatcher and ActionMapping in my java code in my jsp?
Thank you very much!
Joined: Oct 08, 2006
ActionMapping? Isn't it part of Struts? If so, then the trouble is bigger. Struts is already a MVC framework at its own. You should be doing this logic in a Struts action class or whatever it provides you to control and handle requests programmatically.
The excuse "doing in this way for now" makes no utter sense. You either don't understand Struts nor the MVC concepts at all or you have another problem which you didn't elaborate about at all and for which you think that this is the solution. I.e. you're asking how to achieve a workaround instead of asking how to solve an actual problem.