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.
Hello out there, my wish is to program a servlet, that takes the URL from a Request-Parameter,, then retrieves the content of the given URL and finally outputs the content to the client... Has anyone a simple example for me? Regards, Marc
This is a very short and very contrived example, but it goes like this: The User selects a display page from a list. The name of this display page is passed to a Servlet as a parameter. The servlet will then return the page to the client. Just to make it interesting, the Servlet also assumes that it has to prepend a directory to the JSP that the user does not know about. I'd also like to point out that passing file names like this is a security risk since the user can write any filename into the URL. It's not a good idea to clients this sort of control. The servlet will be mapped as /MyServlet and look like this:
and you call it like this: /MyServlet?filename=myfile.jsp or /MyServlet?filename=myfile.html Hope this helps. It's a bit of a short example, but might get you started. Dave