₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,277 members, 8,421,133 topics. Date: Friday, 05 June 2026 at 08:15 PM

Toggle theme

Mimohmi's Posts

Nairaland ForumMimohmi's ProfileMimohmi's Posts

1 2 3 4 5 6 (of 6 pages)

ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 11:40pm On Oct 07, 2006
@chineduleo


Since you are into VB, most OOP concept should be quite clear to you. Also,
just try and go through these links, you should be up and running fast.
Thanks.

https://www.nairaland.com/nigeria/topic-8060.0.html
https://www.nairaland.com/nigeria/topic-6848.0.html
ProgrammingRe: Java On Ubuntu Linux by mimohmi(op): 11:54pm On Oct 04, 2006
@adewaleafolabi
No amarok does not come with ubuntu, but you can download
it from this site, just choose the one that suite your system.
http://amarok.kde.org/wiki/Download
and for installation check http://kubuntu.org/announcements/amarok-1.4.3.php
or if you are connected to the net, just do this,
apt-get install amarok
all the installation and configuration will be done for by the apt tool.
See ya.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 4:18am On Oct 03, 2006
@subcareer n candylips

Thanks for the support, had to migrate to ubuntu linux,
took most of my time getting all my java stuff to run on it. Had to look for a way
getting a chm reader for linux. Now am back on track and ready to move on.
ProgrammingRe: Java On Ubuntu Linux by mimohmi(op): 12:31am On Oct 03, 2006
@skima

Hey, am really down with this ubuntu, infact it's bye to windows for now.
Just discovered the support for ubuntu, especially if you have internet access.
All you have to do is connect and use the apt-get install command, your package is
downloaded and install for you without further configuration.
I finally got the chm reader for Linux on ubuntu. I will just add this link for anybody
who wants to explore ubuntu or debian linux system.

http://easylinux.info/wiki/Ubuntu_dapper
ProgrammingRe: Java On Ubuntu Linux by mimohmi(op): 3:47am On Oct 01, 2006
Hey guys, my ubuntu is up and running, my internet connection, finally came up and my old java pal,
also sitting on mama ubuntu. Happy ubuntu.

ProgrammingRe: Java On Ubuntu Linux by mimohmi(op): 12:38am On Sep 30, 2006
Hey, guys, mean nobody is interested in catching up in this new fun in linux. To my last post, Some how i was able to get myself started. Since I install my ubuntu, I have been unable to set up my internet connection for some obvious reasons that am still working on, so i had to download the binary version of jdk1.5.0_08 from sun's website. Now, this is what i did to get my sun's jdk and jre running. I created a system link called jdk to my jdk1.5.0_08 directory, all in my /usr/local directory. Next i edited my .bashrc,/etc/profile and /etc/environment files to reflect my new classpath. Now the funny part, I added my jre/bin as the first entry in the /usr/environment path file. Hulala, when i login with my user name, i can actually see my java pointing to the binary version i installed, now i can compile and run any java programme, was also able to install netbean and java studio. Now the problem, as root, my system still point to the ubuntu jvm.
ProgrammingRe: Learning Java Without Tears by mimohmi(op): 11:44pm On Sep 24, 2006
@ sedan


Am in Lagos, had problems with my old laptop, so lost all I had on it. All hope is not lost,
got another laptop for two months now. Still got all those stuff and more. So all you have to
do is give me a call on 01-8972759, and get some blank cds, and copy all you can.
For people outside Lagos, still give me a call, so that we make adequate plans to
get it across, wish all Java Fun week ahead.
ComputersRe: I Need Linux CDs by mimohmi(m): 1:08am On Sep 24, 2006
@adewaleafolabi

There is one nice thing I like about open source, that is sharing (Ubuntu - South African language), anything you
ever want to do, have been done by people, who are more advanced than you and I, so the key is always
do search on the net, you must surely get a clue to solving your problems. Or might just bump into the solution.
Back to your topic, check this link, hope it helps.
http://www.arachnoid.com/linux/linux_mobile_internet_access.html
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 12:36am On Sep 24, 2006
@subcareer

Thanks for the encouragement, these are my final codes after refactoring

[b]
// PawnTest class
package pieces;

