Wednesday 19 June 2013

Struts 1.x CURD APPLICATION

Struts 1.3
CURD OPERATION IN ECLIPSE
Conform Your Self which JRE by going to Use windows=>preferances=>java=>Installed Jre
Conform Your Self which Tomcat version by going to Use windows=>preferances=>server=>Run time Environment
1)Create  New=>Dynamic Project
2) copy all the struts 1.3 jars and past it into Your lib(WEB-INF/lib)
 3)Right click on one jar=>properties=>copy the location where your jars exist=>close window
4)Right click on project=>Build Path =>Configure Build Path=>Libraries=>Add external jar=>
paste the copied path of jars=>select all the jars
  Add all the other Jstl 1.2 jar,jstl-api1.2jar,jstl.jar,struts-el-1.3.8jar,servlet-api.jar
Click on OK
5)Please Remember the Following things
1)jar have to be placed in the lib folder
2)web.xml,struts-confing.xml,other which ends with .xml have to be placed in WEB-INF/
3)jsp,html,css,...can be placed in WebContent(out side of the WEB-INF generally)
if your want we can place in WEB-INF also but in Configuration files we need to specify path like
WEB-INF/jsp/myjsp.jsp
4)Add all the Required .TLD files in the WEB-INF
5)

Saturday 15 June 2013

Links

CORE JAVA                                                                              SERVIECES
 Techfaq360                                                                                        Naukri         
 Mkyong                                                                                             Monster                    
 java2s                                                                                               Timesjobs     
RoseIndia                                                                                           Shine 
Vaannila                                                                                   TRAVELS
W3schools                                                                                         IRCTC   
Tutorialpoint                                                                                     APSRTC              
JavaEra                                                                                             REDBUS
Way2java                                                                                          KSRTC
                                                                                                          Goibibo.
                                                                                                          Makemytrip.
                                                                                                          Cleartrip
                                                                                                          Easygotrip.

 java4s                                                                                        Walkins
docs.oracle                                                                                         Javaken
 JavaBeat                                                                                          DurgaJobs
 Java-Success                                                                                   PresentJobs
Reload                                                                                               jobsplane
HTML                                                                                        MAILS
SQL                                                                                                  Gmail
PL/SQL                                                                                             Yahoo
UNIX                                                                                                Rediffmail
 DevelopersBook                                                                Social Networking sites
JaiswalTraining                                                                                    Facebook
JavaTip.Net                                                                                          Orkut
 Visualbuilder                                                                   Recharge Ur Mobile by Credit/Debit card
laliluna.(Hibernate)                                                                                 Recharge It Now
candidjava.                                                                                   Movie Tickets
Dzone.                                                                                                   Book my show
oracle.Docs
viralpatel.net                                                                            Entertainment
mydeveloperconnection                                                                    GreatAndhra
technofes                                                                                            Andravillas
krams                                                                                                   OneIndia
raistudies                                                                                            Circkinfo
developer.am                                                                                                     
Kodejava                                                                                                   
javatpoint
FAQS                                                                                      Knowledge
 javacodegeeks                                                                                   freejobalert
javabeginnerstutorial                                                                            indiabix
thecafetechno                                                                                     sarkari-naukri
techmyguru(JDBC)                                                                               Gk                   
fruzenshtein                                                                                          ibps          
mrbool                                                                                                BankPoPapers
easywayserver.                                                                                    Current Affairs Download              
                                                                                                         
                                                                                                 Online TV channels
                                                                                                           yupptv.

SCJP MOCK EXAM                                                                                                                                SCJP EXAM2                                                   
SCJP EXAM3 
SCJP EXAM4
           
OracleExamples
oracletutorial.

Struts2
FAQ
Compelete J2EE FAQ


Official sites
JAVA
Spring3.0  Spring2.5.4
Struts2    refer
Struts 1.x
Hibernate
PL/SQL


softwares to download

 Srinivas Rao videos      Java Videos      JavaBrains Videos      bharaththippireddy Videos

Handa ka fanda

TeraData
 Ab initio  1




                                                                         

Friday 3 May 2013

Java Knowledge


