|
just another regularban.info web blog |
| MEMBERS: | The Beginners Guide to PHP
What Is PHP? The full form of PHP is Hypertext PreProcessor and is a server-side scripting language. The PHP code can be combined with regular HTML tags and parsed on the server. The creator of PHP, Rasmus Lerdorf first displayed the language in the form of a Perl script . In 1997 it was adapted by Andi Gutmans and Zeev Suraski to use a C-written compiler. They completely reconstructed the original PHP into the web language that we know and use today. Uses of PHP It is used in the creation of dynamic web pages. Web developers like it because of its fast parsing and flexibility and versatility. PHP is a popular tool for managing a form's data after it is submitted and comes built in with many different interfaces and API's. It has database capability built into the language, the most common database being MySQL. Typically the PHP can connect to any SQL enabled database. The Syntax of PHP is similar in structure to Perl and C where curly braces { } define blocks of code and semi-colons specify the end of a statement PHP is as easy to learn as Perl. It maintains all the traditional loops, if/else, and subroutines that are expected in a programming language. One difference between the two is that the code'?' is embedded in with the HTML; you could however, use a separate file. The PHP code is different from HTML code by use of the opening and closing tags. When it finds a PHP file, it tells the server to scan through for these tags, and execute the code in between them. The server recognizes a PHP enabled file by its extension, .php. These are essentially HTML files with PHP codes in them. Getting Started To start PHP requires a server with PHP installed and a simple ASCII text editor such as Notepad or VI, eMacs, Kate, etc. for a UNIX/Linux machine. What are the problems faced by PHP? It is case sensitive. For example if you name a variable $MyVar, you cannot call it as $myvar or $mYvAr. In case you forget to close your curly brackets, then it helps to indent lines inside the curly braces so that any missing braces can be spotted easily.
Passing Parameters In A Data Table Using JSF
Some working knowledge of J2EE or JSF is assumed for this article. Like some of you I've been frustrated with this technology known as JSF or Java Server Faces. There are several different flavors out there that are built on the shoulders of JSF. For instance Oracle's ADF (Application Development Framework). Oracle ADF Faces Components is a set of over a 100 JSF components that let you build a richer user interface for your Java EE applications. Oracle ADF Faces also includes many of the framework features most needed by JSF developers today. That is great, and in many ways it will make life easier to develop in a JSF environment. Some items you will find available in these "add on" packages have a real benefit. For instance, as of the date of this article, I was very surprised that a File Upload is a feature still not implemented in JSF in respect to using natural jsf tags. There are ways to accomplish this task in JSF but they are not native JSF approaches. The process is a "no brainer" in just about every other framework available today, including asp.net. Another simple task (I thought) was having a data table present the results of a query in an editable format. Possibly to update a user record or shopping cart. After working in other technologies it was very efficient to return a result set to a data table object and let that object take care of some of the trivial behaviors and characteristics of the table itself. When I started exploring JSF I was frequently and at every turn becoming more and more frustrated in trying to duplicate some of the most basic of processes similar to managing records through data tables. There are not a whole lot of resources out there yet on JSF although it is growing steadily, and I found that all too often the resources that I was finding on the internet either didn't apply to the more simple tasks or the information was just completely wrong. One example of that was that it was stated in one article I read that you cannot use command buttons inside of a JSF data table. The recommendation was to use JSF hyperlinks instead when trying to perform an action from a data table due to a bug in the framework that prevented command button actions to fire if the button resided inside of a data table. At first I thought "you've got to be kidding me"! Then I remembered that I've been finding a fair amount of "bogus" information in regards to JSF development so I decided to do further research and discovered that information to be less than accurate as well. I simply had to find a way to populate a data table through a result set and get a command button to fire an action and pass all of the data in the data table to the backing bean to update the record. Multiple command buttons would exist as well as hidden fields pertaining to id numbers and so forth. Pretty basic stuff and we've all done it before with relative ease. It turned out that the solution was in fact a simple one. "Binding". You've heard about it and read about it. But this approach was something a little different as far as I could find. Many of the blogs and articles that I read dealt with passing the values as parameters and following the steps to define the parameters in faces.config files etc., then retrieving the parameters in a backing bean. Processing the passed data required another set of procedures to utilize mapping to each of the field parameters passed and then processing could begin. That seemed like a whole heck of a lot to me just to retrieve form data. Then it occurred to me that I should be able to "bind" a text field component on a page to a backing bean. Once it is bound then all I have to do is extract the data. And that's all there is to it. My query returned results and pre-populated a data table including text fields with the values of the query pre-populated in the text fields. Each one of those text fields was bound to a "HtmlInputText" type in my backing bean. It was not a String type like other approaches define. Doing that does require you to map parameters and populate that String variable through your set methods once the form is submitted. What I found is that if I bind my text field to a property of text field type that it solved my problem of passing values from a data table, and I didn't have to define parameter fields anywhere in any xml file. Now that I had that figured that out I needed to figure out how to get the value of that property that I've bound my form field to, well why not getValue()? I personally hadn't seen any examples online or in books for retrieving the value from a form binding it to the type of form element it was and simply use the getValue() to pull out the value of the object. Used like this getParameterFromForm().getValue(). Let me clarify that I am NOT saying that trying this approach isn't documented anywhere, I find it hard to believe that I've had some stroke of genius that no one has had before in the world of java, especially since I'm coming from .NET and ColdFusion. After doing that I no longer had any problems passing form data to my backing bean. I was able to dynamically populate data tables with any number of records including any number of command buttons within that data table and I didn't have to concern myself with remembering to define parameters in any other areas of the application. So put simply you can bind your form fields to properties of the same type in your backing bean, and then extract the value of that object using getValue() if you prefer over utilizing parameter string mapping and similar approaches for processing form data. I found it to be easier and less time consuming which has costs associated to it as well.
Everyone Is Talking Web 2.0 Development
In layman language Web 2.0 means the second generation of web development. The first generation web development is considered to be the great dot-com bubble of late 90's and the rupture of which around late 2001 triggered ubiquitous reactions that the Web was over hyped. Concept of second generation of Web development started after a media conference between O'Reilly and MediaLive International. In this brainstorming session it was realized that the web has thrown up more interesting applications and Web technology has emerged more important that ever and the word Web 2.0 was coined. Web 2.0 is a business revolution making a bent towards the web as a platform. Web 2.0 doesn't have a definite boundary and there are several things encompassing a core. Web 2.0 is visualized as principles and collection of numerous sites running on those principles at some distance from the core. Since then Web 2.0 has remained a top level discussion for proper definition and boundary that is yet to be reached. One can simply say blogs, social bookmarking, wikis, podcasts, RSS feeds, and lightweight business over a single platform. Web is no more one way, now uploading, and downloading of information happens simultaneously, sharing and distributing contents across networks leveraging the power of "Long Tail". Web 2.o includes numerous practices. Here are some typically implemented practices by websites: • Well-off internet applications based on Flex or Ajax. Content Syndication: Syndicating partial or whole content through standard protocols such as RSS, Atom, and RDF by using XML so as to be used by the end-users for their need. Some misconceptions on Web 2.0: • Curvy designs (This curvy structures became widely popular at the same time, designers also started making more websites with this cool looking styles) Web 2.0 is not an alien to criticism and had its fair share. Here are some criticisms leveled at Web 2.0 • Web 2.0 is not a new version of World Wide Web at all. It merely uses the technologies and architectures of Web 1.0.
|
* About Archives
Categories:
Last Updated: |
| regularban.info
is proudly powered by WordPress MU running
on regularban.info.
Create a new blog and join in the fun! Entries (RSS) and Comments (RSS). |