Archive

Archive for the ‘Development’ Category

Ajax support for rich:calendar

May 27th, 2010 Karthikeyan C No comments

For Ajax support when the date is selected using rich:calendar, we can add the following


<a:support event="onchanged" ajaxSingle="true" reRender="scheduleenddatetime">
 <a:ajaxListener type="org.ajax4jsf.ajax.ForceRender"/>
 </a:support>

Please note that the event is onchanged instead of onchange

  • Share/Bookmark
Categories: Development Tags:

Custom Styling rich:inputNumberSlider of RichFaces

May 19th, 2010 Karthikeyan C No comments

The default look and feel of arrows of rich:inputNumberSlider in RichFaces is not very great (May be they did it intentionally for the users to customize it).

The following CSS styles have to be overridden.

rich-inslider-inc-horizontal, rich-inslider-inc-horizontal-selected

rich-inslider-dec-horizontal, rich-inslider-dec-horizontal-selected

rich-inslider-handler, rich-inslider-handler-selected

As an example, I have provided my styles below.


.rich-inslider-inc-horizontal,.rich-inslider-inc-horizontal-selected {
 background-image:url("/img/rightarrow.png");
}

.rich-inslider-dec-horizontal,.rich-inslider-dec-horizontal-selected{
 background-image:url("/img/leftarrow.png");
}

.rich-inslider-handler,.rich-inslider-handler-selected{
 background-image:url("/img/sliderpos.png");
 width:16px;
 height:16px;
}
  • Share/Bookmark
Categories: Development Tags:

Validating MySQL database Connection when fetched from a pool using DataSource

April 2nd, 2010 Karthikeyan C No comments

My friend was using Tomcat and MySQL database. He had configured a datasource and as his web application was relatively new, users to his website were very less. As a result the connections were timed out after the default timeout period and exceptions were thrown.

One of the solution to avoid this scenario is to add attributes to validate the connection when borrowing.


<Context path="" reloadable="false" docBase="/home/pathtoapp">
 <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
 maxActive="30" maxIdle="10" maxWait="4000"
 username="username" password="password" driverClassName="com.mysql.jdbc.Driver"
 url="jdbc:mysql://localhost:portnum/dbname" validationQuery="SELECT 1" testOnBorrow="true" />
 </Context>
  • Share/Bookmark
Categories: Development Tags: ,