So, I have a url that I get from the database inside my java code.
public ActionForward executeAjaxShowTab(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
String url = getUrl(); //returns something like https://foo.bar
request.setAttribute("form", url);
return mapping.findForward(ForwardConstants.FORWARD_TAB); //goes back to alert tab on the page, not a modal dialog
}
What I'm confused about is how to pass the url above to the client side to open the url in a new tab or browser window. How can I do that? Do I need to setup a new jsp page and then set the url on that jsp page or..? I have a separate js file for all js functions, so I'm confused on how to send it to the js and then link the js file so the jsp knows about that function.
EDIT: Here's how I'm calling the above method.
current jsp (which is a modal dialog) has a button:
<button onclick="launchForm()"> </button>
js:
launchForm= function() { var params=""; yuiPost("foo.do?subaction=ajaxShowTab", "content", params);}
So if I need to put it on the original jsp:
<script> var newTabUrl =${url}; window.open(newTabUrl); </script>
^That goes after the button?