Software dev. tips and tricks
Monday, May 20, 2013
Facelets + JSF2.0 + EL2 on JBoss 4.0.3 Tomcat 5.5
So I had this painful task to bring JSF2 to life on a very old platform.
My customer is using Tomcat 5.5 / JBoss 4.0.3 SP1.
After many days of try and fail I managed to gather a configuration that works. The following are the jars that work on this configuration (I am using XHTML. JSP2 do not work as far as I know but I haven't realy tried):
commons-beanutils-1.8.3.jar
commons-codec-1.3.jar
commons-collections-3.2.jar
commons-digester-1.8.jar
commons-discovery-0.4.jar
commons-logging-1.1.1.jar
el-api.jar
jboss-el-2.0.0.GA.jar
jstl-1.2.jar
myfaces-bundle-2.0.18-20130417.135111-27.jar
ojdbc14.jar
standard.jar
Please not that I have removed the JBoss original JSF-LIBs and the referencees to this folder.
Also, there is some necessary configuration to be performed:
Remove FaceletViewHandler from faces-config.xml (basicaly you can leave it empty):
com.sun.facelets.FaceletViewHandler
And here is the whole web.xml:
org.apache.myfaces.EXPRESSION_FACTORY
org.jboss.el.ExpressionFactoryImpl
javax.faces.PROJECT_STAGE
Development
javax.faces.DEFAULT_SUFFIX
.xhtml
facelets.REFRESH_PERIOD
2
facelets.DEVELOPMENT
true
Faces Servlet
javax.faces.webapp.FacesServlet
1
Faces Servlet
*.faces
index.jsp
index.html
Cheers,
Friday, December 21, 2012
jQuery datatable and JSF h:datatable within h:form
If you would like to place a h:datatable inside of a form and still user jQuery datatable plugin to format your table, you need to point the jQuery to the right location in the xhtml page.
Be careful to escape the ":" between the form and datatable names in the jQuery initializaton with "\\:"
Example:
test.xhtml:
<h:head>
...
<h:outputStylesheet name="main.css" library="css" />
<style type="text/css" title="currentStyle">
@import "./resources/css/TableTools.css";</style>
<script type="text/javascript"
src="./resources/js/jquery.js"></script>
<script type="text/javascript"
src="./resources/js/jquery.dataTables.min.js"></script>
<script type="text/javascript"
src="./resources/js/ZeroClipboard.js"></script>
<script type="text/javascript"
src="./resources/js/TableTools.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#myForm\\:myTable').dataTable({
"sDom" : 'T<"clear">lfrtip',
"oTableTools" : {
"aButtons" : [ {
"sExtends" : "copy",
"sButtonText" : "Copy"
}, {
"sExtends" : "csv",
"sButtonText" : "CSV"
}, {
"sExtends" : "xls",
"sButtonText" : "XLS"
}, {
"sExtends" : "text",
"sButtonText" : "resetsort"
} ]
}
});
</script>
</h:head>
<h:body>
<h:form id="myForm">
<h:dataTable id="myTable" >
..
</h:dataTable>
</h:form>
</h:body>
Reload / Refresh web page using Javascript and jQuery
There are several ways to refresh a page using a button and javascript action.
.
One could also use jQuery datatable buttons for various actions. A simple "Refresh" button reloads the page in this case.
.
<input onclick="history.go(0)" type="button" value="Reload Page" />
2.
<input onclick="window.location.reload" type="button" value="Reload Page" />
3.
<input onclick="window.location.href=window.location.href" type="button" value="Reload Page" />
$(document).ready(function() {
var oTable = $('#myTable').dataTable({
"sDom" : 'T<"clear">lfrtip',
"oTableTools" : {
"aButtons" : [ {
"sExtends" : "copy",
"sButtonText" : "Copy"
}, {
"sExtends" : "xls",
"sButtonText" : "XLS"
}, {
"sExtends" : "text",
"sButtonText" : "Refresh",
"fnClick": function ( nButton, oConfig, oFlash ) {
javascript:window.location.reload();
}} ]
}
});
Thursday, January 7, 2010
SQL INSERT from SELECT or SEQUENCE - Oracle
insert into tab1(a, b, c, d, e)SELECT a1, b1, c1, d1, 'ABC' AS e1
FROM tab2 t2
WHERE t2.d1 = 'x';
insert into emp (empno) values(mySeq.nextVal);
Subscribe to:
Posts (Atom)