Jar(*.class/*.java)
War(Servlet ,jsp)
Ear(jar+war)
JDBC code –we need odbc14.jar file
4)Jad in bin of JDK
          .classfiles-------à.java files
1)Extract jar contents
Note:-Take a new folder and put only one jar file(eg:-odbc14.jar)
Go to that path where jar exist>jar –xvf odbc14.jar
2)SEE the source files of the .class files
Note:-Take a new folder and put  (odbc14 folder containing .class files)
Go to that path where.classfiles>jad -0 –r –s .java –d src */**/*.class
O---- override
r ---restore package directory structure
s—output file extract
d---directory for output files
src—folder name
Eclipse versions
 EclipseName----                           Version                                       Date of Relese
Callisto 3.2 30 th june 2006
Europen 3.3 29 th june 2007
Ganymede 3.4 25 th june 2008
Galileo 3.5 24 th june 2009
Helios 3.6 23 th june 2010
Indigo 3.7 22 th june 2011
Juno 4.2 27 th june 2012
1)Work spaceàrightclick-> import-> svn repository->new repository->URL given by them->
userName    XXXX(given by them)
password    YYYY(given by them)
 2)Rightclickon project->build path->configureBuild Path->source->Add folder->
Project name
Check the Checkbox the Src folder-àok
3)window ->preferances-> validations-> Check the Checkbox on suspend all validations->ok
4)MyEclipse->)window ->preferances->servers->
Enable Exterrnal server
Add->browse the Tomcat latest version installed on your computer upto Tomcat6.0->ok...
5)In servers perspective(down)-> Right click on tomcat server and “Add or Remove”
Select the project to run on the server->Add ->finish

6)when you have the Bug ,Start the server in DEBUG Mode
After Modifications in the code
Stop the Server(tomcat)->clean->Build(if neccessary add jars[external jars])->run in DEBUG Mode
Stop->clean->Build->Deploy->Run(or)Run as DEBUG Mode

CURD OPERATIONS
learntechnology
tutorials4u
.java4s
dzone
rkcole

JDBC


JDBC CRUD ( Create, Read, Update and Delete) example

The following are login credentials :
  • Database Server - localhost
  • User - root
  • Password - root
  • Database - test
Step1 : Establish connection with database     [ Type1 driver ]         [ Type4 driver ]

Step2 : Create following table in MySQL database server -
1 use test;
2 create table Emp
3 (
4 code varchar(10) primary key,
5 name varchar(40) null,
6 city varchar(20),
7 salary int
8 );
9 insert into Emp values('a001','Ram Kumar','Noida',10000);


Step3 : Following code to insert record in the above table -
01 public void insertEmp(String code, String name, String city, int sal)
02     {
03         try {
04             ps = con.prepareStatement("insert into Emp values(?,?,?,?)");
05             ps.setString(1, code);
06             ps.setString(2, name);
07             ps.setString(3, city);
08             ps.setInt(4, sal);
09             int i = ps.executeUpdate();
10             if (i != 0){
11               System.out.println("Inserted");
12             
13             else {
14               System.out.println("not Inserted");
15             }
16         }
17         catch (Exception e) {
18             e.printStackTrace();
19         }
20     }
Step4 : Following source code is to update employee city and salary based on employee code -
01 public void updateEmp(String code, String city, int salary) {
02         try {
03             ps = con.prepareStatement("update emp set city=?,salary=salary+? 
               where code=?"
);
04             ps.setString(1, city);
05             ps.setInt(2, salary);
06             ps.setString(3, code);
07             int i = ps.executeUpdate();
08             if (i != 0) {
09                 System.out.println("updated");
10             else {
11                 System.out.println("not updated");
12             }
13         catch (Exception e) {
14             e.printStackTrace();
15         }
16     }


Step5 : Following source code is to delete an employee record based on employee code -


01 public void deleteEmp(String code) {
02         try {
03             ps = con.prepareStatement("delete from emp where code=?");
04             ps.setString(1, code);
05             int i = ps.executeUpdate();
06             if (i != 0) {
07                 System.out.println("deleted");
08             else {
09                 System.out.println("not deleted");
10             }
11         catch (Exception e) {
12             e.printStackTrace();
13         }
14     }
Step6 : Following source code is to display an employee record based on employee code -
01 public void dispAnEmp(String s) {
02         try {
03             ps = con.prepareStatement("select * from Emp where code=?");
04             ps.setString(1, s);
05             ResultSet res = ps.executeQuery();
06             if (res.next()) {
07                 System.out.print(res.getString(1));
08                 System.out.print(res.getString(2));
09                 System.out.print(res.getString(3));
10                 System.out.println(res.getString(4));
11             }
12         catch (SQLException e) {
13             e.printStackTrace();
14         }
15     }
Step7 : Following source code is to display whole records from employee table -
01 public void dispAll() {
02         try {
03             Statement st = con.createStatement();
04             ResultSet res = st.executeQuery("select * from emp");
05             while (res.next()) {
06                 System.out.print(res.getString(1));
07                 System.out.print(res.getString(2));
08                 System.out.print(res.getString(3));
09                 System.out.println(res.getString(4));
10             }
11         catch (SQLException e) {
12             e.printStackTrace();
13         }
14     }