Get src value from bean class in iframe (Dialog not being updated) - iframe

My code is below:
<p:commandButton value="test" action="#{myProgram1.test1}" oncomplete="ex2.show()"/>
<p:dialog id="dialog2" widgetVar="ex2" onShow="jQuery('#someId').show();">
<iframe frameborder="0" align="left"
src="#{myProgram1.url}"
name="someName" id="someId" scrolling="auto" width="750"
height="500">
</iframe>
</p:dialog>
I have set the value of url in test1 method. But it's not loading the url from bean class. But if I specify particular url then it is opening.

Add update="dialog2" to your <p:commandButton
So it will look like this :
<p:commandButton value="test" update="dialog2"
action="#{myProgram1.test1}" oncomplete="ex2.show()"/>

Related

Showing image from different project ASP.NET

HTML
<h3>Single Upload</h3>
<form method="post" enctype="multipart/form-data">
File <input type="file" name="file" />
<br />
<input type="button" value="Upload" onclick="return SaveExit()" />
</form>
<img src="C:/Users/Gigabyte/source/repos/ReimbursementSystem/ReimbursementSystemAPI/wwwroot/Images/biomimikrifix1.png" width="100" height="200" alt="3" />
I want to simply show the image from the other project with the path but it doesn't work. is there a way to simply show it from another project?
In ASP.Net Core MVC you are not allowed to load local resource file rather than wwwroot/images folder by default. But if you want to use a different location then you can simply add this middleware to your startup.cs
Startup.cs
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(#"C:\Users\Gigabyte\source\repos\ReimbursementSystem\ReimbursementSystemAPI\wwwroot", "images")),
RequestPath = "/images"
});
cshtml
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3"/>
Hope this will solve your issue.
You can use this code
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3" class="detailImage" />

positionning a command button on the right

I'm using jsf2.2 primefaces 6.0 and i already implemented a graphical solution to view, download and print pictures through galleria component of primefaces.
The issue is that I need help positioning the print commandButton on the right for best ergonomic result.
Here's the wanted result:
Here the XHTML code:
<p:dialog header="Documents numérisés" widgetVar="diag" modal="true"
dynamic="true" showEffect="fade" hideEffect="fade" resizable="true"
position="center" id="diagImages" onShow="download()">
<p:outputPanel id="gal" style="text-align:center;">
<p:galleria value="#{demandeBean.demandeSelectionnee.images}"
panelWidth="500" panelHeight="313" showCaption="false"
autoPlay="false" var="image">
<p:graphicImage id="image"
value="http://localhost:18080/openCars/images/#{image}"
width="500" height="313" />
</p:galleria>
</p:outputPanel>
<p:commandButton value="Print" type="button" icon="ui-icon-print"
style="display:block;margin-bottom: 20px">
<p:printer target="image" />
</p:commandButton>
</p:dialog>
Well, this may not be a perfect solution but it worked for me.
<p:panelGrid>
<p:commandButton value="Print" type="button" icon="ui-icon-print"
style="float:right;">
<p:printer target="image" />
</p:commandButton>
<p:panelGrid>

Primefaces: DataTable selection checkbox is not working without a theme

Sorry for my english. I use primefaces without a theme.
In web.xml:
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>none</param-value>
</context-param>
And I use empty primefaces.css.
I want to use dataTable with selectionMode:
<h:form id="form">
<p:dataTable id="testTableId" var="testTable" value="#{testMB.entityList}"
selection="#{testMB.selectedList}" rowKey="#{testTable.id}"
tableStyleClass="table table-hover table-bordered">
<p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column headerText="testName">
#{testTable.name}
</p:column>
<f:facet name="footer">
<p:commandButton process="testTableId" update="#form" icon="ui-icon-search" value="test"/>
</f:facet>
</p:dataTable>
<ui:repeat value="#{testMB.selectedList}" var="selectedList" id="ddddddddddd">
<h:outputText value="#{selectedList.id} - #{selectedList.name}"/>
</ui:repeat>
</h:form>
I click on a checkbox and click on commandButton test. But it is not working. List #{testMB.selectedList} is empty.
But if I click on a row (not on the checkbox) and for multiple selection I use ctrl then it is working.
If I use default theme, then checkbox is working.
Why is not working when I click on a checkbox without a theme.

Same space between 2 inputText boxes using JSF and CSS

I want to create a JSF form where users can write their name and surname and validate them using JSF validators. The problem is that I would like to set the same space between the 2 inputText boxes in the form, in both cases, when the typed data is correct according to the validator, and when it is not correct. So if between the 2 inputText boxes there are X pixels if the user has not typed anything, when typed name is not correct, the error showing message should be displayed between the 2 inputText boxes and the pixels between them should be also X px. I suppose this is a CSS issue, but I am unable to get it, so any help would be appreciated.
Here is my code
<h:form>
<p:panel id="panelregister">
<h:panelGrid columns="1">
<!--Name-->
<p:inputText id="name" label="name" size="32" maxlength="9"
value="#{mManagedBean.name}">
<f:validator validatorId="packagevalidators.NameValidator"/>
</p:inputText>
<p:watermark for="name" value="Name (*)" />
<p:message for="name"/>
<!--Surname-->
<p:inputText id="surname" label="surname" required="true" size="32" maxlength="9"
value="#{mManagedBean.surname}"
requiredMessage="Must enter a surname">
<f:validator validatorId="packagevalidators.SurnameValidator"/>
</p:inputText>
<p:watermark for="surname" value="Surname (*)" />
<p:message for="surname" />
<p:commandButton value="Submit" action="#{mManagedBean.save}" ajax="false" />
</h:panelGrid>
</p:panel>
</h:form>
You are using h:panelGrid which renders as HTML <table>.
p:message will be rendered as div and by default that div won't have any content so it won't take any space you provide.
One way to do this is to use a h:panelGroup around it and give pre defined height of p:message
Example:
<h:panelGroup layout="block" style="height:27px">
<p:message for="name" />
</h:panelGroup>

Can't reference iFrame in code behind file

I've got an iFrame in an aspx marked as runat="server". But for some reason I can't reference it in the code behind file.
This is how it's declared in the aspx.
<iframe ID="iFrame" runat="server"></iframe>
This is where it throws an error in the code behind:
iFrame.Attributes["src"] = strUrl + strFile.Split('.')[0] + ".html";
The error is "The name 'iFrame' does not exist in the current context"
Anyone know why I can't reference it?
Where is your iframe embedded?
Having this code
<body>
<iframe id="iFrame1" runat="server"></iframe>
<form id="form1" runat="server">
<div>
<iframe id="iFrame2" runat="server"></iframe>
</div>
</form>
I can access with iFrame1.Attributes["src"] just to iFrame1 and not to iFrame2.
Alternatively, you can access to any element in your form with:
FindControl("iFrame2") as System.Web.UI.HtmlControls.HtmlGenericControl

Resources