Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,175,930 members, 7,896,001 topics. Date: Saturday, 20 July 2024 at 11:56 PM

Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? (6301 Views)

100+ Java, JS & JSP Apps With Their Source Code That You Can Make Money With / How To Make Money From Developing Software Using Vb Or Java / JSP Web Development (2) (3) (4)

(1) (2) (Reply) (Go Down)

Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 4:21pm On Jun 09, 2008
My first title for this topic was actually "Java Server Faces a result of misguided competition", but the fear of been misinterpreted by other Java colleagues (I belong to JAND if u must know), made me change the topic at the last moment.

I used to understand than when developing dynamiv/interactive web applications(database driven web applications i mean), Java tries to enforce the advantage of seperating presentation logic from Business logic(Programming codes) hence leaving the presentation part of the web application to the Web/Graphic Designers to create and restrict themselves with interracting with the java beans made available to them. While, the Java developer team creates reusable bean components and deal with issues such as database access, information retrieval, updates etc.

Then(before JSF came into place), when i had a web application job, I used my Macromedia Suites (Dreamweaver, FireWorks and Flash) to create my Front end,  then I create the Bean components + the Servlet(for controlling the navigation/forwarding/central control). Then Gbam! my web application is rolling.

But, with the introduction of Visual Web development from within netbeans and Sun Java studio centre, It seems Java want to be used for designing presentation as well. But the question(and reason for my new thread) is this, "Can Java(Netbeans IDE,etc)  compete with other proven technologies such as Macromedia Suite(specifically Dreamweaver, Fireworks) , Adobe, and Microsoft Web Expressions , which are very productive for developing the presentation part of Web applications?"?? "My answer is an emphatic No?".

I think, Java and I mean Sun should concentrate in what it knows best developing Business Logic, (It is painful/disturbing to know that Web pages designed thru d web designer in Sun cannot be opened by other suites, which is not so for the other suites.) So, if Netbeans/Sun wants to compete with proven web design technologies, then they need to step up their GAME!!! .  Meanwhile, I'll just continue to do my thing the Good Good Way. And maybe completely ignore Java Server Faces(JSFs).

Comments are welcomed from the Java Community, and the programming community as whole. Remember no hating, Just share ur ideas/views.



Proud to be a JAND(Java Nigerian Developers),  Want to Join, Then contact me.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by mosconet(m): 4:43pm On Jun 09, 2008
Well I wont really say Sun is trying to compete, what do you expect as a developer if you see keen
competitor in thesame business with powerful and robust technology that my take away ur
programmer or supporter base. So Sun is only trying to be smart to retain pple, well as u've said
they need to step up their game, am not a Java programmer though and neither have i seen what
JSP/JSF can do but from articles I have read both technologies still need to be hugely touched-up.
Cool brother, continue to use ur own method since u're bringing smiles to ur face and faces of clients smiley
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by logica(m): 4:55pm On Jun 09, 2008
so r u saying JSF pages (presentation/view) are not JSPs?
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 9:34am On Jun 10, 2008
@sbucareer
First of all, I must say I am happy to have started a topic that actually gained the attention of a very well experienced programmer as yourself. Although, I do not enjoy u comparing me with "weak-minded programmers".

