Rabu, 29 Juli 2009

seam-gen

beberapa tahapan seam-gen:
1.seam setup
2.seam new-project
3
.seam generate-entities
4.seam explode

Tutorial belajar Seam

http://www.thescreencast.com/2007/06/jboss-seam-generator-and-eclipse-ide.html

Senin, 13 Juli 2009

Running JBoss Application Server in Windows

-Please download JBoss AS from http://www.jboss.org/jbossas/downloads/

- Set JAVA_HOME and JBOSS_HOME
  • JBOSS_HOME = C:\jboss-5.1.0.GA
  • JAVA_HOME = E:\Program Files\Java\jdk1.6.0_10\
- Set PATH
%JAVA_HOME%\bin;%JBOSS_HOME%\bin;

-run from console/command
%JBOSS_HOME/bin/run
C:\>%JBOSS_HOME%/bin/run
Calling C:\jboss-5.1.0.GA\bin\run.conf.bat
===============================================================================

JBoss Bootstrap Environment

JBOSS_HOME: C:\jboss-5.1.0.GA

JAVA: E:\Program Files\Java\jdk1.6.0_10\\bin\java

JAVA_OPTS: -Dprogram.name=run.bat -Xms128M -Xmx512M -XX:MaxPermSize=256M -Dsun
.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg
.jboss.resolver.warning=true -server

CLASSPATH: C:\jboss-5.1.0.GA\bin\run.jar

===============================================================================

- Testing server
type : localhost:8080 in web browser


Jumat, 03 Juli 2009

install maven2 di Windows

  1. Download Maven:

    Maven 2.0.9

    GeoTools Maven Version
    2.6.x maven-2.0.9
    2.5.x maven-2.0.9
    2.4.x
    2.3.x
    2.2.x maven-2.0.5-bin.zip
  2. Unzip the maven download to your computer: C:\java\maven-2.0.9
    • The use of maven-2.0.9 is now required
    • If you do not have an unzip program may we recommend: http://www.7-zip.org/
  3. You need to have the following environmental variables set for maven to work:
    JAVA_HOME C:\j2sdk1.4.2_07\ Location of your JDK installation
    M2_HOME C:\java\maven-2.0.9 Location of your maven installation
    PATH %JAVA_HOME%\bin;%M2_HOME%\bin Include java and maven bin directory in your PATH

    (You can change all of that with Control Panel > System > Advanced > Environmental Variables)

Did it Work?

Open up a cmd window and type the following:

C:\java>mvn --version

Jumat, 14 November 2008

Displaytag pakai decorator

< name="accgroups" defaultsort="1" defaultorder="descending" requesturi="#" class="datatbl rowObject" pagesize="20" export="true" decorator="my.ListAccountStructureDecorator">
< name="basic.empty.showtable" value="true">
< name="export.excel.filename" value="groupstructure.xls">
< name="export.csv.filename" value="groupstructure.csv">
< name="export.pdf" value="false">
< property="accountType" title="Account Type" sortable="true" headerclass="sortable">
< property="accountNumber" title="Account Number" sortable="true" headerclass="sortable">
< property="accountName" title="Company Name" sortable="true" headerclass="sortable">
< property="acronym" title="Acronym" sortable="true" headerclass="sortable">
< /display:table>

Decorator:
public class ListAccountStructureDecorator extends TableDecorator {

public String getAccountNumber() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountNumber();
}

public String getAccountName() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccount().getAccountName();

}

public String getAccountType() {

AccGroupStructureReport data = (AccGroupStructureReport)getCurrentRowObject();

return data.getAccType().toString();
}
}

contoh penggunaan struts.xml pada Struts2

< ?xml version="1.0" encoding="UTF-8"?>
< !DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<>
< name="backoffice_sampel" extends="default" namespace="/backoffice/sampel">
< name="*@crud_*" method="{2}" class="my.sample.{1}Action">
< name="input">/jsp/sampel/{1}/view.jsp< /result >
< name="list">/jsp/sampel/{1}/list.jsp< /result >
< name="error">/jsp/sampel/{1}/error.jsp< /result >
< name="add">/jsp/sampel/{1}/add.jsp< /result >
< name="edit">/jsp/sampel/{1}/edit.jsp< /result >
< name="success" type="redirect-action">{1}@list< /result >
< name="redirection" type="redirect-action">
< name="actionName">${toClassName}@crud_${toMethodName}< /param>
< name="namespace">/backoffice/sampel< /param >
< /result >
< /action >
< /package>
< /struts>

Kamis, 13 November 2008

Ubah String ke Date

Kita akan mengubah String dengan format MM/yyyy ke format Date DD/MM/yyyy.

Contoh:
Input String 02/2008
Output Date 01 Feb 2008

Cuplikan code:

//deklarasikan variabel formatter
DateFormat formatter = new SimpleDateFormat("MM/yyyy");
Date eDate;

Method :
public void convertEndDate(String eDate) {

try {
this.eDate = (Date)formatter.parse(eDate);

} catch (ParseException e) {
e.printStackTrace();
}
}