Posts

How to check leap year using java and C#

Image
Hi there, it's quite complicated to check using the if-else statement the year is a leap year or not. Today I will show the example of how to check if the year is a leap year or not. Leap Year A Normal day for a year is 365 days Leap year have 366 days (29 days in February) How to know if the year is a leap year A leap year can be any year that can be divided by 4 without any balance. WHY leap year occur This is because according to research, The earth rotates about 365.242375 but in one year only have 365 days. So something has to be done to handle the remaining 0.242375 balance. that is why the leap year occurs only once in 4 years. The example is pretty easy to follow. The Java Application package leapyear; import java.util.Scanner; public class LeapYear {         public static void main(String[] args) {         String Cont = "Y";         Scanner input = new Scanner(System.in);  ...

Multiple button in one form JSP - Servlet

Image
Hi there, today I will show one simple tutorial to show which button is clicked in one form. The idea after I read this post on the forum how to find which button is clicked Note : In this tutorial i will use this library :- JSTL 1.1 Here is the example The JSP File <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>Multiple Buttom In Form</title>     </head>     <body>         <h1>Multiple Button In Form</h1>         ${message}         <br/>         <form action="...

How to upload file using JSP and Servlet

Image
In this tutorial, I will like to share how to upload file on JSP page and servlet. Note: Please add JSTL1.1 library and Apache Common FileUpload *JSTL 1.1 library is in global libraries. (I'm using Netbean 7.3.1) JSP file <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>JSP Upload page - servlet</title>     </head>     <body>         <h1>Upload file JSP!</h1>         ${uploadMessage}         <br/>         <form action="<c:url value="/uploadservlet" />" method=...

How to read XML file in Java - JSP

Hi there, this is my first post and first tutorial. So I will like to show how to read XML file using JSP. There are many ways how to read XML files. But I will show you how to read XML file using DOM XML Parser. DOM will parser the entire XML document and load it into memory. Since DOM will load XML document into memory, it will cost performance of the system if the xml document contains lot of data. Please consider SAX parser as solution if you have lot of data in xml document. XML file example this will be an example of XML document. <?xml version="1.0" encoding="UTF-8"?> <domparsersys>        <web-page id="001">         <page-name>index.jsp</page-name>         <roles>*</roles>     </web-page>       <web-page id="002">     <page-name>usermanager.jsp</page-name> ...

Tips for creating an interesting blog.

Image
How to attract visitors to your blog? The answer does marketing. No one will visit your blog if you do not do the promotion activity. Maybe some of you already did what I will discuss later without you realizing it. The important factor of a successful blog is to have high visitors traffic to the site. There is no meaning if your blog is so beautiful or the contents are good without any visitors to your blog. Try to get high traffic to your blog at least 1000 - 10,000 visitors every month is good enough. The more visitors to your blog, the more successful your blog. Good and latest content. Good content will attract visitors to always waiting for a new post from your blog. Every time they start browsing, they will always visit your blog just to know any update from your blog content. Maybe they will bookmark your blog so that they will always remember the URL of your blog. You can also attract people to join the discussion with your post by allowing them to leave a comment on your post...

Tips to get an Idea for blogging.

Image
What will you write in your blog.? This is a common question and also a common problem when someone wants to start writing on their blog. This is also my problem. :-D This is the list of application that will help you to get an idea to start writing in your blog, I'm not an expert, but just want to share the information with all of you. Youtube ( http://www.youtube.com ) Google Trends ( http://www.google.com/trends ) AOL Hot Searches ( http://hotsearch.aol.co.uk/ ) Google Keyword Tool( http://www.googlekeywordtool.com/) These are some applications that you will use to help you to get an idea to start blogging. Youtube Youtube is a popular website for sharing a video on the internet right now. It is the top 3 website that always has high visitors in the world. This is the keyword, top website have a top story/video that will give you the idea, to start brainstorming your mind about what is the most popular video that people watched. What you need to do is to browse the Most Popular ...

[Fix]Asynchronous operations are not allowed in this context

Asynchronous operations are not allowed in this context. Page starting an asynchronous operation has to have  the Async attribute set to true and an asynchronous operation can only be started on a page prior to PreRenderComplete event. The error above occurs when you try to call the method on web service asynchronously. The solution is to add Async equal to true in your .aspx page. <%@ Page Title="" Language="C#" MasterPageFile="~/Application/Site1.Master"  AutoEventWireup="true" Async="true"    %> The above solution will solve the error throw.