public class PawnTest extends junit.framework.TestCase {

public void testCase() {

String firstPawnColor = Pawn.WHITE_PAWN;
Pawn whitePawn = new Pawn(firstPawnColor);
assertEquals(firstPawnColor, whitePawn.getColor());

String secondPawnColor = Pawn.BLACK_PAWN;
Pawn blackPawn = new Pawn(secondPawnColor);
assertEquals(secondPawnColor, blackPawn.getColor());

}
}

// Pawn class

package pieces;

public class Pawn {

public final static String BLACK_PAWN = "black";
public final static String WHITE_PAWN = "white";
private String color;


public Pawn(String color){
this.color = color;

}


public String getColor(){

return color;
}

}

//BoardTest class

import junit.framework.TestCase;
import java.util.*;
import pieces.*;

public class BoardTest extends TestCase {


private Board board;


public void setUp(){


board = new Board();


}

public void testCase(){

//Just testing to make sure, I have no pawn on the board
assertEquals(0,board.getNumberOfPieces());


}

public void testAddPawn(){


//create a piece of pawn and add it to the board

Pawn pawn1 = new Pawn(Pawn.BLACK_PAWN);
board.addPawn(pawn1);

//Check numbers of pawns on board
assertEquals(1,board.getNumberOfPieces());

//Test if the pawn is the first pawn added to the board,then test for the colour
assertEquals(pawn1, board.get(0));
assertEquals("black",board.getPawnColor(0));

//same test as for pawn1
Pawn pawn2 = new Pawn(Pawn.WHITE_PAWN);
board.addPawn(pawn2);
assertEquals(2, board.getNumberOfPieces());
assertEquals(pawn2, board.get(1));
assertEquals("white", board.getPawnColor(1));

//Testing with the Pawn getColor() to ensure the colour is as per expected.
assertEquals("black",pawn1.getColor());
assertEquals("white",pawn2.getColor());

}
}

//Board class
import java.util.*;
import pieces.Pawn;



public class Board {

//create an ArrayList of pawns to be added to the board
private List<Pawn> pawns = new ArrayList<Pawn>();


//Board constructor, this can be used to add new pawns
public Board(Pawn pawn){
pawn = new Pawn(Pawn.WHITE_PAWN);
}

public Board(){}


public void addPawn(Pawn pawn){
pawns.add(pawn);
}

public int getNumberOfPieces(){
return pawns.size();
}


public Pawn get(int index){

return pawns.get(index);
}


//Not too comfortable with this method,think there should be a better way
//to handle. Just getting a Pawn object from get(index) and calling it's
//getColor() to get the colour.

public String getPawnColor(int index){
return get(index).getColor();
}


}

[/b]

Hope to hear from you, just started chapter three today. Once more thanks
ProgrammingJava On Ubuntu Linux by mimohmi(op): 4:55am On Sep 23, 2006
Hey, got an Ubuntu Linux cd from skima, installed on my Gateway amd laptop, no problem. As a Java Developer and
a Linux freak, I wanted to get up doing my Java stuff, but problems. OK, I will say some of the problems I encountered. The first
was and still is connecting my ubuntu to the internet using my CDMA phone with a usb converter. The second was installing
my Java SE development kits (jdk), this i partially did, partial because up till now I still unable to run my java GUI application
on ubuntu, the default JVM is still been used by the system. However, I have been able to set my classpath and
install Java Enterprise studio and the Gui runs fine.
My findings, don't want people to make the same mistakes, i made. Infact, I had to reinstall the ubuntu about four times
to get my classpath right. Ok, in ubuntu, unlike other Linux based system, setting your classpath in /etc/profile doesn't
work, you have to set it in a file called /etc/environment, also that will be for system level. When I did that, It worked as root
only, so i had to repeat it in my .bashrc file, after word, javac and other commands were now available to me (my login name), except
tools like policytool that require GUI, even my GUI codes can't run. As I explore more, I will be sharing it also. For people
who are able to install Linux, and don't know what to do after wards, just to do the things you do on your window system
on the Linux box, if you make any mistake and can not fix it, just do re installation and keep trying, it does't bite but
just the time and effort, which you will be happy about later. More to follow.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 2:34am On Sep 23, 2006
@subcareer

Finally, here is my solution for exercise two, but i strongly believe that the code can be better,
I will just post as per the requirements



[b]

// PawnTest class

