Wednesday, January 17, 2007

Annotations & Jdeveloper

First time I am testing @EJB annotation on jdeveloper. As usual it dint work. After some investigation and tutorials from EJB portal, it is mentioned..

You must have version="2.5" in the web.xml for the web-app tag in order for OC4J to scan for annotations as follows:

version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


Happy Coding...

Friday, September 29, 2006

AJAX AutoSuggest on ADF Faces

The article provided in the link below is great..

http://www.oracle.com/technology/products/jdev/tips/mills/AjaxAutoSuggest/AjaxAutoSuggest.html


But it has some serious drawbacks

1. The jsp/jspx page onto which you are adding the aj:completionField component should be at the root level.

2. It discusses on how to get the data from an ADF BC. It should have kept it simple. ie, it should have explained on getting the autoCompletion results from an pojo(backing bean).

Luckily I got some solutions for the above two glitches, hope it will be helpful to some extent.

Solution 1 :
Unjar the textfield.jar, find the file script.js. Look out for the line containing
var url = "faces/ajax-autocomplete?method=" + escape(method) + "&prefix=" + escape(target.value);

The above url assumes that ur jsp it at the root of your public_html folder. So change it to respective location of your file. Example.. if my jsp is /search/productSearch.jsp I would change the url to start with ../faces/ajax-auto-----------;

Solution 2 :
a. In the jsp searchEmpl.jsp add the tag lib definition
<%@ taglib uri="http://java.sun.com/blueprints/ajaxtextfield" prefix="aj"%>

b. Add the component, enclosed in a af:panelLabelAndMessage component

value="#{productSearch.ajaxProductSearch}"
id="ajaxSearch"/>


productSearch points to the backingbean
autoCompleteProductIds points to the method in the backingbean
ajaxProductSearch is the String field into which I set the value on submit action

c. The method definition, in the backing bean

public void autoCompleteProductDesc(FacesContext ctx,
String searchString,
CompletionResult completionResult) {

//Get a list of items that starts with searchString. The search logic
//can be in ADF BC, EJB, Webservice anything.
//Add to the completionResult, one after another.

completionResult.addItem("Your item added one after another");

}

Friday, September 22, 2006

JRE Daylight Saving

May affect financial world....

http://java.sun.com/developer/technicalArticles/Intl/USDST/

Thursday, September 14, 2006

Copying List to Array

I always keep forgetting this...

String[] items = (String[])l.toArray(new String[l.size()]);

[need to be tested :), hope it works]

Purpose of this blog

Will be posting day to day findings or cheats in my java experience.....

Hopefully it will help others... Thats how software development is to be....

Thanks
- javabuddy.