<%! public String[] getLink(String str, String rzWebspace) { //Code for Relative Url Starts String[] linkInfo = new String[2]; String linkUrl = (str).trim(); //Trim spaces if any StringBuffer imageUrl = new StringBuffer(linkUrl); String webspaceName = rzWebspace; // Fetches the webspace name String folderName = "revize/"; String searchStr = folderName.concat(webspaceName); //To check if its an internal url - revize/webspacename int index = 0 ; // To check index of dot(.) before url ext String searchChar = ""; // For url extension String target = "_blank"; // To make external url open in a new window & internal url open in the same window int internal = imageUrl.indexOf(searchStr); if( internal != -1 ) // If its an internal/relative link { int num; if( internal != -1 ) { num = imageUrl.indexOf(webspaceName); num = num + webspaceName.length() + 1; imageUrl=imageUrl.delete(0,num); //Relative url (by deleting the string from beginning till webspacename/) } // Check url extension index = imageUrl.lastIndexOf("."); searchChar = imageUrl.substring(index+1,imageUrl.length()); // Find out the url ext if(searchChar.equals("php")){ target = "_self"; } else { target = "_blank"; } // Extensions other than php will open in a new window } linkUrl=imageUrl.toString().trim(); // Assigning the StringBuffer(relative url/external url) to String(url) //Code for Relative Url Ends if(linkUrl.startsWith("www")) { linkUrl = "http://"+linkUrl; } // if Url is blank if(("").equals(linkUrl)) { linkUrl = "./"; target="_self"; } linkInfo[0] = linkUrl; linkInfo[1] = target; return linkInfo; } public boolean isSet(String imageSrc) { if( imageSrc.indexOf("noimage.gif") != -1 ) { return false; } return true; } %>