cancel
Showing results for 
Search instead for 
Did you mean: 

How to render a JSP on click of a hyperlink?

Former Member
0 Kudos

Hi all,

My requirement is to render a JSP page on click of a hyperlink on the current display page.

Both the pages are put directly under the Portal-INF directory.

when I try to directly include the file in the <a> tag -

<a href="<%@ include file="/myFile.jsp" %>">Contact us</a>

--

It gives me an error.

Can anyone please suggest as to how I can invoke "myFile.jsp" on click of the Hyperlink "Contact Us"

Regards,

Ashwini.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

If you want to render the new jsp in the same window the give the link as

<a href="http://servername:porthttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/projectname.jspname_without_.jsp_extension">Contact us</a>

If you want a popup then you should go for a button, because the HTMLB Link does not have a tag lib for onClientClick. so you cannot use Jscript to render the page in a new window, then you have to go for the classlib approach to do this.

Message was edited by: Kirupanand Venkatapathi

Answers (3)

Answers (3)

Former Member
0 Kudos

HI,

If you want to render the new jsp in the same window the give the link as

<a href="http://servername:porthttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/projectname.jspname_without_.jsp_extension">Contact us</a>

If you want a popup then you should go for a button, because the HTMLB Link does not have a tag lib for onClientClick. so you cannot use Jscript to render the page in a new window, then you have to go for the classlib approach to do this.

Former Member
0 Kudos

Hi Ashwini,

Check out this ...

<% String contactjsp = componentRequest.getWebResourcePath() + "/PORTAL-INF/myFile.jsp"; %>

<a href="<%=contactjsp%>">Contact us</a>

where myFile.jsp is inside PORTAL-INf directory.

Regards,

Uma

Former Member
0 Kudos

This wont work as you are trying to use include directive as a href attribute value. The effect of a include directive is essentially equivalent to replacing the directive with the contents of the included file.

if you have both the files in the same directory then simply use

<a href="myFile.jsp">Contact us</a>

-- Amol

Former Member
0 Kudos

Thanks Amol for the quick reply,

Will try this one out..

--Ashwini.

Former Member
0 Kudos

Amol,

I am getting the following error with your code:

File [myFile.jsp] not found in application root of alias [/] of J2EE application [sap.com/com.sap.engine.docs.examples].

- The file that I am trying to include is a new file in the logon.par

Any idea why this is happening?

- Ashwini.

Former Member
0 Kudos

Hi

Please check Whether your file myFile.jsp is placed in pagelet folder and make an entry in portal-app.xml.

hope this helps , please do not forget to reward points

regards

rajeshkr

Former Member
0 Kudos

Hi rajesh,

I am actually trying to modify the portal logon page. I have a link - on the click of which i need to take the user to another page-

This Hyperlink is a new addition to the umLogonTopArea.txt in the logon.par.

I have also put the new file to be displayed in the same folder as the other JSP files in the logon.par (dist/Portal-INF/..)

But since the JSP file that I need to display is a <b>new addition to the logon.par</b>, I am not too sure if I need to do some addtional configuration in the pcd directory to pick up this new file.

How can I go about adding the new file to the logon.par and invoke it from the <a> tag assuming that the current page and the page to be displayed are in the Portal-INF directory?

- Ashwini.

Former Member
0 Kudos

Hi Ashwini

For any new jsp u need to make an entry into portal-app.xml and the new JSP should be placed in PORTAL-INF\pagelet folder. Also as suggestion instead of using Jsp u can go for a html page , since contact us contain only static info ? correct me if i am wrong

hope this helps ,do not forget to reward points

regards

rajeshkr