Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, October 8, 2009

Add Struts-2 Support in NetBeans


Add struts-2 support in netbeans in very easy

  1. Simple download plugin from below link
    https://nbstruts2support.dev.java.net/servlets/ProjectDocumentList?folderID=9422%26expandFolder=9422%26folderID=8962
  2. Go to Tools - Plug ins-Download-Add Plugin








  3. Restart the NetBeans IDE when prompt  
  4. Create New Web Project ---Next---Next--Struts-2
  5. You can also add spring and sitemesh support in struts-2 using plugin .It automatically configure all the things for you see below images
 and have fun

Add Google App engine Support in Netbeans



Add Google App engine Support in Netbeans is very easy. To install app engine plugin follow the below steps.

1. Go to Tools - Plugins and select Settings tab.
2. Click Add button and type 'App Engine' as name of Update center and following URL into URL text field. Click to OK button.

For NetBeans 6.7.1 use http://kenai.com/projects/nbappengine/downloads/download/1.0_NetBeans671/updates.xml

 For NetBeans 6.8 use http://kenai.com/projects/nbappengine/downloads/download/Latest_NetBeans68/updates.xml

1. Switch to Available Plugins tab and choose Google App Engine modules (server, configuration, deployment, editor hints)
2. Click to Install button


After that follow below links steps

http://kenai.com/projects/nbappengine/pages/Home

Tuesday, July 21, 2009

open-source security framework

Apache Shiro is a powerful and flexible open-source security framework that cleanly handles authentication, authorization, enterprise session management and cryptography.

see below link
http://cwiki.apache.org/SHIRO/index.html

Saturday, July 18, 2009

Maven and Netbeans 6.7


Recently Sun relases netbeans 6.7 a great and mature IDE.I am using Netbeans 6.7 from day one when it relased and ready to download.It provides lot of feature like application servers, databases, profilers, debuggers, RESTFul services, SOAP support, XML editors and database browsers etc But one new feature I find really good and productive which shifted myself from eclips to netneans 6.7 .


It maven support. Netbeans 6.7 offer native support for maven2 with no need for additional plug-ins or workarounds. I find its support much better then maven's eclips support. Netbeans 6.5.1 used Ant for the entire build process,. Ant support works well, but the Ant scripts generated were complicated and difficult to maintain without NetBeans. Maven projects can now be opened and built directly in NetBeans without requiring conversion or adaptation. Maven archetypes are available for creating Java EE (Java Enterprise Edition) projects. Deployment, remote debugging and profiling now also work with Maven.



Its new version includes additional useful functions such as visual dependency graph of module relationships, auto-completion for searching for dependencies in POM (Project Object Model) and full-text searching in the repositories.







Its provide built-in support to creating maven standalone projects,web project and enterprise application.Maven project makes your project indpendance of IDE.Maven project created in netbeans automatically open in IntelliJ Idea or Eclips as maven project no workaround needed to convert project type specific to IDE.




you can also customize your maven global settings from options and create your shortcut for mostly used goal in user friendly way.Currently I am using Netbeans IDE for my professional work.



It also provides lots of other good options Kenai integration,a powerfull UML Designer plugin ,better svn support,web services support and lot of more things which I didn't explore.

Sunday, April 19, 2009

Open Source Solution for Database Synchronization


Some time we need solution for database synchronization/replication in application end.Databases itself provides database replication solution but it has limitation when some customization required.

Cases When This Type Of System Required
  1. It could be help when limited number of tables are need synchronization functionality.
  2. Offline/Online management for data synchronization.
  3. Replication support needed across different combination of supported databases.
  4. Replication needed on partial data (Tables, Rows and column can be customize).
  5. etc
Thanks to open source community for providing us solution for this specific problems too.I only mention two open source solutions which I explore little bit.

SymmetricDS - SymmetricDS is a web based/Standalone service/Embedded application, database independent, data synchronization system. Beyond replicating tables between relational databases the software incorporates functionality to handle a large number of databases, manage low-bandwidth connections and work within periods of network outage. The system supports two way replication, guaranteed delivery and multiple active schemas.

Daffodil Replicator - Daffodil Replicator performs data replication based on the 'Publish and Subscribe' model. Replicator supports bi-directional data replication by either capturing a data source snapshot or synchronizing the changes. It monitors data changes, synchronizes all data changes on periodic basis or on-demand. Replicator can use pre-defined conflict resolution algorithms to resolve conflicts between data sources.

Thursday, February 7, 2008

Java Standard Tag Library (JSTL) Advantages

Java Standard Tag Library (JSTL) Advantages

JSTL, which stands for Java Server Pages Standard Tag Library, is a collection of custom JSP tag libraries that provide common Web development functionality. It was originally developed as the open source Apache Jakarta Taglib project but is now managed by the Java Community Process (JCP) under JSR-52 and Standard by Sun. JSTL's key goal was to remove the need for J2EE Web developers having to build their own proprietary tag libraries for common Web development processes.

The common Web development areas which JSTL covers include:

  • Conditionals
  • Iterations
  • Text formatting
  • Database access (SQL)
  • XML processing
  • Internationalization
  • Accessing URL resources

