cancel
Showing results for 
Search instead for 
Did you mean: 

Open a url from JSPDynPage

Former Member
0 Kudos

Hi,

I want to open a link for eg."xyz:50000/irj/portal/../abc.jpg"

from a jspdynpage.

I used window.open("xyz:50000/irj/portal/../abc.jpg")

It works fine. But when I deploy it on portal, create par iview and assign it to a workset or page, then I can't get the output.

How can I solve this problem?

Accepted Solutions (0)

Answers (1)

Answers (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Does this .jpg exist in your JspDynPage project?

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Here is how I'm handling it in one of my JspDynPage Projects.



<b><% String ImageURL = componentRequest.getWebResourcePath() + "/images/"; %></b>


<hbj:link
          id="link1"
          text=""
          reference="http://www.sap.com"
          target="_TOP"
          tooltip="www.sap.com"
          >
<b>            <hbj:image        
                     src="<%= ImageURL+"Logo.jpg" %>"       
                     alt="www.sap.com"  /></b>
</hbj:link>

Regards,

Rich Heilman

Former Member
0 Kudos

Hi Rich,

Thanks for your reply.

Actually the link I want to call from JSPDynPage is dynamic. My objective is to convert following HTML page into JSP. It is a page for searching. Onload event works

fine with HTML, but it is not working with JSPDynPage.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type"

content="text/html; charset=iso-8859-1">

<title>Whats New</title>

<script language="JavaScript" type="text/JavaScript">

function doSearch(){

var QueryString = "*";

var searchURL="/irj/servlet/prt/portal/prtroot/com.sap.km.cm.basicsearch?StartPage=SearchPage&EnableSearchOptions=false&SelectedSearchIndices=BDSEN&SelectedMatchesPerPage=10&SelectedMaxNofCategories=0&EnableSearchSorting=false&SelectedSortOption=cm_modified&EnableActionLinks=true&EnableSearchFromHere=true&EnableFurtherSearch=true&EnableCloseOptions=false&Initialized=true&SelectedMaxNofSimilarTermsOld=6&SearchWithSession=true&MaxNumberOfRows=0&SearchVisible=false&PersistentDisputedAuthors=true&OverwriteConfig=true&IndicesInitial=true&AllowedSortProps=,cm_modified,cm_contentlength,cm_displayname,cm_rnd_rankvalue&SelectedMaxNofSimilarTerms=6&SearchType=ctrlpers&EnableStandardProps=true&SelectedSortOrder=DESCENDING&SelectedFolderMode=0&SelectedNotOlderRange=0&SelectedMaxNofHits=30&EnableSearchCascade=false&BlueBar=false&EnableUndefProps=false&SelectedMaxSnippetWords=10&EnableSearchScope=true&SelectedSearchAction=LINGUISTIC&SelectedSearchIn=INDEXES&EnableResultParams=true&ConfigFileName=Navigation.xml&LayoutSetMode=exclusive&ResourceListType=com.sapportals.wcm.SearchResultList&rndLayoutSet=BDS_SearchResultLayoutSet_News&SelectedCustomProps=BDS:horiz_cat(value=bus_plan),BDS:vert_cat(value=*)&QueryString="+QueryString;

window.open( searchURL, "_self");

}

</script>

</head>

<body onload="doSearch()">

<br>

<br>

</body>

</html>

Former Member
0 Kudos

Just put this inside your jsp:


<script language="JavaScript" type="text/JavaScript">
function doSearch(){
var QueryString = "*";
var searchURL="/irj/servlet/prt/portal/prtroot/com.sap.km.cm.basicsearch?StartPage=SearchPage&EnableSearchOptions=false&SelectedSearchIndices=BDSEN&SelectedMatchesPerPage=10&SelectedMaxNofCategories=0&EnableSearchSorting=false&SelectedSortOption=cm_modified&EnableActionLinks=true&EnableSearchFromHere=true&EnableFurtherSearch=true&EnableCloseOptions=false&Initialized=true&SelectedMaxNofSimilarTermsOld=6&SearchWithSession=true&MaxNumberOfRows=0&SearchVisible=false&PersistentDisputedAuthors=true&OverwriteConfig=true&IndicesInitial=true&AllowedSortProps=,cm_modified,cm_contentlength,cm_displayname,cm_rnd_rankvalue&SelectedMaxNofSimilarTerms=6&SearchType=ctrlpers&EnableStandardProps=true&SelectedSortOrder=DESCENDING&SelectedFolderMode=0&SelectedNotOlderRange=0&SelectedMaxNofHits=30&EnableSearchCascade=false&BlueBar=false&EnableUndefProps=false&SelectedMaxSnippetWords=10&EnableSearchScope=true&SelectedSearchAction=LINGUISTIC&SelectedSearchIn=INDEXES&EnableResultParams=true&ConfigFileName=Navigation.xml&LayoutSetMode=exclusive&ResourceListType=com.sapportals.wcm.SearchResultList&rndLayoutSet=BDS_SearchResultLayoutSet_News&SelectedCustomProps=BDS:horiz_cat(value=bus_plan),BDS:vert_cat(value=*)&QueryString="+QueryString;
window.open( searchURL, "_self");
}
doSearch();
</script>

You do not need to use the onLoad event of the body tag. With the call to doSearch() in the scriptcode it will be executed when the jsp loads in the browser.