How to use iframe in liferay portlet? - java

Currently I am working on liferay 6.0
In my project I need to show a page in iframe. I have added iframe in my jsf page. When user request that jsf page whole page works fine but that iframe doesnt show respective page. Except that it shows that page not found and in console side gives message Current URL generates exception:null.
Please somedbody tell me how can I use iframe in portlet.

You should set the URL of the desired JSF page as the src of the iframe, and set the iframe as the content of the portlet.

Related

Creating html page in Spring Tool Suit 4

While right clicking on template under src/main/resources I have clicked on New and then on Others. In select a wizard dialogbox when i am searching html i am not getting it in the options available below.
What should now be done to create html page in Spring boot.
I am not getting how to proceed.

How to display PDF on the HTML page

I have migrated my application from wicket 1.x to wicket 8.x and now facing an error to display PDF on iframe. It is showing as blank on the iframe.
I am trying to display PDF in the iframe tag in the HTML on page load but it is showing as blank.
Share the detailed code below path:
https://github.com/smartuadk/Shared_Repo_StackOverflow/tree/main/PDF_Preview
Please add below http security header tag in Spring security module xml file to allow Spring security to display the HTML iframe in spring application:
<security:http use-expressions="false">
<security:headers>
<security:frame-options disabled="true"></security:frame-options>
</security:headers>
</security:http>
This solution worked for me and now my application is able to display the iFrame without any error and able to load PDF file in iFrame as well.

Adding Iframe from module as portlet in liferay7

I am new to liferay and using Liferay7. Now Instead of adding iframe manually in the portal i want to make a module and add it as a portlet and then want to make the iframe url dynamic so that i can change the url of the iframe based on some UI action in the portal. Any suggestions as to how it can be done?
If you aware, there's already liferay iframe portlet available.
http://www.liferay.com/community/wiki/-/wiki/Main/Iframe%20Portlet
You can either customize it or write your custom iframe event portlet.
Custom iframe event portlet will listen to any events from other portlet and act accordingly. You can write event portlet using following link, check for Event Inter-portlet Communication
https://web.liferay.com/community/wiki/-/wiki/Main/Portlet+to+Portlet+Communication
From other portlet you can either trigger this event which will force iframe portlet to change url.

IE9 sending HTML in button value from JSF to the server

My Environment:
Primefaces 4.0 or Primefaces 5.0
JDK 1.7
Jboss7.1.1
JSF 2.2
Internet Explorer 9
J2EE1.6
When a form is submitted from IE9, IE sends back HTML text of tag as part of button value from JSF page to the JSF servlet. This is causing servlet container to behave strangely, and not call methods on managed beans to process further. This works just fine in Firefox or Chrome browsers.
Here's the button value looks like from the server log:
contentForm:saveButtonId=<SPAN class="ui-button-icon-left ui-icon ui-c ui-icon-disk"></SPAN><SPAN class="ui-button-text ui-c">Save</SPAN>
On the form the button value is just "Save". All the buttons are coming in with above html text in value.
What have I tried so far?
If I remove button value from button using javascript onSubmit, it works.
I tried to add a servlet filter to add a servlet request class wrapper which would change the button value if it had in it, but it does not work. My assumption is JSF framework uses default servletRequest class as opposed to my wrapper class so the cleaned up parameters values are not used.
I was hoping to subclass FacesServlet but I cannot as it is final class.
Please let me know what my options are as it is really affecting our application in production environment and I am running out of time and options.
In order to reproduce it, first IE security settings must be set properly. Our settings are:
IE9->Tools-->Internet Options-->Securty-->Local Intranet is selected
Click on sites button and Automatically Detect intranet is selected.
Click on Advanced button and add currently selected web app url to the websites list.
For eg mine was added as http :// IpAddress_Or_DomainName_Of_WebApp
If the url is not added to above list of intranet sites, then IE behaves properly. Our production url is a intranet site and has been added to the list for additional security features. I cannot change that as it is a company wide policy, but i am hoping there is something I can do from JSF or Javascript or from servlet end to fix this.
Appreciate any help in this regards.
If I remember correctly, IE9 and above defaults to simulating IE8 behavior on intranet sites. If you go to Settings -> Compatibility View Settings and uncheck "Display intranet sites in Compatibility View" that should stop happening.
OK, I got it working. I got the answer i needed in primefaces forum. One kind respondent saved me just in time. He suggested me to add metadata header tag to force IE8 behavior. And also suggested here IE8 standards mode meta tag
Thank you all.

Get current page apache tiles within jsp

I have spring mvc application using apache tiles.Main file is template.jsp which includes header.jsp, then got place for potential messages and footer.jsp included.
Is there a way to check within jsp page ( using JSTL ) on which page I'm inside header.jsp code ?
Normal way of getting page URL are not good because
${pageContext.request.servletPath}
Always get's me the page I supposed to be so , template:
/WEB-INF/tiles/template.jsp
Is there a way to do it somehow , without adding anything to model from within spring?
(Because this is one of way to do this )
You can access the page URL (as it would appear in the browser) using the following EL in your JSP:
${requestScope['javax.servlet.forward.request_uri']}

Categories