JSF pass parameter to another form

Hi.

I have a jsf table and table has a column to delete item.

I have 2 form in my pafe.

first form for table.
the second form for tha dialog.

I want to this.

Ehen i clik button where in the datatable, the confirmation dialog show selected rows value.


My page

<h:form>

table

</h:form>

<h:form>

dialog
</h:form>

How can i  pass parameter first form to second form.
I want to do this without refreshing page.

How can i do this ?
AbsenteAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaitu chaituCommented:
if you show you HTML source then i can show you how to pass parameters from one form to another form.right click on the dispLayed HTML page and click view source and paste it here.
0
AbsenteAuthor Commented:
<p:panel id="editCategoryPanel"
				rendered="#{userLogin.isAdmin()== true}" align="center"
				style="text-align:center;">
				<h:form id="form">


					<p:dataTable id="categoriesTable" var="cat"
						value="#{Categories.catList}" rowKey="#{cat.id}"
						paginator="true" rows="10" paginatorPosition="bottom" 
						tableStyle="width:100%" selectionMode="single">
						<f:facet name="header">  
           Categories  
        </f:facet>
						<p:column headerText="ID">
							<h:outputText value="#{cat.id}" />
						</p:column>

						<p:column headerText="Year">
							<h:outputText value="#{cat.name}" />
						</p:column>

						<p:column headerText="Manufacturer">
							<h:outputText value="#{cat.description}" />
						</p:column>

						<p:column headerText="Transaction">

							<p:commandButton icon="ui-icon-search" value="Page"
								action="#{Categories.getRetURL(cat)}">

							</p:commandButton>
							<p:commandButton icon="ui-icon-arrowrefresh-1-w" value="Edit">

							</p:commandButton>
							<p:commandButton icon="ui-icon-close" value="Delete"
								onclick="deleteCdlg.show()" action="#{Categories.setSelectedCate(cat)}" update="@parent" >
				 <f:setPropertyActionListener value="#{cat}" target="#{Categories.selectedCat}" />
							</p:commandButton>

						</p:column>

					</p:dataTable>
					<div style="text-align: right; padding-top: 10px;">
						<p:commandButton value="Add Category" icon="ui-icon-search"
							onclick="addCdlg.show()" />
					</div>
				</h:form>
			</p:panel>






<p:outputPanel id="deleteCatOut">
			<p:dialog id="deleteCatdlg" header="Delete Category" modal="true"
				align="center" widgetVar="deleteCdlg" showEffect="explode"
				hideEffect="puff" dynamic="true"
				rendered="#{userLogin.isAdmin()== true}">
				<p:outputPanel id="deleteCatinOut">
				<h:form>
						<div style="padding-bottom: 10px;">
							<h:outputLabel value="Are you sure to delete this">

							</h:outputLabel>
							<h:outputLabel value="#{Categories.selectedCat.name()}">

							</h:outputLabel>
							<h:outputLabel value=" category ?">

							</h:outputLabel>
						</div>
						<p:commandButton value="Cancel" image="ui-icon-arrowrefresh-1-w"
							type="reset" />
						<p:commandButton actionListener="#{Categories.show()}" value="Delete" image="ui-icon-close" type="reset" />
</h:form>
					
				</p:outputPanel>
			</p:dialog>
		</p:outputPanel>

Open in new window



That is the codes.

I want this.
When I clik
this button


<p:commandButton icon="ui-icon-close" value="Delete"
                                                onclick="deleteCdlg.show()" action="#{Categories.setSelectedCate(cat)}" update="@parent" >
                         <f:setPropertyActionListener value="#{cat}" target="#{Categories.selectedCat}" />
                                          </p:commandButton>
from table.

The dialog show selectes row information.
0
chaitu chaituCommented:
try to pass category id in show function.do you want to show the category id in javascript confirm box.

<p:commandButton icon="ui-icon-close" value="Delete"
                                                onclick="deleteCdlg.show(#{cat.id})" action="#{Categories.setSelectedCate(cat)}" update="@parent" >
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

AbsenteAuthor Commented:
How can I get id at <p:dialog id="deleteCatdlg"....

for example how can i show id in label.

<h:outputLabel value="#{Categories.selectedCat.name()}">

                                          </h:outputLabel>

?
0
chaitu chaituCommented:
i dint get you;which id you want and where?
0
AbsenteAuthor Commented:
I can set  Value to bean.

<p:commandButton icon="ui-icon-close" value="Delete"
                                                oncomplete="deleteCdlg.show()" update="deleteCatinOut">
                                                <f:setPropertyActionListener value="#{cat}"
                                                      target="#{Categories.selectedCat}" />
                                          </p:commandButton>

but I can not show selected value in opened dialog.


<p:outputPanel id="deleteCatOut">
                  <p:dialog id="deleteCatdlg" header="Delete Category" modal="true"
                        align="center" widgetVar="deleteCdlg" showEffect="explode"
                        hideEffect="puff" dynamic="true"
                        rendered="#{userLogin.isAdmin()== true}">
                        <p:outputPanel id="deleteCatinOut">
                              <h:form>
                                    <div style="padding-bottom: 10px;">
                                          <h:outputLabel value="Are you sure to delete this">

                                          </h:outputLabel>
                                          <h:outputLabel value="#{Categories.selectedCat.name}">

                                          </h:outputLabel>
                                          <h:outputLabel value=" category ?">

                                          </h:outputLabel>
                                    </div>
                                    <p:commandButton value="Cancel" image="ui-icon-arrowrefresh-1-w"
                                          type="reset" />
                                    <p:commandButton actionListener="#{Categories.show()}"
                                          value="Delete" image="ui-icon-close" type="reset" />
                              </h:form>

                        </p:outputPanel>
                  </p:dialog>
            </p:outputPanel>
----

This actions will be in same page without refreshing page.
0
AbsenteAuthor Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.