ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

General WDSC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • General WDSC

    Well, I got 7.0 installed correctly. I was going through Joe Pluta's Book called WDSC Step>by>Step. This seems to do well showing me how to make his example, but after going through the first 2/3rds of it twice now, I don't think I'm getting a good understanding of what I'm actually doing. I have been advised to use servlets and JSPs to access datafiles on the 400 and display them in a web browser. Are there any resources that give me the intuition about this process? Or, do I just need to fool with the software until I find my footing?

  • #2
    Re: General WDSC

    I don't have the tutorial done yet, but I can give you some java classes to play with if you would like. Then you can ask me specific questions.... I'll give you the basic connection class and the ResultSet class and a brief example of calling them from a servlet. How does this sound?
    Your future President
    Bryce

    ---------------------------------------------
    http://www.bravobryce.com

    Comment


    • #3
      Re: General WDSC

      Sounds good. Thanks Bryce!

      Comment


      • #4
        Re: General WDSC

        I had to change them all to .txt files. You'll have to change the extensions to .java since jamie doesn't allow the uploading of java classes

        This is the Database Connection Class
        ConnDB.txt

        This is the ResultSet Class
        RS.txt

        This is the Servlet that calls them and handles the ResultSet returned from the ResultSet Class
        servletConnDBandRS.txt



        Look over these and see if you can make sense of it. Let me know if you have any questions.

        The next part is for me to add to the Servlet so that you can see how to put the ResutlSet into an ArrayList of Beans that is saved to the session. And then finally will be the JSP that displays it.

        Get at me with any questions.
        Your future President
        Bryce

        ---------------------------------------------
        http://www.bravobryce.com

        Comment


        • #5
          Re: General WDSC

          If you could post back any questions that you solved on your own just so I have a better idea what to cover in the tutorial that would be great. Maybe just some outside things you looked up that gave you some problems or some realizations you had during the process.

          Thanks
          Your future President
          Bryce

          ---------------------------------------------
          http://www.bravobryce.com

          Comment


          • #6
            Re: General WDSC

            Honestly, I haven't looked at them yet. I've been scanning back through Pluta's book to try to get a better understanding of what's going on. I've also been reading about JSPs, servlets, and beans. As far as I can tell, servlets are compiled JSPs. Beans are the resultsets that is returned from the query. JSPs are made using html, right? It looks to me as though JSPs get the information which passes it to the servlet when compiled. The servlet then accesses the data and performs the query, and the beans are the results that are returned. If this is correct, then I think I have a very basic understanding of the structure of the process. Where I am clueless is how to write something usind WDSC that follows this structure. As far as what to cover in the tutorial, assume that I am an idiot (this will be a correct assumption). If you could put things in the context of how each action/step/whatever is exists in the structure (i.e. what job it is performing).

            Comment


            • #7
              Re: General WDSC

              You are a little backwards in your understanding of the process. A JSP is compiled into a servlet at runtime by the application server. A servlet(by definition) is a java class that extends the HTTPServlet class. It should have a post and a get method. These methods will handle a request (in your case from the jsp) and return a response (either by redirecting to another jsp or returning xml, JSON, or some other text back to the requesting JSP via AJAX).

              JSP's are basically HTML markup. That is their basic structure. But they are much more powerful than just that. They can contain custom tags, JSTL tags, and harness the EL(Expression Language). When your servlet connects to the DB and makes a query against it using SQL you will hold the results in a ResultSet first. Then you will have to loop through the ResultSet and put the data into the proper parts of your Bean. In the end the Bean will hold the data. You can then save the Bean to the browser session and access on following JSP's to dynamically create their content.

              I will hopefully be able to get the tutorial mostly done this weekend. I will put references into it about doing this stuff in WDSC. Right now I'm using 6.0. I will be upgrading to 7.0 in a few days when the CDs get here. At that time I will look into doing a top to bottom "Getting Started with WDSC, JSP, Servlets, and Beans" tutorial.
              Your future President
              Bryce

              ---------------------------------------------
              http://www.bravobryce.com

              Comment


              • #8
                Re: General WDSC

                I'm not very clear on the bean's role other than the fact that it holds the data. I don't understand what saving it to the browser session means. Thanks again for all your help.

                Comment


                • #9
                  Re: General WDSC

                  Well your browser has 3 types of scope, and there are resources that explain this better than I can, but its pretty simple. You have page scope which means you can only see variables that are at the page level (request/response type stuff). Secondly you have session scope which means you can see variables saved to the user's browser session. Each time you start a browser you start a browser session. If you save to the session scope then any page accessed from that browser during that session can see your variables. Lastly there is Application Scope. This allows you to see variables outside of the browser. I'm pretty sure this is like session scope but controlled by the server. I've never used application scope, I think its more for enterprise applications rather than some add-on web apps. If you save things to your session then you can see them from page to page without having to regenerate the data each time a different page wants it.

                  Do some searching around for better explanations. But this will give you a start.
                  Your future President
                  Bryce

                  ---------------------------------------------
                  http://www.bravobryce.com

                  Comment


                  • #10
                    Re: General WDSC

                    Will a proxy servlet play a role in this? If so, what is its job?

                    Comment


                    • #11
                      Re: General WDSC

                      I am unfamiliar with proxy servlet. Let me look it up and I'll see if I can get an idea...
                      Your future President
                      Bryce

                      ---------------------------------------------
                      http://www.bravobryce.com

                      Comment


                      • #12
                        Re: General WDSC

                        Ok...here is what a proxy servlet is for....

                        You have two boxes the box that your web app originated from and another box, possibly with another web app. Instead of moving that web app over to your box you just want to call it right off the other box. Well most times browsers are set up so that you can't just make calls using XMLhttprequest to a server which your application did not originate. If a browser was allowed to do that then imagine all the third party crap that would try to connect out via your browser. This call still be accomplished in certain cases, but you are protected from most of it.

                        The proxy servelet acts as a go between. You call the proxy servlet and it calls the other application on the other server, then that data is return to the proxy that returns data to your browser. Unless you have web apps running on two different servers or have data stored on two different servers you shouldn't need to worry about this. Even so, there are ways around having to use the proxy servelet if you are just calling another DB for data.

                        I hope this helps you a little bit.
                        Your future President
                        Bryce

                        ---------------------------------------------
                        http://www.bravobryce.com

                        Comment


                        • #13
                          Re: General WDSC

                          Since I probably won't be using proxy servlets, I'll put them aside for now. I just wondered because Pluta talks about them in his book. Bryce, have you read any books on WDSC, or has your knowledge just come from working with it? How long have you been using it?

                          Comment


                          • #14
                            Re: General WDSC

                            All my knowledge of WDSC is experience. I haven't read any books about it. I will have been using it for a year in February. I plan to document everything I do in WDSC 7.0 so that I can better write tutorials that incorporate WDSC features. And when I get my linux development box done at home I'll document that too. I have yet to look at Pluta's book. Is it free?
                            Your future President
                            Bryce

                            ---------------------------------------------
                            http://www.bravobryce.com

                            Comment


                            • #15
                              Re: General WDSC

                              No. I'm pretty sure it's not free. The company had it when I got here, but I'm pretty sure they purchased it. The marked price is $75. It basically a 530 page extremely detailed tutorial. It's so detailed that he explains the process of lassoing three objects in four steps. In the end, it looks like you have a web app that contains a jsp page, some beans, uses a css template, a proxy server, and a servlet. I'm not sure yet whether the example accesses any data. For you, it's probably not worth the $75. More than likely, you know most of what's in here. However, for a beginner like me, it has lessened the amount of intimidation that I feel.

                              Two more questions for you:
                              Is a bean a java class?
                              Concerning the three examples that you gave above, how does the bean come into play after the servlet has the resultset?

                              Comment

                              Working...
                              X