tag:blogger.com,1999:blog-84977005708446442322024-03-14T14:53:07.532+05:30Programming For FutureFuture driven solutions.Unknownnoreply@blogger.comBlogger216125tag:blogger.com,1999:blog-8497700570844644232.post-5421833890986151332020-11-02T23:50:00.002+05:302020-11-02T23:50:25.000+05:30E-Commerce solutions availalbe Today, we see many eCommerce platforms already up and running. If I try to categories them based on their development cost, here we see the following cases: Enterprise eCommerce platform like hybris, Oracle ATG Web Commerce, IBM Websphere Commerce, etc. These platforms are massive and require many resources and budget to keep them running. These are proprietary solutions built by Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-18486989134931699302020-11-01T12:40:00.003+05:302020-11-01T12:40:33.239+05:30Handling multi-line String in java 14 Using text blockFinally, Java has introduced the feature many developers like me looking for. Handling the string which has multiple lines in it, we had to use concatenation approach to store it in a String object. It was hard to handle HTML output from java program or Servlet sometime. For example, here was the approach to handle multiple lines of HTML output earlier.
String output = "<html>\n" +Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-53670800616119454552016-08-21T13:35:00.001+05:302016-08-21T13:35:48.094+05:30Generating Menu Tree Or Catagory Tree hierarchy
There has always been a basic requirements in website or web applications that the menu bar must be dynamic and all menu items should be appeared under their respected parent. Here, if you are managing the menu items in database, then you have to retrieve all menu items in the way that each menu item must have its proper position in menu tree. here you could use just a loop because you don't Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-8725475689991763182015-10-04T12:48:00.001+05:302015-10-07T08:21:41.866+05:30Getting started with Restful web service in java using jersey
Creating Restful web services in java is not a difficult task. You just use some annotation to expose you methods as web service end points. All annotations those turn your method into web services are in javax.ws.rs package. To host you web service, you can use tomcat or any web server. One thing you need to do is, configure the jersey ServletContainer servlet in web.xml for the particular url Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-66554009524698499612015-10-04T12:47:00.003+05:302015-10-09T08:53:46.668+05:30Overview of Spring Framework
Spring framework is the platform which supports for developing java
applications using its infrastructure (Physical and organizational
structures). Spring allows you to develop application with simple plan
old java objects (POJO). Spring takes care of managing objects and their
lifecycle. This framework provides the stage for your objects to play
their role and all dependencies the objects Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-37429037826719239512014-06-22T07:39:00.001+05:302015-05-18T08:49:08.454+05:30Spring MVC - File upload Example
<!-- BEGIN SyntaxHighlighter BEGIN -->
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.all();
<!-- END SyntaxHighlighter END -->
spring-dispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-23190027703744310452014-03-06T20:03:00.004+05:302014-03-06T22:52:29.896+05:30Authorize.Net Java Integration - Your script timed out while we were trying to post transaction results to it.
I have been facing the following error while integrating Authorize.Net with java project using Direct Post Method .
Your script timed out while we were trying to post transaction results to
it.
Transaction ID: 0
Transaction Result: This transaction has been
approved.
I searched for solutions but did not get resolved this issue easily. I
traced network packets and found some Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-64595230292520551612013-12-22T09:30:00.000+05:302013-12-22T09:30:10.895+05:30javax.validation.ConstraintViolationException: validation failed for classes [*] during update time for groups [javax.validation.groups.Default, ]
This message wasted many hours to figure out the solution.
javax.validation.ConstraintViolationException: validation failed for classes [*] during update time for groups [javax.validation.groups.Default, ]
When I applied the validation as following, I found that the confirmPassword is the field causing validation error.
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();&Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-27306170379549536772013-12-07T10:36:00.002+05:302013-12-07T10:36:45.784+05:30Searching perticular extension file in All or Specified location of system using java program
import java.io.*;
public class SearchFile {
public static void main(String... ar) throws Exception {
File f1 = new File("F:/");
printFiles(f1);
}
static Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-76117819051495644162013-11-23T17:07:00.001+05:302013-11-23T17:07:54.038+05:30Hibernate - Getting records in sorted order and hibernate pagination.
Hibernate has inbuilt API for ordering and retrieving records in pages.We can use Criteria API to get the result from database instead of Using query or load/get. The things those are applied in SQL queires, same are applied here with the help of Criteria API. You can provide selection conditions to criteria object. You can add order and pagination of records. Here is the simple method for Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-25789103143995941222013-11-22T17:19:00.000+05:302013-11-22T17:20:56.865+05:30Code Snippet- Redirection in Spring MVC @RequestMapping(value = "/admin")
public String openDashboard() {
return "redirect:/admin/admin-home";
}
@RequestMapping(value = "/admin/admin-home")
public String adminHome() Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-70859961933838014042013-05-25T19:55:00.000+05:302013-12-07T12:17:13.768+05:30Spring MVC - Ajax based form processing using JQuery and JSON with server side validation
Spring MVC provides support for processing the form as well as server side validation. It maps request parameters to form backing bean and validate the bean object if we have used @Valid annotation. When we submit the form, form get displayed with the error messages if validation is failed. Error messages are managed by Spring MVC and spring MVC binds them to the input fields.
But, If we want Unknownnoreply@blogger.com6tag:blogger.com,1999:blog-8497700570844644232.post-49055552369966891932013-05-14T16:51:00.002+05:302013-11-23T17:12:02.641+05:30WARNING: SQL Error: 1062, SQLState: 23000 SEVERE: Duplicate entry '*' for key '************'May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptionsWARNING: SQL Error: 1062, SQLState: 23000May 14, 2013 4:35:23 PM org.hibernate.util.JDBCExceptionReporter logExceptionsSEVERE: Duplicate entry '2' for key 'navigation_id'May 14, 2013 4:35:23 PM org.hibernate.event.def.AbstractFlushingEventListener performExecutionsSEVERE: Could not synchronize database state with Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-8497700570844644232.post-5784448680205992142013-04-07T11:10:00.001+05:302013-04-07T11:10:25.132+05:30Uploading file using Servlet/JSP with the help of apache commons-fileupload library
Here is the example to upload the file using commons fileupload library.
package imagesvideos.webcontroller;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-83204545254137335352013-03-27T16:15:00.000+05:302013-03-27T16:37:10.595+05:30Spring MVC - Populating domain object (Form backing Object) in view and updating some properties
Sometimes we need to update the domain object partially. We get complete object from database but we have to update some fields of it using html form. In this situation, original Data Object is kept on the server and some fields are asked to be filled by user.
In Sprint MVC, we have implemented feature that helps us to get it done. There is @ModelAttribute annotation that captures Bean object Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-42337217272337428112013-03-24T16:27:00.000+05:302013-03-24T16:27:00.597+05:30Understanding run time polymorphism of an objectRun-time polymorphism is the ability of an object to play multiple roles at run-time. See the following program where the object of Cal class will have different behaviors according the reference variable through which it is pointed. If we access Cal object using c, it has add() and sub() methods. If we access it using a reference variable then only add() method is accessible and same is for b Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-38728495613916554572013-02-20T22:43:00.000+05:302013-02-20T22:43:00.376+05:30JEE : Java Server Page (JSP) life cycleAll the JSP run under supervising of web server. They do not receive
requests from client and they do not send the response to client. All
the JSP pages pass through the Server side processing. And result of
sever side processing is sent to client. That is why they called dynamic
pages. In the case of static page there is no server processing, web
server returns them as they are.
Dotted
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-83025717189906571352013-02-19T22:40:00.000+05:302013-02-19T22:40:00.658+05:30Popular Logics for implementation to check basic skills of fresherFactorial
long Factorial( int n ) {
if ( n>0 )
return( n * Factorial(n-1) );
else
return( 1 );
}
Fibonacci
int Fibonacci( int n ) {
if ( n==1 || n==2 )
return( 1 );
else
return( Fibonacci(n-1) + Fibonacci(n-2) );
}
GCD
int GCD( int a, int b )
{
if ( a>=b && a%b==0 )
return( b );
else if ( a<b )
return( GCD( b, a ) );
else
return( GCD( b, a%b ) );
}
Power
double Power( double x, Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-42698502573223040652013-02-18T09:30:00.000+05:302013-02-18T09:30:06.844+05:30JSP SCRIPTING ELEMENTS
Expression tag ( <%= %>)
This tag is used to sent the output of the expression to the output stream like method println().
This tag allows the developer to embed any Java expression and is short for out.println().
This tag starts with <%= and ends with %>.
A semicolon ( ; ) does not appear at the end of the code inside the tag.
For example,to show Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-67864181679073885872013-02-17T04:30:00.000+05:302013-02-18T08:07:23.185+05:30JSP : Predifined variables | implicit objectsThere are following implicit objects those become available to programmer to use in JSP page.
out
The out implicit object is an instance of a javax.servlet.jsp.JspWriter object and is used to send content in a response. The JspWriter object emulates some of the functionality found in the java.io.PrintWriter and java.io.BufferedWriter objects to provide a convenient method of writing Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-60617246978809578922013-02-16T22:27:00.001+05:302013-02-16T22:27:45.568+05:30@AttributeOverrides annotation in hibernate/JPA@AttributeOverrides annotation is used in hibernate/JPA to rename the column(s) name of the embadable class while it is being embedded in other class.
Suppose A class is embedded in class B, then if A entity contains the column name of any property "phone", then B entity can override the column name to "mobileNumber". So, in the table, column name will be "mobileNumber".
package entity;
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-66991780152041917922013-02-15T21:32:00.001+05:302013-02-15T22:20:54.157+05:30Hibernate (or JPA) - Using "mappedBy" attribute of mapping annotations(like @OneToOne, @OneToMany, @ManyToMany)Using "mappedBy" attribute of mapping annotations(like @OneToOne, @OneToMany, @ManyToMany) for bi-directional relationship. This attribute allows you to refer the associated entities from both sides. If "X" has association with "Y" then you can get X from Y and Y from X.
For example, If you have "Book" entity and "Author" entity those are associated to each other in the way that Book has a Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-8497700570844644232.post-37704394915386086302013-01-19T08:20:00.004+05:302013-01-19T08:20:56.983+05:30Hibernate SchemaExport tool for Automatic schema generation
Hibernate provides various utilities for developer in which SchemaExport is the one of those utilities that generates SQL queries representing the schema including referential integrity, keys, relationship for the entities and collations. you can use these generated schema to populate the tables structure in database.
Dialect must be specified there before creating schema so that this tool canUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-8497700570844644232.post-1158726140885383442012-10-06T21:44:00.002+05:302012-10-16T06:40:18.103+05:30Struts2 Resource Handling - Using Hindi language in internationalization (i18n)
Struts2 provides us different ways for handling message resources. Struts2 supports internationalization for different locales and we can provide message resources for different locales. Struts2 will use resource file naming convention through which it identifies that which message resource file to be used within the particular session.
See the following configuration.
<?xml version="Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-8497700570844644232.post-65116041629274914432012-09-18T15:00:00.001+05:302013-11-23T17:12:02.646+05:30FreeMarker : Example
Freemarker is a simple templating engine that can generate text contents from any type of template. It is so simple that you can learn it in a single day and can use it in any project.
It helps you when&Unknownnoreply@blogger.com0