cancel
Showing results for 
Search instead for 
Did you mean: 

Read Server name in JSPDynpage to call a JSP Application

ashish_shah
Contributor
0 Kudos

Hi Experts,

I am new Portal Content Development.

I have a JSP application deployed on SAP NW portal server as ear file using Eclipse.

Now to integrate this application in portal i have to create an Iview.

To Create Iview i have to create JSPDynpage.( Since URL Iview will not be useful in my case)

I am trying to follow Approach #2 as mentioned by Detlev in this thread [;

Now in this JspDynPage I have to call my JSP application.

In this application i want to read SAP NW server name and port name to create URL of JSP Application.

after which URL would be :

http://<Server host name >:<port>/JSPapplication.jsp

Now how do i read Server Host name and Server Port name from JSPDynpage?

Thanks in advance for the answer.

Regards,

Ashish Shah

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Why not use a relative path URL? Just using /JSPApplication.jsp should work. I suggest you try that first.

If you really want to get your server name, that can be done.

Something like


	  String me = System.getProperty("SAPMYNAME").toString();
	  me = me.substring(0,me.indexOf("_"));

will work

Getting the port is more complicated, mostly because your application doesn't know the portnumber! You can get the instance number by using


String inst = System.getProperty("SAPSYSTEM").toString();

and assume that the port number if "5"inst"00", but that only works if your portal uses the standard port numbering scheme.

ashish_shah
Contributor
0 Kudos

Hi Michael,

Thanks for your suggestion , i tried it.

However it seems to be struts application and url for the application is http://<server>:<port>/MyStruts/MyStrutsHome.do.

I tried following relative paths: and these are the errors

MyStrut/MyStrutHome.do --> Unable to fetch site http://MyStrut/MyStrutHome.do.Error # 502

/MyStrut/MyStrutHome.do --> Unable to fetch site http:///MyStrut/MyStrutHome.do.Error # 400

MyStrut/ --> Unable to fetch site http://MyStrut/.Error # 502

/MyStrut/ --> Unable to fetch site http:///MyStrut/.Error # 400

MyStrutHome.do -->Unable to fetch site http://MyStrutHome.do.Error # 502

Not sure weather i can create a URL Iview for Struts based applications.

Can you share your thoughts on this?

meanwhile i am trying to fetch server name and port in my JSPDynpage as suggested by you.

Thanks for your help till now.

Regards,

Ashish Shah

Former Member
0 Kudos

I'm not sure how you're launching the app, but if you launch it from a URL iView it should work. If you try to launch it from the user's browser, then it will not work.

Former Member
0 Kudos

Hi,

Please try the following code to get the server name and port from JSPDynPage

IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();

HttpServletRequest req=request.getServletRequest();

String serverName=req.getServerName();

int serverPort=req.getServerPort();

Thanks

Muthukumar