Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • gunnasatria 8:20 am on October 7, 2008 Permalink | Reply
    Tags:   

    Simple JSP Part 4 

    As i promised a long.. long time ago.. 
    i will write an example of using java beans in jsp pages.
    The idea of this scenario is so you as a java web developer not being mixed up between HTML scripts and Java scripts.
    So, if in the previous example we embedded some java instructions in HTML scripts then for this tutorial we will separate both.

    Supposed you have this usual Java class acting as our first created java beans. 
    package pages;

    public class HelloWorld {

    public String getMessage(){
               return “Hello Word”;

    and then you have a regular HTML in a JSP file like below,

    <html>
    <head>
    <title>Simple JSP Part 4</title>
    </head>
    <body>
    </body>
    </html>

    and let’s name it message.jsp

    Now, the idea is to display message from our HelloWorld class to our jsp page. How we will do it?
    Add below java instruction between body tag in our message.jsp

    <%

    pages.HelloWord hw = new pages.HelloWorld();
    out.println(“message is: “+hw.getMessage()); 

    %>

    To putting it all together, below is the full code.

    <html>
    <head>
    <title>Simple JSP Part 4</title>
    </head>
    <body>

    <%

    pages.HelloWord hw = new pages.HelloWorld();
    out.println(“message is: “+hw.getMessage()); 

    %>

    </body>

    </html>

    Then you will see a nice hello word message.
    This is just a tiny example of how usefull java beans will be. The other benefit is if separate our logic into our java class, then we will able to test it first and will not having much difficulties in debuging compared to when we join our java instructions in our jsp pages.
    But.. there is always a backside of this. If you want to update your java class, then you have to restart your web server to get it work.

    So… have a nice try n error.

     
  • gunnasatria 2:12 am on January 7, 2008 Permalink | Reply
    Tags: , ,   

    Simple JSP part 3 

    Now we are trying to connect our web application to a database. I use Northwind database here as an example database.
    For you who don’t know what Northwind is, it is a sample database given if you install MS Access. I am sorry for non Windows user, but if you follow below tutorial you should also do it in another database like MySQL or PostgreSQL.
    (More …)

     
  • gunnasatria 9:09 am on January 5, 2008 Permalink | Reply
    Tags: , ,   

    Simple JSP part 2 

    Our next tutorial is about handling user input. We will start with the most common input component which is text field.
    Open your index.jsp and add new codes like below, (More …)

     
  • gunnasatria 1:32 pm on January 4, 2008 Permalink | Reply
    Tags: , ,   

    Simple JSP part 1 

    This post is dedicated for you who want to start learning how to create a web application using Java using only simple JSP. I assumed here you already have Java basic knowledge. Please enjoy. (More …)

     
    • qyut 5:13 pm on February 2, 2008 Permalink | Reply

      just keep it simple … 🙂

    • mm 6:54 am on April 8, 2008 Permalink | Reply

      currently i use eclipse 3.3 and jetty 6.1 and j2sdk 1.4
      when i clicked the project, no menu build path appear
      in this case, how to link tools.jar

    • mm 7:44 am on April 8, 2008 Permalink | Reply

      i dropped my last project, and create the new project…
      guest what… the menu build path now appear already.

      but… when i run dialog, there is an message appear:
      jetty launcher, unable to build classpath, error getting vmtype

  • gunnasatria 1:07 pm on December 13, 2007 Permalink | Reply  

    Create Virtual Host Name using Apache 

    Suppose you have a web application running on Apache and you want to change the url address of your application to be more friendly like http://www.gunnasatria.com
    All you have to do is to create a virtual host name.

    (More …)

     
    • ojat 2:03 pm on December 13, 2007 Permalink | Reply

      wah wah..ternyata dirimu punya blog jg hehehe, asik, banyak tutorialnya nih.. 😀

    • Pak Soen 11:31 pm on December 13, 2007 Permalink | Reply

      Hebat….rajin menulis di blok. Semoga jerih payahmu mendapatkan imbalan yang pantas, surga disediakan bagi ummatnya yang ikhlas. amin.

  • gunnasatria 1:33 pm on November 19, 2007 Permalink | Reply  

    Hibernate Annotation Tutorial 

    As in my previous post, right now i’m working on a project that use Hibernate annotation. I feel great and really believe that i am making a right choice. So, i want to share my experience using it here. (More …)

     
    • Bob 8:29 pm on August 26, 2008 Permalink | Reply

      Dear Author;

      Am trying to run the Hib/Ann example.
      Having trouble getting the Logger statements to compile.
      What imports do I need for HibernateTest to compile in regard to Logger.

    • The YPI 7:39 am on February 5, 2009 Permalink | Reply

      nice stuff

    • Giri 8:34 pm on June 23, 2011 Permalink | Reply

      I am not expert in Hibernate, just started learning. As per my understanding, it is not good practice to start transaction inside for loop. It is better to have outside the loop.

      Second, If I understand correctly flus() will do force commit, we don’t need to explicit commit when we flush.

      • gunnasatria 9:29 pm on June 23, 2011 Permalink | Reply

        @giri yes you are right. thanks for the correction.
        #it is nice to share 🙂

    • Sunil 7:43 am on October 12, 2011 Permalink | Reply

      nice worthy information for me … thanx

  • gunnasatria 2:19 pm on October 30, 2007 Permalink | Reply  

    What to choose? 

    I am now in the phase of design and analysis of a software project. So i have to choose what should i use in this project.
    For the presentation layer my candidates are Tapestry 3.0.3(because i don’t want to use Tap 5 who is still in alpha), ZeroKode (based from my recent experience) and Webwork (which i use in my last project). (More …)

     
  • gunnasatria 2:14 pm on October 22, 2007 Permalink | Reply  

    (Not) Simple JSF+Spring 

    I don’t know why but suddenly i want to take a look of this framework. So, i search some jsf tutorial and download jsf distribution framework (jsf 1.2) . I create a simple hello world project using my eclipse ide after following instruction from the tutorial i found. try running it using jetty 5 and the result is it didn’t work..
    i found java.lang.NoClassDefFoundError: javax/el/ELResolver error. (More …)

     
    • benbego 3:45 pm on October 28, 2007 Permalink | Reply

      what’s the different between applet with servlet?

    • gunnasatria 1:12 pm on November 19, 2007 Permalink | Reply

      sorry for the very-very late answer.
      the difference is in applet you got a state-full application while in servlet you got state-less application.
      applet is where you create a usual desktop application but you embed it on a web page.
      while servlet is where you create an object in your web server and that object will responsible to response your request.
      i’m sorry this is quite a basic question. you maybe want to try both first and experience to find out the differences are..
      but one thing is for sure, we’re not using applet anymore right now.. if you want to create a responsive application in web world use ajax.

    • cagataycivici 12:31 pm on November 24, 2007 Permalink | Reply

      jsf 1.2 will run on any servlet2.5/jsp2.1 compliant server, that includes tomcat 6 and jetty6

    • gunnasatria 12:51 pm on December 13, 2007 Permalink | Reply

      @cagataycivici
      oo i see.. well i did test it using tomcat 5.
      thanks for your info

    • greuze 8:45 am on January 22, 2008 Permalink | Reply

      JSF run in Tomcat 5 too (I use tomcat 5.23)

    • Qussay Najjar 7:03 am on January 29, 2008 Permalink | Reply

      Thanks so much your solution helped me in running my JSF app just right away…
      thanks once again… I admire it…

  • gunnasatria 7:45 am on October 18, 2007 Permalink | Reply  

    xampp 

    Are you familiar with PHPTriad in windows? Well you can get the same one for linux. Auto install apache,php,mysql and phpmyadmin. But becarefull, must configure phpmyadmin security first.. because it has a blank password in default installation. You can get xampp here.

     
    • semeru2007 3:01 am on October 19, 2007 Permalink | Reply

      For me, the best thing of xampp is that the availability for other Operating System..
      (From their homepage)
      * a version for Linux systems (tested for Ubuntu, SuSE, RedHat, Mandrake and Debian),
      * a version for Windows 98, NT, 2000, 2003, XP and Vista,
      * a beta version for Solaris SPARC (developed and tested under Solaris 8),
      * and a beta version for Mac OS X.

      and also this one: http://addons.xampp.org/ [wonderful !]

    • haikal 8:37 am on October 23, 2007 Permalink | Reply

      have you been visit this one? http://addons.xampp.org/

    • gunnasatria 12:32 pm on October 26, 2007 Permalink | Reply

      sorry Haikal for the late answer, it’s been a busy week. nice site, maybe i’ll try the samba plugin.thanks

  • gunnasatria 7:38 am on October 18, 2007 Permalink | Reply  

    Map Windows from Linux 

    We usually map linux share from windows using samba. Not the other way around. But i learn today that it can be done. We can use Sharity to do that.The configuration is very easy. All you have to do is extract the package on your linux. And run the application. For you who like GUI(like I do), there is one so don’t worry.
    After you run the application, enter your windows share, and your folder in linux file system as the mount destination.
    For the free version we can only mount one share at a time. It’s okay for me though 😀

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel