cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing a jsp page from jspDynPage

Former Member
0 Kudos

Hi All

I've got a problem I'll hope someone could give me some input about.

I've created a jspDynPage in a portal application. In the setJspName() method I would like to reach another jsp page that are deployed to a separate web application in the portal. I've tried with a URL like:

this.setJspName("http://localhost:50000/[<i>webapp</i>]/test.jsp");

But the page can't be found. When I put the URL in the address field of a browser window, the jsp is found and displayed.

In my next step I'll reach a HTML-page in the KM from the separate web application, but this gives me problems to.

I have some thoughts about security settings, but I'm not sure about how it really works with a separate web application and portal applications.

Any help would be appreciated and thanks in advance.

Best regards

Mikael Lofberg

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mikael,

Generally, another jsp can be accessed using its component name as project_name/component_name. I think setJspName can access the jsp(s) only inside that project. The problem with

this.setJspName("http://localhost:50000/[webapp]/test.jsp"); is that it looks for a jsp name "http://localhost:50000/[webapp]/test.jsp" inside pagelet folder(name as such). So this will not work. So you can either open a new window for the new jsp from your project or make a copy of that jsp in your project.

Regards

Harini S

Former Member
0 Kudos

Hi Harini

Thanks for your quick reply.

To make a copy of my jsp page in the project won't work, since the jsp page I would like to reach are using a taglib and a lib (PD4ML) to convert HTML pages to PDF. And it won't work inside the project because the J2EE UI framework takes control and opens output stream before PD4ML-enabled JSP page is loaded. PD4ML needs an exclusive control over the output stream.

Could you explain how you mean with open a new window, and how it should be done from the jspDynPage?

I've also tried to set the jsp to a page in the pagelet folder. In that jsp page I tried to do a redirect to the PD4ML-enabled JSP page in the web application. But with out any success.

What I need to do is to pass the URL for a HTML page in the KM to the jsp page in the web application. So that the PD4ML could convert it to a PDF. The HTML page is an article created in the portal by some publisher, which is converted to HTML when a user selects "view/save as PDF" from the context menu of the article. The PD4ML-enabled JSP page in the web application then needs to be able to access the HTML page in the KM to do the conversion. The users should then have the possibilities to save this PDF file.

Regards

Mikael Lofberg

Former Member
0 Kudos

Hi Mikael,

You can use create a jsp file inside your project and use inside <script> tag the window.open(). It is something like this.

window.open('Projectname.componentname','title','height=40...');

Check the syntax for setting height, width etc.

Regards

Harini S

Former Member
0 Kudos

Thanks Harini

I was able to reach my webapp jsp by opening a new window. But now for my next step of my problems, how do I reach a HTML page in the KM.

I'll think I have to pass some security credentials with the request for the page, but how will I do that?

Regards

Mikael Lofberg

Former Member
0 Kudos

Hello Mikael Löfberg and all friends.

I am facing the same problem right now.

I want to reach HTML pages in KM from jspDynPage

Can you help me?

Thanks in advance.

Answers (1)

Answers (1)

Former Member
0 Kudos

Mikael,

you can only use JSPs that are part of your own project. Simply enter the JSP's name, e.g.:


this.setJspName("mypage.jsp");

If the page resides in a sub folder of your project, include the folder's name, too:


this.setJspName("pagelet/mypage.jsp");

Note that the Java code inside your JSP will run on your system.

If you want to access a remote web site (be it JSP or whatever), you might consider using the IsolatedHtmlContainer or NonIsolatedHtmlContainer controls (hbj-tags) instead. Or, simply go for a link/redirect whatever.

Kind regards,

Dominik Witte