@sbucareer
To anyone who read the introduction to this Forum, I stated clearly that Visual Web design in Java for designing web pages using their IDEs is a WEAK attempt (and a very weak one at that) as compared to other tools that can be used such as Macromedia Suites, Web Expression, etc. Hence, my conclusion that Sun should leave page designs to these tools or step up their GAME(as If I pay for it<kidding>wink.

However, JSF for J EE is another story entirely. You say and I quote JSF, Spring, and Hibernate are better suited for J EE Applications. But I want to ask(no pun intended), Can I not achieve this using a well combination of JSP, Servlet and HTML(designing with Visual Web tools) Whatz d difference.

@sbucareer
You can bash Java and it’s technology because of it’s difficult learning curves.

I am a Java developer(SJCP), and for a long time will remain a Java developer(imagine the number of fields/technology/uses contained in it<<Desktop, mobile, web, server,Java card, Java TV, GIS, Java Embedded, etc.>>wink so why will I bash Java Anyway, I just wanted to point out that JSF for Visual web desing is a pain in the ass.

@sbucareer
At no point in time did I complain about the learning curve of Java( although now that u mention it, its quite tedious, especially now that materials on the latest technology are so disorganized and in multiples). I was just talking about the output(the physical appearance of JSF Pages as compared to thers and also the interoperability with others. For example, I can happily open a page designed with dreamweaver with anyother HTML Designer.editor such as Web expression,) !!!
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by logica(m): 6:03pm On Jun 10, 2008
SCJP - u r a Programmer not a Developer. Get it right.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 12:09pm On Jun 11, 2008
@logica
logica:

SCJP - you're a Programmer not a Developer. Get it right.
i think i'll do well by just ignoring you.

@sbu_career
Once again, ur comment as served a very useful purpose. I have chosen a career path in Java. I have studied a number of technologies although I still have a very loooong way to go. My question is this, Java is not taught in schools? So I ask ur advice what is the advisable career path for someone aiming to be an architect? What is the PATH as in the technologies to learn and the sequence of taking them. Please, I think ur opinion will surely count.

It will surely help a lot of us wanna be programmers become a really skilled Java Architect.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 12:33pm On Jun 11, 2008
When I say Java is not thought in schools, I refer to the fact that there is not a central location where Java is been taught and resources been found. Even buying books over the internet is a very long process with a lot of complications of its own. Also, the various I.T training institutions in Nigeria such as NIIT, FirstLogic, Aptech are just money swindlers where at most u can just get an Introduction. So, I will like u to advise me on books I can get. And Softwares to that purpose.

Also The main reason for this topic in the first place is to point out that for most web sites requiring dynamic contents, JSP will SUFFIX!!!
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by Bassie(m): 1:35pm On Jun 11, 2008
Understand JSF real well and you will appreciate it's importance  as a Developer on the Java Platform
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 4:04pm On Jun 11, 2008
@sbucareer
Am once more greatful for ur posts. If a lot of experienced Java Programmers are like u, then the World "Developers" will be "build" a better place "software".
Have not been able to choose a single major path among the three u specified, and don't think I will until I probably start working(am currently an undergrad). But currently I have worked on a number of Desktop applications in Java (my problem here is reporting/reporting tools seamlessly), Web applications(using JSP and HTML) no faces yet though, and recently bought a book on Java Mobile by Wrox(book is still very boring/although I get a lot of excitement thinkin I will be programmin Mobile phones.

Also some of these technologies are interwoven(e.g JDBC). For web I have worked on JSP, Servlet, JDBC, Swings, Networking, RMI(Remote Method Invocation).

The link u gave me points to the Java Documentation, Is that the best place to learn? . Ok if u say so.

Also, it is not really productive searching for downloadable pdf ebooks on net these days. U just keep clicking and clicking until night falls and morning rises. If u already have some sure links to where I can download FREE ebooks, I will be forever indebted.

As a sign of respect, am posting in ur fonts. Hope I get it right.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 5:02pm On Jun 11, 2008
[size=5pt]@sbucareer
Am sorry to say, that is the most elementary thing have seen in Java a long time. It has to do with polymorphism i.e Every String object is an Object object(no pun!!!).

So I understand that what next. If u checked ur prvious 2 post, u just listed 10 items(supposed books) but we got blanks there. I really need help to learn the advanced part of Java TM technology. And am not asking u to come down to teachme, Just give me ebooks or links to sure ones I can download.

@readers
Sorry to be deviating from the subject of this Thread, but hope we all gain a lot, sbucareer is one of the best Java Men(almost said Guys) we can get.
[/size]
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 5:07pm On Jun 11, 2008
@sbucareer
Am sorry to say, but that is the most elementary thing have seen in Java a long time. It has to do with polymorphism i.e Every String object is an Object object(no pun!!!).

So I understand that what next. If u checked your prvious 2 post, u just listed 10 items(supposed books) but we got blanks there. I really need help to learn the advanced part of Java TM technology. And am not asking u to come down to teachme, Just give me ebooks or links to sure ones I can download.

@readers
Sorry to be deviating from the subject of this Thread, but hope we all gain a lot, sbucareer is one of the best Java Men(almost said Guys) we can get.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by logica(m): 5:13pm On Jun 11, 2008
"Billions of wannabe programmers who complain everything about JAVA."

How right can u be

what i'm driving @ is this:

does this dude actually realize JSF display (view) are simply JSPs? so how can u separate JSPs from JSF? JSF is built on JSP technology! they are not competing technologies. ppl all over the place talking about what they don't really know much about. be sure about what u know b4 u come here 2 post.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 5:13pm On Jun 11, 2008

Javaprince as you said that your strength is Desktop, Don't bother with above API, concentrate on Swing API and JSwing API

Remember, JSwing or Swing and AWT are not for Web application development, they are for Desktop development
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 5:16pm On Jun 11, 2008

Soon be back got to do something righ now
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 5:37pm On Jun 11, 2008
@logica
I chose to ignore u, but u've been very persistent and I think u now deserve my comment. First of all, I am no wannabes. I am a young bright Java Programmer with a very good prospect. Also, I believe passed thru various training (from ND in CSC, SJCP in Java, OCP in Oracel, and very soon a B. Tech in CSC,etc). My point here is that u have no Right to call me a wannabe, just because I seek more knowledge.

@logica
logica:

"Billions of wannabe programmers who complain everything about JAVA."

does this dude actually realize JSF display (view) are simply JSPs? so how can u separate JSPs from JSF? JSF is built on JSP technology! they are not competing technologies. people all over the place talking about what they don't really know much about. be sure about what u know before u come here 2 post.

If u had spent time to read the topic of the above thread (guess u didn't), u would have realized when I referenced JSF, i was pointing to the application of Visual JSF on Netbeans as compared to mixing raw JSP,Servelets with Web Designers such as Macromedia Suites, Web Expressions, etc.

@logica
Is it a problem that "Billions of wannabe programmers who complain everything about JAVA." Is it not a good sign that billions of people are now interested to learn Java, and so complain about what they do not understand. If this continues and ppl like sbucareer proffer solutions unlike u who onle comment(for controversial purpose, OWAMBE!!!), then a lot of wannabes would become a Professional, and Nigerians will become more empowered in IT through Java.

@logica
That said, I want u to know that I take NO grudges, and will welcome ur objective ideas and criticisms. Safe my Java Colleague(or is it Lecturer) Just tryin to lighten d mood.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by logica(m): 5:48pm On Jun 11, 2008
It seems Java want to be used for designing presentation as well. But the question(and reason for my new thread) is this, "Can Java(Netbeans IDE,etc) compete with other proven technologies such as Macromedia Suite(specifically Dreamweaver, Fireworks) , Adobe, and Microsoft Web Expressions , which are very productive for developing the presentation part of Web applications?"?? "My answer is an emphatic No?".

so before JSF, Java didn't have any presentation technology? Or are you saying we weren't designing JSP presentation logic using DreamWeaver for instance before JSF? What do you really think JSPs are?

If this continues and people like sbucareer proffer solutions unlike u who onle comment(for controversial purpose, OWAMBE!!!)
you are talking as if you posted a problem and asked for a solution. your thread in local parlance "no get head no get tail".
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by El(m): 11:26am On Jun 12, 2008
There's really no basis for comparism. JSF is an improvement on traditional JSP.It uses an MVP (model/view/presentation) architecture.that means MVP rolled up in a single page. Try and stay up to date as technology changes, else u'll be left in the medieval age.If u are a java developer, u need to look up the technology providers and join developer networks, d benefit being, u stay on the edge.And guys instead of arguing about trifle issues, please concentrate on solving problems with your skills.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 11:36am On Jun 12, 2008
@El
Thanks for ur contribution. This thread was not meant to be an Arguement Session but an Enlightenment Session. I don't know how many times I got to say this, but I was refering to Visual JSF for creating/designing Pages(RAD using NEtbeans tools) as compared to Macromedia Suites and Web Expressions, Visula Studio IDE.

But I agree, with all u said, as Java devlopers we all have to stay up to date.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by candylips(m): 9:35am On Jul 08, 2008
JSF has not lived up to its initial promise. I have used Myfaces which is probably the only stable JSF implementation and getting it to work is a nightmare. Although after the initial sting it is quite good.

My main problem with JSF is that it promised a lot but has delivered ver little. It promised the abundance of off the shelf componenets just like we have in .NET but this has not happend. There are just a couple of componenets out there with still very difficult configuration mechanism.

I will rather use a tested and thrusted technology like JSP with a couple of open source taglibs to get the job done. JSF still uses taglibs as well u know!!
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by mydevbox: 7:40pm On Jul 10, 2008
@javaprince
Hey, I kinda fink dis post was targeted at sbucareer. Nywayz, now his email is available u cld learn more from him. Rily wat logica is askin is on wat basis do u call urself a javaprince wen u make a post like dis (kiddin)? Personally, I perceive u ‘ve got a thirst for knowledge and it is important in ur chosen career path. If u rily like desktop java dev. den I would suggest u checkout dis projects:

Eclipse RCP development using SWT- (for me, nothing compares to dis for java desktop development. Fine I understand Netbeans has support for RCP. Though u mite not be able to achieve d snazzy effects possible with Swing)
Pivot (it’s the new toolkit on the block)
Spring RCP- recently had a release

For advance java technologies I don’t fink u wld get dem in books. U find dem flying around the blogosphere, forums, wiki’s etc.

@candylips
Have u tried Sun’s implementation. Commentaries point to it being very stable, perhaps the best. Not had any serious challenges with it. Not taking anytng away from apache myfaces. And as per availability of components , I must say there are plenty. Try checking out jboss richfaces, Woodstock, commercial icefaces, cant remember some now.

@logica
Who says JSF is built on jsp technology. Wat do u mean by technology here? JSF is certainly a component based presentation framework, based on xml and with built-in support for component lifecycle management. To a large extent JSP and JSF are competing techs. Pliz, note dat JSF displays aint JSP’s coz JSP’s are actually compiled to servlet , for JSF, views are not compiled but rather parsed. No compiler is required.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by logica(m): 4:10pm On Jul 11, 2008
What I mean is, the view components of JSF are more often implemented as JSPs. How can they then be competitors? It's like saying Portlets and JSPs are competitors, or Struts and JSPs are competitors.

Check this article out if in doubt:

http://www.javaworld.com/javaworld/jw-12-2004/jw-1213-jsf.html

Or simply go to google and do a search using the 2 terms "JSF" and "JSP". I'm sure you will find enough articles on their relationship.

As a matter of fact, the official page of JSF is here:

http://java.sun.com/javaee/javaserverfaces/overview.html

And I quote directly from the home page:

JavaServer Faces technology includes:

* A set of APIs for representing UI components and managing their state, handling events and input validation, defining page navigation, and supporting internationalization and accessibility.
* A JavaServer Pages (JSP) custom tag library for expressing a JavaServer Faces interface within a JSP page.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 11:41pm On Jul 11, 2008
[size=1pt]
Just want to share this piece of code with Java enthusiast. It is about Desktop programming. Mind you this code is not compiled or tested. It was typed directly onto the forum message editor. If it doesn't compile when you copy and paste it, you would need to debug it.



package Phone;

import javax.swing.UIManager;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.text.*;

public class MobilePhoneApplication extends JPanel{

  private JPanel mainPanel;
  private JPanel display;
  private JPanel keyPads;
  private JPanel keyControls;

  private JTextArea textArea;

  private JButton call;
  private JButton end;

  private ActionListener listener;
  private DocumentListener docuListen;
  private Document jDocument;


  public MobilePhoneApplication (ActionListener listener, DocumentListener docuListen){
 
     try{
            UIManager.setLookAndFeel
                ( UIManager.getSystemLookAndFeelClassName() );
        }catch(Exception e ){
        }//End try
    this.listener = listener;
    this.docuListen = docuListen;
   
    mainPanel = new JPanel();
    display   = new JPanel();
    keyPads   = keyPads();
    keyControls = new JPanel();
   
    keyControls.setLayout ( new FlowLayout( ) );
   
    call = new JButton( "Call"wink;
    end  = new JButton ( "End" );
    keyControls.add ( call );
    keyControls.add ( end );
   
    display.setLayout ( new GridLayout (1, 1));
    textArea = new JTextArea();
    textArea.setEditable ( false );
    textArea.getDocument().addDocumentListener (docuListen);
    textArea.setForeground ( new Color (255, 50 , 10 ));
    textArea.setFont ( new Font ("Dialog", Font.BOLD, 34 ));
    textArea.setLineWrap(true);
                               

    display.add ( textArea );
   
    mainPanel.setLayout( new GridLayout(3, 1) );
    mainPanel.add ( display );
    mainPanel.add ( keyControls );
    mainPanel.add ( keyPads );
   
    call.setActionCommand ( "Call" );
    end.setActionCommand ("End" );
    call.addActionListener (listener);
    end.addActionListener ( listener );

     this.add( mainPanel );

  }//End MobilePhoneApplication Constructor


   private JPanel keyPads (){
       String values[] = {"1", "ABC2", "DEF3",
                          "GHI4", "JKL5", "MNO6",
                          "PQRS7", "TUV8", "WXYZ9",
                          "*", "0+", "#"              };
       JPanel toReturn = new JPanel();
       toReturn.setLayout (new GridLayout(4, 3));
       JButton keys[] = new JButton[values.length];
       
       for ( int index1 = 0; index1 < keys.length; index1++ ){
              keys[index1] = new JButton ( values[index1] );
       }//End for

       for (int index = 0; index < values.length; index++){
              //keys[index].setText( values[index] );
              keys[index].setActionCommand(values[index]);
              keys[index].addActionListener(this.listener);

              toReturn.add(keys[index]);
        }//End for
       
         return toReturn;
                 
  }//End keyPads method
 
  public JTextArea getTextArea (){
    return textArea;
  }//End getTextArea
 
  public void show(String string ){
    if ( textArea.getText().length() != 9 ){
        textArea.setText( textArea.getText()+string );
    }
  }//End show
 
  public void defaultMenu ( boolean set){

        call.setEnabled ( set );
        end.setEnabled ( set );
  }//End defaultMenu
 
  //Test if the TextArea has any test
  public boolean hasChar(){
    jDocument = textArea.getDocument();
    return ( jDocument.getLength() != 0 );
  }//End hasChar
 
  public void clear (){
    String text = textArea.getText();
    text = null;
    textArea.setText (text );
  }//End clear
}//End MobilePhoneApplication




I am continually updating this code
[/size]
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 12:38am On Jul 12, 2008
[size=1pt]

With a bit of luck, we are trying to model something like this. I hope people contribute their own ideas.

I am not going to comment the above code too heavily so you can figure out what is happening. 

Warning
The code might be full of Bugs, debug as you can to get it working. Don't post comments back here that you cannot debug
[/size]
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 1:42pm On Jul 12, 2008
I HAVE DONE AS YOU SAID, I HAVE POSTED THE MODIFICATION FROM THE PREVIOUS PAGE. But I didn't have time to compile them.


@sbucareer
I wrote the program and made the neccessary corrections to make the code compile. I will like to paste it here to save others from having to debug it. Hope you don't mind.


CODE

Class - MobilePhoneApplication


package Phone;

import javax.swing.UIManager;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.text.*;

public class MobilePhoneApplication extends JPanel{

private JPanel mainPanel;
private JPanel display;
private JPanel keyPads;
private JPanel keyControls;

private JTextArea textArea;

private JButton call;
private JButton end;

private ActionListener listener;
private DocumentListener docuListen;
private Document jDocument;


public MobilePhoneApplication (ActionListener listener, DocumentListener docuListen){

try{
UIManager.setLookAndFeel
( UIManager.getSystemLookAndFeelClassName() );
}catch(Exception e ){
}//End try
this.listener = listener;
this.docuListen = docuListen;

mainPanel = new JPanel();
display = new JPanel();
keyPads = keyPads();
keyControls = new JPanel();

keyControls.setLayout ( new FlowLayout( ) );

call = new JButton( "Call"wink;
end = new JButton ( "End" );
keyControls.add ( call );
keyControls.add ( end );

display.setLayout ( new GridLayout (1, 1));
textArea = new JTextArea();
textArea.setEditable ( false );
textArea.getDocument().addDocumentListener (docuListen);
textArea.setForeground ( new Color (255, 50 , 10 ));
textArea.setFont ( new Font ("Dialog", Font.BOLD, 34 ));
textArea.setLineWrap(true);


display.add ( textArea );

mainPanel.setLayout( new GridLayout(3, 1) );
mainPanel.add ( display );
mainPanel.add ( keyControls );
mainPanel.add ( keyPads );

call.setActionCommand ( "Call" );
end.setActionCommand ("End" );
call.addActionListener (listener);
end.addActionListener ( listener );

this.add( mainPanel );

}//End MobilePhoneApplication Constructor


private JPanel keyPads (){
String values[] = {"1", "ABC2", "DEF3",
"GHI4", "JKL5", "MNO6",
"PQRS7", "TUV8", "WXYZ9",
"*", "0+", "#" };
JPanel toReturn = new JPanel();
toReturn.setLayout (new GridLayout(4, 3));
JButton keys[] = new JButton[values.length];

for ( int index1 = 0; index1 < keys.length; index1++ ){
keys[index1] = new JButton ( values[index1] );
}//End for

for (int index = 0; index < values.length; index++){
//keys[index].setText( values[index] );
keys[index].setActionCommand(values[index]);
keys[index].addActionListener(this.listener);

toReturn.add(keys[index]);
}//End for

return toReturn;

}//End keyPads method

public JTextArea getTextArea (){
return textArea;
}//End getTextArea

public void show(String string ){
if ( textArea.getText().length() != 9 ){
textArea.setText( textArea.getText()+string );
}
}//End show

public void defaultMenu ( boolean set){

call.setEnabled ( set );
end.setEnabled ( set );
}//End defaultMenu

//Test if the TextArea has any test
public boolean hasChar(){
jDocument = textArea.getDocument();
return ( jDocument.getLength() != 0 );
}//End hasChar

public void clear (){
String text = textArea.getText();
text = null;
textArea.setText (text );
}//End clear
}//End MobilePhoneApplication




Class - MobilePhoneApplication

[color=#000099]
package Phone;

import javax.swing.UIManager;
import java.awt.event.*;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.event.*;

public class MobilePhoneApplicationGUI extends JApplet
implements ActionListener, DocumentListener{

private MobilePhoneApplication mobile;

public MobilePhoneApplicationGUI(){

mobile = new MobilePhoneApplication(this, this);
mobile.defaultMenu(false);
this.init();
}//End MobilePhoneApplicationGUI

public void init(){

this.getContentPane().add(mobile);
}//End init

public void actionPerformed (ActionEvent event ){

String source = event.getActionCommand();

if( source.equals ( "Call" )){
mobile.clear();
mobile.show("Calling, "wink;
}else if (source.equals ( "End" )){
mobile.clear();
mobile.defaultMenu(false);
}else if ( source.equals ( "1" )){
mobile.show("1"wink;

}else if ( source.equals ( "ABC2" )){

mobile.show("A"wink;
}else if ( source.equals ( "DEF3" )){

}else if ( source.equals ( "GHI4" ) ){
mobile.show("G"wink;

}else if ( source.equals ( "JKL5" ) ){
mobile.show("J"wink;

}else if ( source.equals ( "MNO6" )){
mobile.show("M"wink;

}else if ( source.equals ( "PQRS7"wink ){
mobile.show("P"wink;

}else if (source.equals ("TUV8"wink){
mobile.show("T"wink;

}else if ( source.equals ( "WXYZ9"wink){
mobile.show("W"wink;

}else if (source.equals ("*" )){
mobile.show("*"wink;

}else if ( source.equals ("0+" )){
mobile.show("0"wink;

}else if (source.equals ( "#"wink){

}else{

}//End if

}//End actionPerformed

public void changedUpdate (DocumentEvent e ){
}//End changedUpdate

public void insertUpdate (DocumentEvent e){
if ( mobile.hasChar() )
mobile.defaultMenu(true);

}//End insertUpdate

public void removeUpdate (DocumentEvent e ){
}//End removeUpdate

public static void main (String args[]){

JFrame frame = new JFrame("Mobile Phone"wink;
MobilePhoneApplicationGUI demo = new MobilePhoneApplicationGUI();

frame.getContentPane().add (demo);
frame.setSize(230, 600);
frame.setLocation(550, 100);
frame.setResizable(false);
frame.setVisible(true);
frame.pack();
frame.show();

/*frame.addActionListener(new ActionListener (){
public void actionPerformed (ActionEvent e ){
System.exit(0);
}});
*/
frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
}//End main

}//End MobilePhoneApplicationGUI


Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by javaprince(m): 1:50pm On Jul 12, 2008
Now for Now, the code actually does not display anything. Be waiting for your update, But meanwhile Can't we use Visual IDEs to design our Interfaces?
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sayhi2ay(m): 1:58pm On Jul 12, 2008
is variable declaration not automatically private ? why do we need to put private in front ?
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 2:42pm On Jul 12, 2008

sayhi2ay

They are by default public identifier, try it yourself. Write a class in a pacakge and another class in a different package and create a TestCase class and try to access the attributes of each identifier without private clause.

Another reason is to make sure that JVM during the runtime encapsulation associate an attribute with its appropriate identifier.
Tell us your answer.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sayhi2ay(m): 2:46pm On Jul 12, 2008
a testcase class also in a different package ?
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 2:47pm On Jul 12, 2008

Yes. TestCase in a different package.
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sayhi2ay(m): 2:51pm On Jul 12, 2008
automatically private!, try it yourself,
Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 2:56pm On Jul 12, 2008


In the MobilePhoneApplicationGUI class we have a method called actionPerformed(ActionEvent event) This is because any class that implements an interface promises to implement it supplied method.

In our case, we implemented ActionListener class. Its supplied a method called actionPerformed (ActionEvent e), so we must implement it ourselfs. for help consult Java API

This message is for our method in the MobilePhoneApplicationGUI. So you can copy the method and paste it over the one above.

public void actionPerformed (ActionEvent e){

}//End actionPerformed

Re: Java Server Pages (jsp) Or Java Server Face(jsf Which Path To Trend? ? ? ? by sbucareer(f): 2:59pm On Jul 12, 2008

sayhi2ay

Ok, you have learned that yeah, and certain that a variable declared without an identifier is automatically declared private by the JVM. Thank you sayhi2ay for that info.

But remember, it is recommended to physical write and identifier to a variable to guarantee that its behaviour will remain consistant to the written program.

(1) (2) (Reply)

Vb.net Crystal Report & Dataset / [Help Request ] I Want To Learn Programming, what are the requirements / Any Software Product From "nairaland Programmers"?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 98
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.