Thursday, December 1, 2011

Get application url using java

If your domain name is
You will get in your application using the following code.
If you are using struts action class, servlet or jsp  , you can use the following code.



public ActionForward checkUrl(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
URL applicationUrl = new URL(request.getScheme(), request.getServerName(), request.getServerPort(),
return mapping.findForward("success");

No comments: