According to this blog post, Kinect for Windows will be available in Belgium as of June 2012. While this has not much to do with web development itself, I do like the Kinect. I have one for my XBox, and it works pretty smoothly. Now that it becomes available on Windows as well, I think it offers a lot of possibilities.
Imagine a teacher in front of a whiteboard, being able to write on it without a marker, or giving a presentation without having to click through each slide. It also offers possibilities for games, and by extension even web developers. The world of IT and computers is constantly evolving, Microsoft's Kinect being just one example.
Wednesday, March 28, 2012
Friday, March 23, 2012
The Cloudbees cloud solution
A few weeks ago, I blogged about getting your app online with Google App Engine. While this is a very easy process, it is far from the only cloud solution available. I have tried another one, Cloudbees, and will tell you about my experience now.
Cloudbees offers more then just a deployment platform. It has Repositories, Continuous Itegration and an Application Server for you to play around with. It also offers database services, and has plugins for numerous other things (like Sonar, Sauce Labs and many others). For this next example, I used SVN as repository, Jenkins as CI and Tomcat as app server.
You now can configure the application server, which is in fact a Tomcat instance. You can define JDBC-connections, or upload a WAR file to be deployed.
Cloudbees offers more then just a deployment platform. It has Repositories, Continuous Itegration and an Application Server for you to play around with. It also offers database services, and has plugins for numerous other things (like Sonar, Sauce Labs and many others). For this next example, I used SVN as repository, Jenkins as CI and Tomcat as app server.
Signing up
Signing up for Cloudbees is easy. Fill in your name and e-mailaddress, and create an account. That's it! Now that your account has been created, you can select which services to use. There are both free and paying options. To get started, I added the following:
- Repository
- Jenkins
- Applications
I chose the free version of each. The idea was to simulate a real world working environment. I know there are a SDK and plugins available to build and deploy from within Eclipse/STS, but I wanted to have a continuous integration build my SVN repository whenever I checked in changes.
Configuration
First, I created a new code repository (in the Repositories service). I named it 'blogtryouts'.
Then I created a new application, naming it, again, Blogtryouts.
Continuous integration
But we don't just want to upload a WAR file. We want our newly created SVN repository to be checked out, the project to be built and the resulting WAR-file to be automatically deployed. Therefore, we'll create a Jenkins service in Cloudbees. I created a DEV@Cloud free instance.
The Jenkins instance is immediately available. I added a new job ('Blogtryouts', who'd have guessed?), and made it a Maven 2/3 project. Once created, we can start configuring our Jenkins build!
Checkout, build, deploy
The configuration is pretty easy as well. The first thing we want Jenkins to do, is checkout our SVN repository. Under Manage sourcecode, you can select Subversion and then specify a URL. That URL is the one Cloudbees gave you when you created your repository. You can find it by going to Services -> Repositories and selecting your repository.
Since we told Jenkins it's a Maven project, it'll automatically try to build the pom.xml. You can add parameters and specify when it should be built. Under Building Activators check Build when a change is pushed to CloudBees Forge. This will start a build when someone commits code to SVN.
Last but not least ,we want to deploy the built artifact. Therefore, check Deploy to CloudBees under Actions after build. You can now specify the site and application ID to deploy to. The site is normally your username, application ID is the name you gave your application, prefixed with yoursite/. Cloudbees helps a lot by providing a dropdown with sites, and by telling you an application ID can't be found. They can even tell you which application IDs are valid.
If you now click 'build now', There will be a warning that your account hasn't been validated. This is an extra step required. Just click the link and enter your phone number (make sure you're near the phone with that number!). Seconds later, you'll receive a phone call with a computer voice telling you a PIN code. Enter the pin code, and you're good to go.
Last but not least ,we want to deploy the built artifact. Therefore, check Deploy to CloudBees under Actions after build. You can now specify the site and application ID to deploy to. The site is normally your username, application ID is the name you gave your application, prefixed with yoursite/. Cloudbees helps a lot by providing a dropdown with sites, and by telling you an application ID can't be found. They can even tell you which application IDs are valid.
If you now click 'build now', There will be a warning that your account hasn't been validated. This is an extra step required. Just click the link and enter your phone number (make sure you're near the phone with that number!). Seconds later, you'll receive a phone call with a computer voice telling you a PIN code. Enter the pin code, and you're good to go.
The webapp
So, now that our cloud is fully setup, we of course need a webapp to deploy. For demonstration purposes, we'll just use a general Maven archetype. As in some of my prvious blogposts, we'll create a Wicket project. We can do this quickly by executing this Maven command:
mvn archetype:generate -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.5.5 -DgroupId=com.mycompany -DartifactId=myproject -DarchetypeRepository=https://repository.apache.org/ -DinteractiveMode=false
The magic
Now that our application has been created, we just have to import it into our SVN repository. I used TortoiseSVN to do an Import to my Cloudbees repository. It doesn't matter how you do it, but once the import's been done, you can watch the magic happen.
Jenkins will notice a new commit and will start a new build. When that's done, it'll deploy the generated WAR-file. When you now go to Services -> Applications, and click your application, you'll notice a new deploy has been done, with a Jenkins build message. This means your app is up and running! The URL is found on top of this page as well. Mine is available here.
Labels:
Cloud,
Cloudbees,
Continuous Integration,
Java,
Jenkins,
Subversion,
Wicket
Wednesday, March 21, 2012
Google Wave Sunsetting
Google has just sent reminders to all Wave-users: Google Wave is EOL. The shutting down will happen in phases, you can find the exact dates here. All services will be stopped by the end of April 2012.
Tuesday, March 20, 2012
Wicket 1.5 in Google App Engine
In a previous post, I explained how to quickly setup a Wicket application using Maven and Google App Engine. As you may have noticed, the default version of Wicket that is used, is 1.4. If you want to use Wicket 1.5, you have to replace Wicket dependence in your pom.xml.
This is what is there by default:
We'll replace it with:
This is what is there by default:
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
<version>1.4.10</version>
</dependency>
We'll replace it with:
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-gae-initializer</artifactId>
<version>1.5.5</version>
</dependency>
>
Monday, March 19, 2012
Oracle Certified Professional (OCP), Java SE 7 Programmer
Oracle has announced a new certification, the Oracle Certified Professional, Java SE 7 Programmer. If you already are an Oracle Certified Professional (or a Sun Certified Java Programmer) for a previous version of Java, you can take an exam to upgrade your certification to the latest version.
If you're not yet certified, and want to become an OCP, you must first pass the Oracle Certified Associate (OCA) Java 7 Programmer exam.
If you're not yet certified, and want to become an OCP, you must first pass the Oracle Certified Associate (OCA) Java 7 Programmer exam.
Friday, March 16, 2012
Updated Java 6 EOL date
In its recently updated Java SE Support Roadmap, Oracle provides an updated date for Java 6 to go EOL (End Of Life). It used to be July 2012, but has now been postponed to November 2012.
Basically, it means that after November 201 Oracle will no longer post updates of Java SE 6 to its public download sites. Developers are encouraged to switch to the latest version.
Basically, it means that after November 201 Oracle will no longer post updates of Java SE 6 to its public download sites. Developers are encouraged to switch to the latest version.
Thursday, March 15, 2012
Oracle supports btrfs filesystem
Oracle has released the latest version of its Oracle Unbreakable Enterprise Kernel. You can find the release notes here. This release is based on Linux 3.0.16 and is a clone of the Red Hat Enterprise kernel.
With this release, Oracle is the 2nd vendor, after SUSE, to provide support for btrfs filesystems.
More information about btrfs can be found here.
With this release, Oracle is the 2nd vendor, after SUSE, to provide support for btrfs filesystems.
More information about btrfs can be found here.
Tuesday, March 13, 2012
JDeveloper: Code Template to show current class and method
For debugging purposes, I sometimes use a simple System.out.println statement to have some values displayed on the console. It's not the best or cleanest way, I know, but it works and is a lot faster than setting up a logging framework first. If you already have a logging framework configured, you might as well use that one, of course. Following method could also be used for quickly generating logging statements.
To keep an overview of the messages printed, I usually preceed every message with currentClass.currentMethod. In JDeveloper, there's an easy way to do this:
To keep an overview of the messages printed, I usually preceed every message with currentClass.currentMethod. In JDeveloper, there's an easy way to do this:
- Open Tools -> Preferences...
- Go to Code Editor -> Code Templates
- Add a new one
- Enter a shortcut (I use 'sopl'), and change the context to Java
- In the code section, type System.out.println("$myCurClass$.$myCurMethod$(): $end$");
- In the variables tab, map myCurClass to 'Class Name' and myCurMethod to 'Method Name'
- Leave end mapped to 'End Location'
Now you can use sopl in every Java class! Just type sopl and hit Ctrl+Enter.
Monday, March 12, 2012
ADF 11g: Tag Library
Wouldn't it be nice to have an overview of all Oracle ADF 11g components? Well, you can find them here:
http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx
You can adjust parameters to see their effect and view the source code. There's also an option to change the skin, so you have an idea what skinning can do for you.
http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx
You can adjust parameters to see their effect and view the source code. There's also an option to change the skin, so you have an idea what skinning can do for you.
How to use Uploadify in Spring MVC
What is Uploadify?
www.uploadify.com"Uploadify is a jQuery plugin that integrates a fully-customizable multiple file upload utility on your website. It uses a mixture of Javascript, ActionScript, and any server-side language to dynamically create an instance over any DOM element on a page."
So, Uploadify is a JQuery lib which allows you to upload multiple files at once onto your webpage. Uses flash for fancy animations!
Implementation
Integration
You start by downloading Uploadify and integrate it into your project. Put them in a folder and add thaty folder to mvc:resources in je servlet-context.xml.<mvc:resources location="/resources/" mapping="/resources/**">
Further, you need to tell Spring thatMultiPartFiles are possible:
<bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver">
<property name="maxUploadSize" value="500000"/>
</bean>
In a Maven project, get the required libraries by adding this to your POM:
<dependency>
<groupid>commons-fileupload</groupid>
<artifactid>commons-fileupload</artifactid>
<version>1.2</version>
</dependency>
Upload page
Your upload page looks like this:
<link href="../resources/uploadify/uploadify.css" rel="stylesheet" type="text/css"></link>
<script src="../resources/js/jquery16.js"></script>
<script src="../resources/uploadify/jquery.uploadify.js"></script>
<script src="../resources/uploadify/swfobject.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var myFiles = new Array();
var myFileCnt = 0;
$('#file-upload').uploadify({
'swf': '../resources/uploadify/uploadify.swf',
'cancelImage': '../resources/uploadify/cancel.png',
'multi' : true,
'auto' : true,
'fileObjName' : 'filedata',
'checkExisting' : false
});
});
</script>
<input id="file-upload" name="file-upload" type="file" />
Handling
If you set auto to true, an automatic POST-request will be executed. We need to catch and handle it!
@Controller
public class FileUploadController {
@RequestMapping(method=RequestMethod.POST)
public String handleFile(MultipartHttpServletRequest request)
{
MultipartFile file = request.getFile("filedata");
//some code here
return "fileupload/success";
}
}
Extra parameters in request
You can add extra parameters to your request. This is not as easy as it sounds, because Uploadify creates and manages its own form. This is how I did it:Add function to your JSP page
In Uploadify, there are a few events available that are triggered throughout the process. onSelect is one of them. It gets called every time files are selected.
onSelect : function(){
$('#file-upload').uploadifySettings(
'postData',
{'season':$('#season').val()}
);
}
Your entire script now looks as follows:
$(document).ready(function() {
var myFiles = new Array();
var myFileCnt = 0;
$('#file-upload').uploadify({
'swf': '../resources/uploadify/uploadify.swf',
'uploader': '',
'cancelImage': '../resources/uploadify/cancel.png',
'multi' : true,
'auto' : true,
'fileObjName' : 'filedata',
'checkExisting' : false,
onSelect : function(){
$('#file-upload').uploadifySettings(
'postData',
{'myParamName':$('#myFieldId').val()}
);
}
});
});
Get parameter in Controller
When you've added the parameter to the postData, as described above, you can easily get it in your Controller. Its value is now in the parametermap of your request.
String s = request.getParameter("myParamName");
If you have followed this guide and stumbled upon problems, please let me know. I'll try to keep it as correct and up-to-date as possible!
Labels:
Fileupload,
Java,
Maven,
Spring MVC,
Uploadify
Thursday, March 8, 2012
ADF Logging
Most people use Log4J for their logging. There are a few others, like Commons Logging, SLF4J, or the default Java Logging API. But if you're working with Oracle's Application Development Framework, there is another option as well: ADF Logging.
ADF Logging is a logging mechanism, embedded in the ADF framework. It wraps the Java Logging API, but throws in a few extra methods and some JDeveloper and (Weblogic) Enterprise Manager features.
A thorough guide on how to use it can be found on Duncan Mill's blog. A 15 minute introduction presentation is also available.
ADF Logging is a logging mechanism, embedded in the ADF framework. It wraps the Java Logging API, but throws in a few extra methods and some JDeveloper and (Weblogic) Enterprise Manager features.
A thorough guide on how to use it can be found on Duncan Mill's blog. A 15 minute introduction presentation is also available.
Wednesday, March 7, 2012
ADF 11g: Move Task Flow to another folder
Users of JDeveloper know it: on a lot of files, you can right click, choose the option "Refactor", and select "Move". But not so for task flows (at least not in JDev 11.1.1.5). If you want to move a task flow to another folder, you have to recreate it. For new flows, this isn't too hard, but for flows that have a lot of activities, actions and method calls, this can be a lot of work. To get the job done without having to recreate the entire task flow, follow these 2 easy steps:
- Move the task flow definition XML file (under WEB-INF ) to the correct folder
- Move the task flow diagram files (.adfc_diagram) to the correct folder. They can be found under the model/WEB-INF folder in your ViewConrtroller project
- Change the DataBindings.cpx file to reflect the changes
That's it!
Free Cloud DB
I was looking for a free cloud database for my online applications, and to play around with a bit, and found a few solutions.
One was Oracle. My background is Oracle, and it's by far the best database there is. Unfortunately, their cloud solutions doesn't seem to be quite ready yet. You can register, but don't get a cloud database to play with. Yet... As soon as Oracle cloud is up and running, I'll check it out and make a post about it.
We continued our search then. I figured there wouldn't be any free Oracle cloud database, so I extended my reach to all databases. I stumbled upon Xeround. They seem to provide a free MySQL solution. Which basically is Oracle as well, since they acquired Sun. So I signed up, and created a DB instance. Apparantly, instances up to 10MB are free. There are payed solutions if you want more capacity. But for the stuff I'll be doing, 10MB of data will be more then enough.
The creation of an instance took a few minutes, but once finished, my database was up and running. It comes with a very convenient phpMyAdmin online console to manage the database and execute queries. So far, it looks like a very decent solution. Later on, I'll try to use the database in an application!
One was Oracle. My background is Oracle, and it's by far the best database there is. Unfortunately, their cloud solutions doesn't seem to be quite ready yet. You can register, but don't get a cloud database to play with. Yet... As soon as Oracle cloud is up and running, I'll check it out and make a post about it.
We continued our search then. I figured there wouldn't be any free Oracle cloud database, so I extended my reach to all databases. I stumbled upon Xeround. They seem to provide a free MySQL solution. Which basically is Oracle as well, since they acquired Sun. So I signed up, and created a DB instance. Apparantly, instances up to 10MB are free. There are payed solutions if you want more capacity. But for the stuff I'll be doing, 10MB of data will be more then enough.
The creation of an instance took a few minutes, but once finished, my database was up and running. It comes with a very convenient phpMyAdmin online console to manage the database and execute queries. So far, it looks like a very decent solution. Later on, I'll try to use the database in an application!
Tuesday, March 6, 2012
Scrum in 10 minutes
Scrum is a methodology to develop software or products. It is hot, these days, and widely used. There are expensive courses you can take to master the matter, but there are also some good online resource to consult.
One of them is this video: Scrum Master in Under 10 Minutes (HD) by @hamids
If you're interested in getting your Black Belt at KnowledgeBlackBelt, you can take an exam here after watching the video.
Good luck!
One of them is this video: Scrum Master in Under 10 Minutes (HD) by @hamids
If you're interested in getting your Black Belt at KnowledgeBlackBelt, you can take an exam here after watching the video.
Good luck!
Labels:
Agile,
KnowledgeBlackBelt,
Project Management,
Scrum
Monday, March 5, 2012
GlassFish 3.1.2 has arrived
The latest version of GlassFish has been shipped!
http://glassfish.java.net/downloads/3.1.2-final.html
http://glassfish.java.net/downloads/3.1.2-final.html
Saturday, March 3, 2012
Get your app online in 10 minutes with Google App Engine!
In this post I'll explain how to easily get an app online and running in under 10 minutes. There are a few thing we need before we can start, though:
The Google App Engine SDK can easily be installed from within STS itself.
So, once we have all these prerequisited, we can get started! First thing you have to do is tell Google you want to deploy a new application. To do this, go to the Google App Engine start page, and create an application.
I named my app blogtryouts.
Now we are ready to actually build an application. Springsource Toolsuite comes with Maven preconfigured, so we might as well use Maven and its rich collection of archetypes to get going. So, in STS, create a new Maven project (File -> New -> Other..., and then select Maven project)
A wizard starts to help you create a new Maven project. Make sure you leave the Create a simple project (skip archetype selection) UNCHECKED! We're going to select a Maven archetype to get started really fast. More information about Maven Archetypes can be found here. When you click next, you can select the maven archetype you want to use. Filter on gae, and select the archetype using the framework you desire. I chose Wicket, cause I like the way it works (and how you can have a web designer do the tedious HTML/CSS styling while you can focus on the real Java development). To use wicket, select gae-archetype-wicket.
Click Next. Now comes the screen where you enter your application information. Enter data concerning to your application in Group Id, Artifact Id and package. In the gaeApplicationName field, you enter the name of the application you created on appengine.google.com. In our case, this was blogtryouts.
Also notice the gaeApplicationVersion field. It defaults to test. We'll change it to release, to deploy a release version of our app. Click Finish. Maven will now create an archetype!
Now, there are still some issues before you can deploy your application. You have to put the Google App Engine SDK to your buildpath. I have no idea why this isn't done by default, but it isn't, so we'll have to do it ourselves. Easiest way is by right clicking your project, and select Google -> App Engine Settings... Basically, you can just hit Ok, to accept all default values.
Now that the SDK has been added, there still is 1 problem to be addressed. I think it's a bug in either STS or the Maven Archetype, but the appengine-local-runtime artifact seems to be missing. You can just go to the pom, and delete the entry.
Now, build the project by using the maven package command. The necessary files and folders will be created, and your application is ready to be deployed! When Maven has finished packaging, right click your application in STS, select Google -> Deploy to App Engine... and deployment will start. When it's finished, your application is available at yourAppname.appspot.com.
If you used test instead of release in the gaeApplicationVersion I mentioned earlier, it would deploy to test.yourAppname.appspot.com.
Good luck and have fun!
The Google App Engine SDK can easily be installed from within STS itself.
So, once we have all these prerequisited, we can get started! First thing you have to do is tell Google you want to deploy a new application. To do this, go to the Google App Engine start page, and create an application.
I named my app blogtryouts.
Now we are ready to actually build an application. Springsource Toolsuite comes with Maven preconfigured, so we might as well use Maven and its rich collection of archetypes to get going. So, in STS, create a new Maven project (File -> New -> Other..., and then select Maven project)
A wizard starts to help you create a new Maven project. Make sure you leave the Create a simple project (skip archetype selection) UNCHECKED! We're going to select a Maven archetype to get started really fast. More information about Maven Archetypes can be found here. When you click next, you can select the maven archetype you want to use. Filter on gae, and select the archetype using the framework you desire. I chose Wicket, cause I like the way it works (and how you can have a web designer do the tedious HTML/CSS styling while you can focus on the real Java development). To use wicket, select gae-archetype-wicket.
Click Next. Now comes the screen where you enter your application information. Enter data concerning to your application in Group Id, Artifact Id and package. In the gaeApplicationName field, you enter the name of the application you created on appengine.google.com. In our case, this was blogtryouts.
Also notice the gaeApplicationVersion field. It defaults to test. We'll change it to release, to deploy a release version of our app. Click Finish. Maven will now create an archetype!
Now, there are still some issues before you can deploy your application. You have to put the Google App Engine SDK to your buildpath. I have no idea why this isn't done by default, but it isn't, so we'll have to do it ourselves. Easiest way is by right clicking your project, and select Google -> App Engine Settings... Basically, you can just hit Ok, to accept all default values.
Now that the SDK has been added, there still is 1 problem to be addressed. I think it's a bug in either STS or the Maven Archetype, but the appengine-local-runtime artifact seems to be missing. You can just go to the pom, and delete the entry.
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-local-runtime</artifactId>
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
Now, build the project by using the maven package command. The necessary files and folders will be created, and your application is ready to be deployed! When Maven has finished packaging, right click your application in STS, select Google -> Deploy to App Engine... and deployment will start. When it's finished, your application is available at yourAppname.appspot.com.
If you used test instead of release in the gaeApplicationVersion I mentioned earlier, it would deploy to test.yourAppname.appspot.com.
Good luck and have fun!
Labels:
Cloud,
Google,
Google App Engine,
Java,
Maven,
Springsource ToolSuite,
Wicket
Friday, March 2, 2012
50GB of free cloud storage
Cloud storage service Box has a new Android app available. To celebrate its launch, Box now offers 50GB of free storage if you download the app before March 23rd. For the rest of your life! After that date, you can always sign up for a free 5GB account, or pay for more cloud diskspace.
So go to the Apps Marketplace on your android phone, search for 'box', and install the app.
So go to the Apps Marketplace on your android phone, search for 'box', and install the app.
Free Advanced ADF course
Great news! Oracle now provides free online training for ADF. According to Grant Ronald's blog, more parts of this course will be released in the coming weeks.
Get started, or sharpen your ADF skills...
Get started, or sharpen your ADF skills...
ADF 11g: Select date and time
Today, I had to enable the users to not only select a date, but also a time. I remember this being a lot of work in 10g, but in 11g, it's apparantly out of the box functionality.
Thanks to Shay Shmeltzer for providing a solution!
https://blogs.oracle.com/shay/entry/a_timehour_selector_in_adf_fac
In short:
More information can also be found in this forum thread.
Thanks to Shay Shmeltzer for providing a solution!
https://blogs.oracle.com/shay/entry/a_timehour_selector_in_adf_fac
In short:
- Make field in database of type TIMESTAMP
- Make sure it's also a TIMESTAMP in your entity object
- Provide a date format mask that includes hours and minutes
More information can also be found in this forum thread.
Java7 features
Java 7 has been released for a while now, but I thought I'd link to the most important new features, for future reference.
JDK7 Features
For us, developers, the most commonly used will be the ones made in Project Coin, I guess. Also take not of the features postponed to JDK 8 (at the bottom of the page)
JDK7 Features
For us, developers, the most commonly used will be the ones made in Project Coin, I guess. Also take not of the features postponed to JDK 8 (at the bottom of the page)
Thursday, March 1, 2012
ADF 11g: Global date format
In ADF 11g, you can define a date format on many levels. On Entity Objects, View Objects, even on UI level in your JSF pages.
But wouldn't it be convenient to make 1 configuration and have all dates display the same? Well, this is possible. Just add this line of code to your trinidad-config.xml file (located in WEB-INF):
Of course, the locale you use determines the formatting. This particular example, nl-BE, will display all dates as dd/MM/yyyy.
But wouldn't it be convenient to make 1 configuration and have all dates display the same? Well, this is possible. Just add this line of code to your trinidad-config.xml file (located in WEB-INF):
<formatting-locale>nl-BE</formatting-locale>
Of course, the locale you use determines the formatting. This particular example, nl-BE, will display all dates as dd/MM/yyyy.
ADF @ KnowledgeBlackBelt
Ever heard of KnowledgeBlackBelt? It used to be BlackBeltFactory. Doesn't sound familiar either? Perhaps JavaBlackBelt then? I'm sure that rings a bell to a lot of Java-oriented developers. Well, it's all the same site, it just has changed name (and layout) a few times over the years.
In short, KnowledgeBlackBelt is a Java Learning & Certification community. Everyone can join and take free exams to gain grades. There are even courses (both free and paid) that handle certain topics and prepare you to take those exams. New users start out with a white belt, and eventually, after taking courses, exams and contributing to the community, they can become a Black Belt.
I'm a contributor to the KnowledgeBlackBelt community. I have earned a brown belt over the years, and I'm the leader and moderator of the ADF Business Components exam. Check out the exam, and the entire concept that is KnowledgeBlackBelt. Learn, gain experience and get better at what you do.
In short, KnowledgeBlackBelt is a Java Learning & Certification community. Everyone can join and take free exams to gain grades. There are even courses (both free and paid) that handle certain topics and prepare you to take those exams. New users start out with a white belt, and eventually, after taking courses, exams and contributing to the community, they can become a Black Belt.
I'm a contributor to the KnowledgeBlackBelt community. I have earned a brown belt over the years, and I'm the leader and moderator of the ADF Business Components exam. Check out the exam, and the entire concept that is KnowledgeBlackBelt. Learn, gain experience and get better at what you do.
ADF 11g: Get sequence in Groovy
A lot of people use sequences to generate an ID for their records. Since Oracle doesn't have an auto-increment, you need to manually get the next value and insert it into the ID field.
This can be done by triggers, but when you use Business Components, adding a one method and a single line of groovy code is enough. First, we need a method to get the next DB value:
In the Id-attribute of your entity, you call this method by entering this expression in the value field:
This can be done by triggers, but when you use Business Components, adding a one method and a single line of groovy code is enough. First, we need a method to get the next DB value:
public Number seqNextVal(String seqName) {
Number seqNextVal;
if(seqName!=null && !seqName.equals("")) {
SequenceImpl seq = new SequenceImpl(seqName, getDBTransaction());
seqNextVal = seq.getSequenceNumber();
}
else {
seqNextVal = new Number(0);
}
return seqNextVal;
}
In the Id-attribute of your entity, you call this method by entering this expression in the value field:
adf.source.seqNextVal("SEQ_NAME")
Don't forget to check the Expression radio!
ADF 11g: Hide table column headers
Sometimes, you want to display a table, but hide the column headers. This can easily be done with ADF Skinning.
First, we need to create a skin. This can be done by creating a trinidad-skins file in your META-INF folder. Since we only want to adjust our table in this simple example, we'll extend from the default Fusion desktop skin
As you can see, we refer to a css file there. Create it, and add this line to it:
Your skin has now been created, now we need to tell our application it has to use that skin. This is done in the trinidad-config.xml file, located in your WEB-INF folder. There, refer the skin-family to your own skin
That's it. Your skin has been created. All that is left now is configure your table to use the style you just defined. Add following attribute to your <af:table> instance:
<?xml version="1.0" encoding="UTF-8" ?>
<skins xmlns="http://myfaces.apache.org/trinidad/skin">
<skin>
<id>mySkin.desktop</id>
<family>mySkin</family>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<extends>fusion.desktop</extends>
<style-sheet-name>/css/mySkin.css</style-sheet-name>
</skin>
</skins>
As you can see, we refer to a css file there. Create it, and add this line to it:
.tableNoColumnHeaders af|column::column-header-cell {display: none}
Your skin has now been created, now we need to tell our application it has to use that skin. This is done in the trinidad-config.xml file, located in your WEB-INF folder. There, refer the skin-family to your own skin
<skin-family>mySkin</skin-family>
That's it. Your skin has been created. All that is left now is configure your table to use the style you just defined. Add following attribute to your <af:table> instance:
styleClass="tableNoColumnHeaders"
Subscribe to:
Posts (Atom)