public class PawnTest extends junit.framework.TestCase {

public void testCase() {

String firstPawnColor = "White";
Pawn whitePawn = new Pawn(firstPawnColor);
//String whitePawn = firstPawn.getColor();
assertEquals(firstPawnColor, whitePawn.getColor());

String secondPawnColor = "black";
Pawn blackPawn = new Pawn(secondPawnColor);
assertEquals(secondPawnColor, blackPawn.getColor());

//Pawn noClolor = new Pawn();


}
}

// Pawn class

public class Pawn {

private final static String BLACK_PAWN = "black";
private final static String WHITE_COLOR = "white";
private String color;

public Pawn() {
this.color = WHITE_COLOR;
}

public Pawn(String color){
this.color = color;

}


public String getColor(){

return color;
}

public void setColor(String color){
this.color = color;
}

}

//BoardTest class

import junit.framework.TestCase;
import java.util.*;




public class BoardTest extends TestCase {


private Board board;
private Pawn pawn;

public void setUp(){

pawn = new Pawn();
board = new Board(pawn);


}

public void testCase(){


// Pawn pawn = new Pawn();
//board = new Board();
assertEquals(0,board.getNumberOfPieces());
assertEquals("white",board.getPawnColor());

}

public void testAddPawn(){


pawn = new Pawn("black"wink;
board = new Board(pawn);
board.addPawn(pawn);
assertEquals("black",board.getPawnColor());
assertEquals(1,board.getNumberOfPieces());


Pawn pawn2 = new Pawn("white"wink;
board.addPawn(pawn2);
assertEquals("white", pawn2.getColor());
assertEquals(2, board.getNumberOfPieces());


assertEquals("black",pawn.getColor());
assertEquals("white",pawn2.getColor());

}
}


//Board class
import java.util.*;

public class Board {

//create an ArrayList of pawns to be added to the board
private ArrayList<Pawn> board = new ArrayList<Pawn>();

private Pawn pawn;

//Board constructor, this can be used to add new pawns
public Board(Pawn pawn){
this.pawn = pawn;
}


//public Board() {
// pawn = new Pawn();
//}


public void addPawn(Pawn pawn){
board.add(pawn);
}

public int getNumberOfPieces(){
return board.size();
}

public String getPawnColor(){
return pawn.getColor();
}


}

//AllTest.java

import junit.framework.*;

public class AllTest {

public static TestSuite suite() {
TestSuite suite = new TestSuite();

suite.addTestSuite(PawnTest.class);
suite.addTestSuite(BoardTest.class);

return suite;
}


}
[/b]
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 11:42pm On Sep 22, 2006
@subcareer

Hey, thanks for the ebooks, very nice books. I have been reading Agile Java Crafting Code with Test-Driven
Development, never thought of doing testing, but very nice approach to programming. Just finished chapter two,
and try to work a solution to the exercise, promise to submit my solutions for your perusal. Once more a big thanks and
have a sweet and error free weekend.
ProgrammingRe: Learning Java Without Tears by mimohmi(op): 2:56am On Sep 19, 2006
@chistiana
Sorry for not checking some of the past post, ok, just feel free to let me where you got
lost, it is a learning thread, I did promised from my first post to carry everybody along.
Infact, if there are points that are not clear, anybody should just feel free to ask for
further clarification. So, expecting your post.
ComputersRe: I Need Linux CDs by mimohmi(m): 2:32am On Sep 19, 2006
@hayprof

Learning Linux as I said before could be fun, Linux is all about passion. I started with Redhat 6.0, those days
where you have to manually configure your x window system, any mistake, you monitor is history. To me,
I believe the Redhat version is the best place to start, there are lots of resources out there for everyone
for free. It's also one of the widely used, though this point is debatable. To install Linux, you need to
understand the various file systems involved, especially how to create you swap partition, it is just
setting a space on the hard drive which serves as extra memory, when your RAM is fully used, the
system moves some of the processes to the swap space, there by free you RAM for other high priority
processes,
You will also need to understand boot loader, LILO used to be the most popular loader for Linux, but
since GRUB came out, it's now what must users prefer, reasons i wouldn't know. The installation of all Linux
system these days is quite simple, most users, boot from CD ROM, there are wizards to guide you through the
process. Couple of questions are asked, you just fill in the answers as it apply to your system. Also,
there are different version of Linux for various brand of processors, for example, you will hear X86 and co,
these are just type of processor, you don't need to know the details, just know your processor type and
you are good to go. Sorry for making this post long, when you are ready, just post the stages you are
so that we can tackle it together as you progress. Happy sailling.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 1:08am On Sep 19, 2006
@subcareer


Hey man, will really appreciate that, my mail add is mimoh_mi@yahoo.com


@candylips


The fact is you guys are cool, I hope we can keep this tempo up. I am really doing a lot
of hands on in multiple areas right now. Especially in areas like Java EE, Frameworks
and xml. Come to think of it how much of xml do one have to know as a Java Developer ?
ProgrammingRe: Learning Java Without Tears by mimohmi(op): 12:48am On Sep 19, 2006
@gbengaijot

Ok, this is the point, by the fact that your classpath was added to Blue J, doesn't mean it is
in your system classpath, the reason you were ask to install the Java SE first was to enable the Blue J to
integrate the java tools into it's own environment. Try going to your command prompt and type javac
or any of the tools in your Java SE bin folder. Won't tell you the result, or just try install some tool
like Tomcat, they screech and ask for JAVA_HOME, try and post your result.


@adewaleafolabi


From your classpath, i can't really figure out what the QTJava.zip is all about, but what I think you should do is set your
JAVA_HOME = C:\Program Files\Java\jdk1.6.0
then add %JAVA_HOME%\bin to the end of your classpath, open a new Dos prompt and type javac and you should see a message like this

C:\Documents and Settings\Owner>javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
, ,
, ,

Your final classpath should be like this.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Pane;%JAVA_HOME%\bin
Hope it helps, if it doesn't let me know.
PoliticsRe: Recent Coup Attempt In Nigeria? by mimohmi(m): 12:09am On Sep 19, 2006
Gentlemen, in as much as we are in this forum to share ideas, I think the aim shouldn't be to
mislead people. If we are not sure of our facts, I don't think it make sense to voice it out. And
for those of us shouting the Khaki boys, remember that the so called khaki boys have being the
unifying factor of this our great country. Like in any group of calling, everybody can not be the same.
Please, let's be objective in our arguments and learn to appreciate our own things. God bless us all.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 3:08am On Sep 18, 2006
@ candylips

Thanks for your candid guidance. but I think some of the point you raised about EJB 3.0,
is quite debatable, EJB 3.0 is backward compartable, you can deploy you EJB 2.1 applications in EJB 3.0 servers.
Take a look at the specification, nothing about persistence was mentioned in it, it was the same old
Entity Bean. SUN created a different specification for persistence. Also, the new persistence api is not tied
to Java EE, it can be used in other java se applications including web service.

Here is the link for persistence specification https://sdlc1a.sun.com/ECom/EComActionServlet;jsessionid=198C719191DA6A6569A05A3322C79AAE#


@subcareer

Thanks for your comments about my font size, hope it's better now. Please, do you have the
ebook version of the book, you are using for the Spring Framework ?. In my last post, I wanted to know the
book you are using for EJB 3.0, because I am using Mastering EJB 4th Edition, nice book. I could send you
the ebook copy, if you are interested
ProgrammingRe: Learning Java Without Tears by mimohmi(op): 1:03am On Sep 18, 2006
@gbengaijot

For jre, yes, that is the Java Runtime Environment, but for the jdk, that is the development Environment,
NO, you have to manually add it to you classpath. Hope I have answer you question, have a nice day
ProgrammingRe: Learning Java Without Tears by mimohmi(op): 11:56pm On Sep 17, 2006
@afolabbi

Please don't be frustrated, we all go through this when we are getting into something new, but I will tell you that
you are doing well, because we tend to learn more from our mistakes. Go through this process, https://www.nairaland.com/nigeria/topic-8060.0.html#msg569210 if it doesn't work, please just post
you classpath, so that I can see where things went gaga, hoping to hear from you.

@heyprof, if you don't mind give me a call on 018972759, so that time to meet. Pls get 3 blank cds.
Thanks
ProgrammingRe: Who Knows Phone Programming? by mimohmi(m): 12:32am On Sep 17, 2006
@hayprof


Here is the link https://www.nairaland.com/nigeria/topic-8060.0.html, hope to make new post by weekend. You can also check out this thread https://www.nairaland.com/nigeria/topic-6848.0.html, nice one too. Have a lovely night.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 5:56am On Sep 15, 2006
@sbucareer

I quite agree with you, i am just going through the learning curve, for me i know that ejb3.0 is the way. But spring come to play
when we need to develop lightweight Java EE application, where transaction isn't much of requirements. Infact just some few moment
ago, while scratching the web for materials on Spring, I came across another version called Spring Work Flowhttp://www.springframework.org/download. The thing is just to used to more design pattern, because it's only
when you know the two before you can make a choice. Which book are you using for ejb3.0 ?
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 12:22am On Sep 15, 2006
@candylips
Here are my codes for the personnel table. Am using the spring MVC framework

Personnel.java represents my personnel table

package com.navy.domain;

import java.io.Serializable;

/**
*
* @author Owner
*/
public class Personnel implements Serializable {
private int pid;
private String serviceNum;
private String name;
private String status;
private String addr1;
private String addr2;
private String city;
private String state;
private String zip;
private String phone;

/** Creates a new instance of Personnel */
public Personnel() {
}

public int getPid() {
return pid;
}

public void setPid(int pid) {
this.pid = pid;
}

public String getServiceNum() {
return serviceNum;
}

public void setServiceNum(String serviceNum) {
this.serviceNum = serviceNum;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getStatus() {
return status;
}

public void setStatus(String status) {
this.status = status;
}

public String getAddr1() {
return addr1;
}

public void setAddr1(String addr1) {
this.addr1 = addr1;
}

public String getAddr2() {
return addr2;
}

public void setAddr2(String addr2) {
this.addr2 = addr2;
}

public String getCity() {
return city;
}

public void setCity(String city) {
this.city = city;
}

public String getState() {
return state;
}

public void setState(String state) {
this.state = state;
}

public String getZip() {
return zip;
}

public void setZip(String zip) {
this.zip = zip;
}

public String getPhone() {
return phone;
}

public void setPhone(String phone) {
this.phone = phone;
}

}

DAO

package com.navy.dao;

import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public interface PersonelDao {
public Personnel getPersonnel(int pid);
public Collection<Personnel> getAllPersonnel();
}


My RowMapper class

package com.navy.dao.jdbc;

import com.navy.domain.Personnel;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;

/**
*
* @author Owner
*/
public class PersonnelRowMapper implements RowMapper{

/** Creates a new instance of PersonnelRowMapper */
public PersonnelRowMapper() {
}

public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
Personnel pers = new Personnel();
pers.setPid(rs.getInt("PID"wink);
pers.setServiceNum(rs.getString("SERVICENUM"wink);
pers.setName(rs.getString("NAME"wink);
pers.setStatus(rs.getString("STATUS"wink);
pers.setAddr1(rs.getString("ADDR1"wink);
pers.setAddr2(rs.getString("ADDR2"wink);
pers.setCity(rs.getString("CITY"wink);
pers.setState(rs.getString("STATE"wink);
pers.setZip(rs.getString("ZIP"wink);
pers.setPhone(rs.getString("PHONE"wink);

return pers;

}


}

My JdbcDAO


package com.navy.dao.jdbc;

import com.navy.dao.PersonelDao;
import com.navy.domain.Personnel;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

/**
*
* @author Owner
*/
public class PersonnelJdbcDao extends JdbcDaoSupport implements PersonelDao{

private PersonnelRowMapper rowMapper;

/** Creates a new instance of PersonnelJdbcDao */
public PersonnelJdbcDao() {
rowMapper = new PersonnelRowMapper();
}

public Personnel getPersonnel(int pid) {
Object result = getJdbcTemplate().queryForObject("select * from Personel where PID=?",
new Object[]{new Integer(pid)},
new int[]{Types.INTEGER}, rowMapper);

return (Personnel)result;
}

public Collection<Personnel> getAllPersonnel() {
Collection<Personnel> result = null;

List queryResults = getJdbcTemplate().query("select * from Personel", rowMapper);

if (queryResults != null) {
result = new ArrayList<Personnel>(queryResults.size());
for (Object o : queryResults) {
if (o instanceof Personnel) {
result.add((Personnel)o);
}
}
}

return result;
}


}

Service and DAO interfaces exposing the same methods.

package com.navy.dao;

import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public interface PersonelDao {
public Personnel getPersonnel(int pid);
public Collection<Personnel> getAllPersonnel();
}


service implementer


package com.navy.service;

import com.navy.dao.PersonelDao;
import com.navy.domain.Personnel;
import java.util.Collection;

/**
*
* @author Owner
*/
public class PersonnelServiceImpl implements PersonnelService{

private PersonelDao personelDao ;

/** Creates a new instance of PersonnelServiceImpl */
public PersonnelServiceImpl() {
}



public PersonelDao getPersonnelDao() {
return personelDao;
}

public void setPersonnelDao(PersonelDao personelDao) {
this.personelDao = personelDao;
}

public Personnel getPersonnel(int pid) {
return personelDao.getPersonnel(pid);
}

public Collection getAllPersonnel() {
return personelDao.getAllPersonnel();
}

}

Now the controller.

package com.navy.controller;

import com.navy.service.PersonnelService;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;

/**
*
* @author Owner
*/
public class PersonnelController implements org.springframework.web.servlet.mvc.Controller{

private PersonnelService personnelService;

/** Creates a new instance of PersonnelController */
public PersonnelController() {
}

public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {

if (request.getParameter("pid"wink != null) {

int pid = new Integer(request.getParameter("pid"wink).intValue();

return new ModelAndView("personnel.jsp", "personnel", getPersonnelService().getPersonnel(pid));
} else {

return new ModelAndView("personnels.jsp", "personnels", getPersonnelService().getAllPersonnel());
}
}

public PersonnelService getPersonnelService() {
return personnelService;
}

public void setPersonnelService(PersonnelService personnelService) {
this.personnelService = personnelService;
}



}

cofig files

applicationcontext.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>java:comp/env/jdbc/pms</value>
</property>
</bean>


<bean id="personnelDao" class="com.navy.dao.jdbc.PersonnelJdbcDao">
<property name="dataSource">
<ref local="dataSource"/>
</property>
</bean>

<bean id="personnelService" class="com.navy.service.PersonnelServiceImpl">
<property name="personnelDao">
<ref local="personnelDao"/>
</property>
</bean>
</beans>

personnel-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- Create a mapping of URI's to Controller -->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="/personnels.do">personnelController</prop>
<prop key="/personnel.do">personnelController</prop>
</props>
</property>
</bean>

<!-- Provide the ProductController with access to an implementation of the
ProductService. The ProductService is defined in applicationcontext.xml -->
<bean id="personnelController" class="com.navy.controller.PersonnelController">
<property name="personnelService">
<ref bean="personnelService"/>
</property>
</bean>
</beans>

context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/PMS">
<Resource auth="Container" driverClassName="org.apache.derby.jdbc.ClientDriver" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" name="jdbc/pms" password="admin" type="javax.sql.DataSource" url="jdbc:derby://localhost/pms" username="admin"/>
</Context>


web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<description>PMS</description>
<display-name>PMS</display-name>
<distributable/>
<context-param>
<description>Spring Application Context</description>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationcontext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>personnel</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>personnel</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<resource-ref>
<res-ref-name>jdbc/pms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

Whao, hope not too much of stress, my question again, I still have to more tables for courses and signon, do i have
to have a diff controller for each or can i boundle all the logic in the personnel controller ?
Thanks for the guide, just learning.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 12:54am On Sep 14, 2006
@candylips
Thanks for your contribution. As earlier mentioned, you just forced me into the spring circle. But come to
think of it, despite the simplicity of the spring framework, i still feel that there are some situation where it might not
be appropriate to use spring, infact I am currently reading a book on EJB 3.0, nice book - Mastering EJB 3.0, it has a free
pdf version that can be downloaded for free @http://www.theserverside.com/tt/articles/index.tss, try and get
it, all you need is just register and the book and many more are yours.

Ok on my project, i strongly believe the best way to learn new technology is by trying it out. I am using netbean,
with a derby database. I just want to create say a Personnel Management System using the Spring framework.
I have Personnel table that holds each personnel data, Course table for courses attended by a particular personnel
and finally user table that holds user name and password. I have a class the represent that represent each table, DAO
and it's implementer class for each table, my question is do i need to create a controller servlet for each class -- ie table ?
ComputersRe: I Need Linux CDs by mimohmi(m): 12:11am On Sep 13, 2006
Hey guys,
Never mind, i understand how much you people want to get on with Linux based systems.
For now i never thought my last post will take me this far, my Promise is to contribute to my old
pal's thread on Linux based system. Pls am preparing a little note on that, which i hope to post
by weekend. Please stay close and tight.
ProgrammingRe: Who Knows Phone Programming? by mimohmi(m): 11:51pm On Sep 12, 2006
@adewaleafola
I must tell you the truth, java was design to be easy but that's far from it. With the new drag and drop
ide like neatbean, you can actually develop your application with minimum understand of java, i run a java
training thread on this site, purely basic concept of the language, so i intend to bring to bear on mobile
programming in java. Stay glue.i
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 11:37pm On Sep 12, 2006
@candylips
Hey I tend to agree with you, but come to think of it, why would you want to develop an enterprise application,
you must need a java ee environment to deploy you application. The java ee design pattern is the basic pattern which all other
pattern must meet to be java e e compliant.
ComputersRe: I Need Linux CDs by mimohmi(m): 12:54am On Sep 11, 2006
@ heyprof
Using Linux is quite interesting and fun. It provide you with lot of challenges. I run the Redhat version on my desktop and ubuntu version
on my amd gateway laptop. The thing with Linux is that if you know one migrating to other version is always easy. The only area you might
have to work on might be package manager, the Redhat version uses the Redhat package manager(RPM) while other version uses the debian package manager, both of these handles your program installation. You can also use the never say old binary files for installing softwares on Linux systems.
Running more one OS on a system is called dual or multiple booting systems, all you need do is install a boot loader, which manages the way your
system boots, you can tell the boot loader which OS you want to run. Note that Linux and windows can never ever reside on the same partition,
you must create a partition for Linux and windows respectively. It always advisable to install windows before Linux
ProgrammingRe: Who Knows Phone Programming? by mimohmi(m): 12:35am On Sep 11, 2006
Hi guys
If you intend to go into mobile programming, it isn't that difficult, cos the libraries involved is quite small
and with java ide, you can do drag n drop to develop your application. I will try and post a simple j2me app using
netbean within the week. Enjoy your week of programming.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 11:53pm On Sep 10, 2006
@Clocky
Thanks for forcing me to learn the spring framework, you were quite wright on your points, but come to think of it
subcareer was also wright on migrating to spring from java ee. Just within 2 weeks of studying i am almost comfortable
using the spring framework. I will want to say that lot of XML configuration and interface implementation are involved, also the api aren't that simple for beginners to learn. but am still more comfortable with the ejb stuff.
ComputersRe: I Need Linux CDs by mimohmi(m): 1:00am On Aug 24, 2006
Hi guys,
This man call skima appear to real o. Seun, please allow this post for once. We are not English
people. This skima of a guy was chasesd by a cheater yesterday, the cheater pursue am so
ta, the cheater come tire, just because of Ubuntu cds, and him come land me
one, make una help me hail am. The guy na real man.
ProgrammingRe: Looking For People Interested In Exploring JavaEE 5 And EJB 3.0 by mimohmi(op): 12:09am On Aug 23, 2006
Hey Clocky,
If i may say, the new Java EE, though just new will definitely top the list of enterprise framework. Do agree with you on the J2ee 1.3 - 1.4
implementations but all those problems have be taken care of in this new version. In fact, entity bean is heading for the bin soonest, instead
we now have persistant managers and class just the same POJO, that the spring framework offers. Let me just show a simple application.


This is the new interface.

import javax.ejb.*;


//this is a remote interface
@Remote
public interface AdviceRemote {

// exposed business method

public String getAdvice();
}

The bean

import javax.ejb.*;

//Show that it's a stateless bean

@Stateless
public class AdviceBean implements AdviceRemote {

public AdviceBean() {
}

//Business methods

public String getAdvice(){
return "Do not u think this is cool";
}

}


OK, the client


import javax.ejb.*;

public AdviceClient {

//inject JNDI name
@EJB() AdviceRemote advice;
public String hearAdvice() {

// call your business method
return advice.getAdvice();
}
}

As you can see you no longer have to implements all those callback methods. You just have a greater control.
Cheers

1 2 3 4 5 6 (of 6 pages)