Adding iFrame to JSF components

Is it possible to add an iframe to a JSF component (rich interfaces) using a bean? I need to embed externel web pages in my homepage. And the user needs to set this url. I can not use jQuery.

I cannot find any iframe-equivalent JSF component. Is there any special reason for this?

+6
source share
3 answers

Just use plain HTML.

<iframe src="#{bean.iframeUrl}"></iframe> 

The most likely reason a component does not exist is because there are no additional benefits to adding it to a JSF component. For example, <p> , <br> , <hr> , etc. Also do not have the equivalent of JSF.

+14
source

Yes, it is possible. We can use simple HTML in the xhtml file. I tried. It works well. below I gave my code.

 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"> <f:view locale="#{facesContext.externalContext.requestLocale}"> <h:head> <title> <h:outputText value="your application title"></h:outputText> </title> <style type="text/css"> #imagepgframe { width: 100%; height: 100%; position: absolute; } #wrap { width: 100%; position: absolute; top: 0px; left: 0; bottom: 0; overflow-y: hidden; overflow-x: hidden; } </style> </h:head> <h:body> <h:form> <div id="wrap"> <iframe id="imagepgframe" name="imagepgframe" frameborder="0" scrolling="auto" src="#{bean.iframeUrl}"> <p>Your browser does not support iframes.</p> </iframe> </div> </h:form> </h:body> 

Thanks.

+2
source

You can add an iframe framework using hsk: panelFrame, this is a simple example when the initial situation is fine and the component has a target attribute, this case of navegation toViewId is displayed in the iframe (in the panelFrame), and until the iframe page starts showing to parentViewId, this iframe closes and returns to the parent page

source https://github.com/yracnet/hiska-HskFrame/

readme https://github.com/yracnet/hiska-HskFrame/blob/master/README.md

this example with css you can show the iframe as a popup style.

+1
source

Source: https://habr.com/ru/post/889930/


All Articles