Access data of a XSL file from a JSF...
Posted
by
Asela
on Stack Overflow
See other posts from Stack Overflow
or by Asela
Published on 2010-12-23T06:46:14Z
Indexed on
2010/12/23
6:54 UTC
Read the original article
Hit count: 247
Hi all,
I'm having 2 simple XML & XSL files as follows.
form_1.xml
<?xml version="1.0" encoding="windows-1252"?>
<?xml-stylesheet type="text/xsl" href="form_1.xsl"?>
<myform> </myform>
form_1.xsl
<?xml version="1.0" encoding="windows-1252"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="myform">
<html>
<body>
<form>
<div align="center">
<h2>My first form in XSL</h2>
<table cellspacing="1" cellpadding="1">
<tr>
<td>First name : </td>
<td> <input type="text"></input> </td>
</tr>
<tr>
<td>Last name : </td>
<td> <input type="text"></input> </td>
</tr>
<tr>
<td>Address : </td>
<td> <input type="text"></input> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Now I have a JSF file where I have embeded the form_1.xml file inside an iFrame. Inside my JSF, I have submit & reset buttons as follows.
myJsf.xhtml
<!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:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:utils="http://java.sun.com/jsf/composite/utils">
<h:head>
<title>::: The form filler application :::</title>
<link href="./css/styles.css" rel="stylesheet" type="text/css" />
</h:head>
<h:body>
<div align="center">
<table cellspacing="2" cellpadding="2">
<tr>
<th class="title"> My form filler </th>
</tr>
</table>
<br />
<fieldset><legend>Fill appropriate data in the following form</legend> <h:form>
<div align="center">
<table>
<tr>
<td colspan="2"><iframe src="form_1.xml"
frameborder="0" width="500px" height="500px"></iframe></td>
</tr>
<tr></tr>
<tr>
<td align="right"><h:commandButton value="Save data"
action="#{myManagedBean.printValuesEnteredInTheForm}" /></td>
<td align="left"><h:commandButton type="reset" value="Clear" /></td>
</tr>
</table>
</div>
</h:form></fieldset>
</div>
</h:body>
</html>
Now my question is that upon clicking the Submit button in my JSF, how do I access the values which I have entered in the XSL file?
Any help is greatly appreciated. Thanks in advance.
Reagrds, Asela.
© Stack Overflow or respective owner