Skip to main content

Posts

Showing posts from June, 2011

Barebones Spring MVC Part 1: Core

This article is part of the Barebones Spring MVC series. When building a new Spring MVC application, I often find it useful to start from a barebones Spring MVC application in which I have already gone through the motions of basic configuration and coding. This simple example realizes a fully functional, albeit limited, Spring MVC application to serve as a springboard for more advanced Spring MVC applications. The goal is to present a simple form, harvest input from the user, process the input on the server, and present it back to the user. First, the form backing class is defined: package com.earldouglas.springmvc.web ; import java.util.List ; public class SimpleForm {         private String value1 ;         private String value2 ;         private List < String > value3 ;         public String getValue1 ( ) {                 ret...

Eclipse Helios Crash on Linux

I have eclipse Helios installed in a opensuse 10.3 box. it seems the eclipse editor keeps crashing eclipse application every time i type a dot ‘.’ to access object methods. if you experience same problem you can try the following two fixes: if you don’t have xulrunner package then install it (example using Yast2 in opensuse). make sure you only install latest xulrunner version. if you install two different xulrunner versions in your linux OS the two versions might conflict and cause eclipse to crash again. this was my problem. when i removed old xulrunner 191 and only kept xulrunner 192 then eclipse helios stops crashing and works well. The second fix (that doesn’t require to install xulrunner but seamonkey) is to specify to the Java VM the location of xulrunner . To do this : 1-Edit file : ~/eclipse/eclipse.ini 2- add the following text below the ‘-vmargs’ line : -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/seamonkey     From:   http://othmanelmoulatb...

Cach cai dat phan mem cho linux

Cơ bản về “Cài đặt phần mềm trên Linux” Một vài cách thì đơn giản như cài đặt từ các file .EXE trên Windows. Hầu hết các HĐH Linux cũng có công cụ quản lý, cài đặt, gỡ bỏ phần mềm như Add or Remove Programs trong Windows. Ví dụ, trong Ubuntu, nếu PC của có nối mạng thì bạn có thể download và cài đặt ứng dụng tự động thông qua công cụ Synaptic Package Manager giao diện GUI hoặc sử dụng dòng lệnh apt-get trong Terminal ... Có nhiều cách khác nhau để cài đặt phần mềm, ứng dụng trên Linux. 1 vài trong số đó thì khá phức tạp (...), 1 vài cách thì đơn giản như cài đặt từ các file .EXE trên Windows. Hầu hết các HDH Linux cũng có công cụ quản lý, cài đặt, gỡ bỏ phần mềm như Add or Remove Programs trong Windows. Ví dụ, trong Ubuntu, nếu PC của có nối mạng thì bạn có thể download và cài đặt ứng dụng tự động thông qua công cụ Synaptic Package Manager (giao diện GUI) hoặc sử dụng dòng lệnh apt-get trong Terminal ... File cài đặt cho ứng dụng trên Linux thường có phần mở rộng như .deb, ...

how to use log4j in web mvc

ta co file log4j.xml la file cau hinh. //--------------------------------------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">     <!-- Appenders -->     <appender name="console" class="org.apache.log4j.ConsoleAppender">         <param name="Target" value="System.out"/>         <layout class="org.apache.log4j.PatternLayout">             <param name="ConversionPattern" value="[%t] %d - %-5p: %c - %m%n"/>         </layout>     </appender>     <appender name="rolling" class="org.apache.log4j.RollingFileAppender">         <param name="file" value="facebookapp.log...

Spring pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>spring</groupId> <artifactId>test</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <org.springframework.version>3.0.5.RELEASE</org.springframework.version> </properties> <!-- Shared version number properties --> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope...

Hibernate Tips

1.Config for hibernate auto create table 2. Remember Element Session-Factory don't set name property 3. Remember Transaction is compulsory. 4. Calling Oracle Stored Procedure from Hibernate While calling Oracle stored procedure from Hibernate  there is couple of rules that we need to follow. There can be only one return value and this must be a reference cursor. This return reference cusor must be the first and only out value for the stored procedure. It is required that stored procedure must return a reference cursor to be used from Hibernate. Here is my stored procedure which return book name and ISBN number for a given branch and for a given author CREATE OR REPLACE PROCEDURE SP_LIB_DTL(p_cursor    out sys_refcursor,                                        in_brnch_cd in ...
Script:

config tomcat in eclipse

1. download sysdeo. copy file devloader7danh cho tomcat7 (de phu hop version.) vao thu muc lib cua tomcat 7. Tiep theo copy tat ca plugin sysdeo vao thu muc plugin trong eclipse. tiep theo: continue:(Nho check cai can context... Hoi nay ghi thieu) continue: continue: Vay la ok. Truong hop rat hay loi tomcat la ban se gap loi nhu sau: "org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter" ta se lam nhu hinh sau: neu chua co tac dung thi xoa file .tocatplugin trong project cua ban va cau hinh tomcat lai tu dau. .Config Sysdeo Tomcat

Connect internet voi proxy in java

Bua nay aAn bay ket noi proxy voi facebook, xua gio chua lap trinh proxy bao gio, bua nay moi biet

hibernate my tutorials

1. Create with hibernate tool file "hibernate.cfg.xml": file config hibernate 2.Create file "hibernate-reverse-engineering" 3.Create file mapping, remember you sure all information in red border is absolute correct.

java get content html

String urltext = "http://www.vogella.de"; URL url = new URL(urltext); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) { // Process each line. System.out.println(inputLine); } in.close();

Java fetch html content

URL url = new URL("http://www.google.com"); URLConnection conn = url.openConnection(); DataInputStream in = new DataInputStream ( conn.getInputStream (  )  ) ; BufferedReader d = new BufferedReader(new InputStreamReader(in)); while(d.ready()) { System.out.println( d.readLine()); }