Problems With Scriptlet
Java Server Pages Provide a way to develop presentation layer by merging static HTML code and dynamic Java Code using script. It is best as compared servlet but programmers or web developers who work on presentation layer mix java code.

  1. Scriptlet code is not reusable--Scriptlet code appears in exactly one place: the JSP page that defines it.
  2. Scriptlets encourage copy/paste coding--Because scriptlet code appears in only one place, it is often copied to a new context.
  3. Custom tags centralize code in one place. When a tag handler class changes, the tag's behavior changes everywhere it is used.
  4. Scriptlets mix logic with presentation-. Scriptlets can easily confuse the intent of a JSP page by expressing program logic within the presentation.
  5. Scriptlets break developer role separation.
  6. Scriptlets make JSP pages difficult to read and to maintain
  7. Scriptlet compile errors can be difficult to interpret
  8. Scriptlet code is difficult to test

<% if

((User)session.getAttribute("user")).getName().equals("test") {
%>
<% }
%>



<>test =" $ { user.name = = 'test'
} " >

.......
<
/ c : i f >




JSP Standard Taglib
Library Advantages

1.
Standard Tag
Once standardized, JSTL will provide a rich layer of portable
functionality to JSP pages.
It is easy for developer to
understand other code easily. Before Jstl every made his propriety tag
which are different for
every one now its standard and easy
to understand for all. It also is mature and tested.

2.
Make Code Neat and Clean It makes the code neat and clean usually
scriplet confuse the developer due to mixing of java and html

code. it
makes clean the code

3
.Automatic JavaBeans Introspection Support Here is
little advantage to JSTL over JSP scriptlets. But if you consider that
JSTL's
expression language handles JavaBean introspection
automatically.

4.
Easier
for Humans to Read JTSL is based on XML, which is very similar to HTML.
Rather than spending a great deal of time learning
where to
put semicolons and how to construct code blocks, HTML programmers can
fall right into a programming language that is similar to
HTML


5.Easier for Computers
to Read It is also much easier for computers to read. Tools such as
FrontPage and Dream weaver
are generating more and more HTML
code. Although HTML generation tools do a great job of formatting HTML
code, they often
run into problems when this HTML code is
intermixed with JSP scriptlet code. Because JSTL is always expressed in
XML-compliant tags,
it will be easier for HTML generation
tools to parse the JSTL code that is contained within the document




The above
are basic benefits of jstl
.JSTL introduce new way of
development and have lots of benefits in bits and
bytes level
I discussed only bytes level benefits it not easy to cover bites level
in this discussion but it is enough
for
understanding.

Tuesday, January 22, 2008

My Experience on JSF (Implementation My Faces)

Java Server Faces web application framework has its own pros and cons. It needs more time to mature .In my experience most of the web applications do similar operations like display grids for showing data list with paging and sorting support , add data form, updating data, deleting data (Basically CRUD operations) uploading and downloading streams etc., with its business logic. Ajax introduces new ways of web application development. I mostly used core ajax for small usage of ajax and if needed more ajax then used prototype, dojo preferred JavaScript tool kit solutions as compared to tags solution. I am expert in struts 1 and made many applications on struts and have seen some other web frameworks like struts 2.0 spring etc. and JSF too. A few month ago I fortunately got an opportunity to work on JSF.

I personally feel jsf provides rapid development but limits you in many cases. I used rich faces library for Ajax and GUI widgets. Used Eclipse as the development Environment.

I made the following observations after using jsf

Nothing happened" problems. Some times validation error occurs without any reason on the combo box.

Doesn’t report meaningful, useful error messages.

Doesn’t Provide Exception handler support like struts.

Ajax support is too easy by using ajax4j tags but it sometimes breaks backing bean population on the submit form.

Hard to use JavaScript with jsf.

No proper display table with paging and sorting support like display tags.

Too many backing beans in session.

Difficult to use jstl with jsf expression language and it creates problems in complex logics.

Cannot send direct request to backing beans where it decides where to go like struts actions. (Sometimes we need to go to the action first and then action decide which jsp will be shown ). I didn’t find this functionality in jsf.

Monday, January 21, 2008

Unit Testing

‘Testing an application is a frustrating task for me .Configure JUnit and writing the unit test for every method but you can never deny the important of unit testing. Junit framework deserves congratulate for introducing the idea of test-driven development to Java developers and teaching them how to effectively write unit tests. One of friend told me yesterday about Test NG framework The Next Generation Testing Framework. It indeed awesome. To see more info see some link below”

http://www.ibm.com/developerworks/java/library/j-testng/

http://testng.org/doc/documentation-main.html

http://www.javalobby.org/articles/testng/

Its Features

  • JDK 5 Annotations (JDK 1.4 is also supported with JavaDoc annotations).
  • Flexible test configuration.
  • Support for data-driven testing (with @DataProvider).
  • Support for parameters.
  • Allows distribution of tests on slave machines.
  • Powerful execution model (no more TestSuite).
  • Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc...).
  • Embeds BeanShell for further flexibility.
  • Default JDK functions for runtime and logging (no dependencies).
  • Dependent methods for application server testing.