This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hai, can any body please provide me the model code to call a servlet from a jsp.
thanks in advance. [ June 13, 2006: Message edited by: Bear Bibeault ]
Thanks and Regards,<br />krishna<br />------------------<br />Charles Darwin: <br />"It is not the strongest of the species that survives, <br />nor the most intelligent, <br />but the one most responsive to change"
Depends what the person asking the question intended.
If the output of the servlet is to be included in the JSP, you could use the JSP include action specifying the URL of the servlet. But I wouldn't use a servlet in this case; a custom action would be more appropriate.
And I suppose you could forward from a JSP to servlet, but you'd have to do so before emitting any output which makes it silly to be in a JSP in the first place. Even so, I wouldn't term that a "call".
Likewise with a redirect.
You could also invoke a servlet with Ajax, but that really has nothing to do with the page being a JSP or not.
So my answer to such a question would have been "Why would you want to do something silly like that?", and then explain why I thought it was a silly thing to do. (Couched in a more professional manner, of course). [ June 13, 2006: Message edited by: Bear Bibeault ]