Would like to share with you OpenXava an AJAX Java Framework for Rapid Development of Enterprise Web Applications.
With this frame work developer just need to create Entity Class and rest of the web application effort is taken care by Frame work.
For example lets say we had a table name as Login having some fild in DB (It support both Oracle and MYSQL) we had used MYSQL.
We just need to create a class given below and we can get Web application having functionality like Add, Update, Delete, Table dispaly with Data, Sorting, Searching, Reporting PDF and XLS, Formating Report ETc.
package com.scrum.model;
import java.io.*;
import javax.persistence.*;
import org.openxava.annotations.*;
import org.openxava.annotations.*;
@Entity // This marks Project class as an entity
public class Login implements Serializable{
@Id
@Column(length=11)
private int loginId;
@Column(length=11)
private int loginId;
@Column(length=45)
@Required
private String userName;
@Required
private String userName;
@Column(length=45)
@Required
private String userPassword;
@Column(length=11)
@Required
private int prjId;
public int getLoginId() {
return loginId;
}
public void setLoginId(int loginId) {
this.loginId = loginId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public int getPrjId() {
return prjId;
}
public void setPrjId(int prjId) {
this.prjId = prjId;
}
@Override
public String toString() {
return "Login [loginId=" + loginId + ", userName=" + userName + ", userPassword=" + userPassword + ", prjId="
+ prjId + "]";
}
}
Surprise to belive ..let's do some handon exercise now
@Required
private String userPassword;
@Column(length=11)
@Required
private int prjId;
public int getLoginId() {
return loginId;
}
public void setLoginId(int loginId) {
this.loginId = loginId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public int getPrjId() {
return prjId;
}
public void setPrjId(int prjId) {
this.prjId = prjId;
}
@Override
public String toString() {
return "Login [loginId=" + loginId + ", userName=" + userName + ", userPassword=" + userPassword + ", prjId="
+ prjId + "]";
}
}
Surprise to belive ..let's do some handon exercise now
Step -1 Download OpenXava frame work from
http://www.openxava.org/
Step 2- Extract donwnloaded Zip
Step 4- Open your installed eclipse and switch to the workspace provided in zip extract
i.e. C:\openxava-5.5\workspace
Step 5:- Now either you can try existing project provided by Openxava for learning
http://openxava.wikispaces.com/quick-start_en
Or you can build your own project as we are going to do it now
Enter required information and it will create project Folder for you as shown below.
Step 5:- As we are using MY SQL as DB and we want our web server to connect it when it start up for that open the file
C:\openxava-5.5\tomcat\conf\context.xml
and add following line in it
type="javax.sql.DataSource"
maxActive="20" maxIdle="5" maxWait="10000"
username="siddhu" password="siddhu"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/"/>
maxActive="20" maxIdle="5" maxWait="10000"
username="siddhu" password="siddhu"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/"/>
Step 6:- Add Server in Eclipse as given below (Select the Server which given by OpenXAVA)
C:\openxava-5.5\tomcat
C:\openxava-5.5\tomcat
Step 7:- Create package *.*.model in your source folder and keep our JAVA class inside it.
Please not
A:- Name of the JAVA class must be similar to the name of the Table
B:- Name of the field must be similar to the Colum of Table
C:- Your Table must have mandatory PK key.
D:- Use annocation i.e. @Entity to define this class can be linked by Frame work with Table in DB.
A:- Name of the JAVA class must be similar to the name of the Table
B:- Name of the field must be similar to the Colum of Table
C:- Your Table must have mandatory PK key.
D:- Use annocation i.e. @Entity to define this class can be linked by Frame work with Table in DB.
package com.scrum.model;
import java.io.*;
import javax.persistence.*;
import org.openxava.annotations.*;
import org.openxava.annotations.*;
@Entity // This marks Project class as an entity
public class Login implements Serializable{
@Id
@Column(length=11)
private int loginId;
@Column(length=11)
private int loginId;
@Column(length=45)
@Required
private String userName;
@Required
private String userName;
@Column(length=45)
@Required
private String userPassword;
@Column(length=11)
@Required
private int prjId;
public int getLoginId() {
return loginId;
}
public void setLoginId(int loginId) {
this.loginId = loginId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public int getPrjId() {
return prjId;
}
public void setPrjId(int prjId) {
this.prjId = prjId;
}
@Override
public String toString() {
return "Login [loginId=" + loginId + ", userName=" + userName + ", userPassword=" + userPassword + ", prjId="
+ prjId + "]";
}
@Required
private String userPassword;
@Column(length=11)
@Required
private int prjId;
public int getLoginId() {
return loginId;
}
public void setLoginId(int loginId) {
this.loginId = loginId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPassword() {
return userPassword;
}
public void setUserPassword(String userPassword) {
this.userPassword = userPassword;
}
public int getPrjId() {
return prjId;
}
public void setPrjId(int prjId) {
this.prjId = prjId;
}
@Override
public String toString() {
return "Login [loginId=" + loginId + ", userName=" + userName + ", userPassword=" + userPassword + ", prjId="
+ prjId + "]";
}
}
Step 8 :- Make changes in following two files
C:\openxava-5.5\workspace\ScrumAndroidWebApplication\xava\application.xml
Add following line in it i.e. android stand here for our Schema name.
C:\openxava-5.5\workspace\ScrumAndroidWebApplication\xava\controllers.xml
Step 9 :- Run you created apllication on tomcat server of Eclipse and you will be able to see below screen
No comments:
Post a Comment