Thursday, January 9, 2014

To remove a session attribute/ To expire a session in JSP

Suppose you want to remove a session. Like you are creating a Log-Out page for your website and want the user session to expire , for that you need to follow the given code!

<%
            String res=(String)session.getAttribute("username");
            if(res==null)
            {
                out.println("Please Login First!!");
            }
            if(res!=null)
            {
                session.removeAttribute("username");
                out.println("You have successfully logged out!");
                out.println("To continue ...Please login");
            }
 %>

In this example when the user successfully log-ins we create a session Attribute and put his username in the session!
username=rs.getString("firstName");
//Here we get the name of user from database.
session.setAttribute("username",username);
//Put it in the session 

Wednesday, January 8, 2014

To send a value with hyperlink tag in JSP

To send a value with hyperlink tag follow the given code...

<a href="Product.jsp?value=<%=bookname%>"> <%= bookname %></a>

here to send the value bookname to product page I have written the given code. bookname is a String variable.


or simply

<a href="Product.jsp?value=1">Click here to go to Product page</a>

now on the next page(or Product.jsp page) simply write

String val=request.getParameter("value");

To Insert an image using tag in JSP (in NetBeans IDE)

To insert an image in JSP using <img> tag you need to follow the given steps...

  • First put the "images folder" in  "Web Pages" Folder. Place your images in image Folder.
         Web pages folder stores all your web pages which you have created!
  • Now write the code given below...

String ima=rs.getString("CoverImage");        
     //getting the image name from MySql database.(eg hand.JPG)
String image=request.getContextPath()+"/images/"+ima+"";              
                              //ima is the String var 
<img alt="image" src="<%= image %>" height="100" width="100"/>
//place this anywhere you want to display the image

You can also mention the name of your image directly in place of "ima" object.
String image=request.getContextPath()+"/images/photo.JPG";   

Wednesday, September 11, 2013

Change Your Desktop Wallpaper To a Functional Website!!

Bored of your simple Desktop Wallpaper?? Change it now!



Steps to set a functional website as your Desktop Wallpaper:

1. Right click on your Desktop and choose Properties.
2. Open Desktop tab and click on Customize Desktop.
3. Now in the Desktop Items window open Web Tab.
4. Now click on New.
5. In Location option mention the URL of the website you want to set as Desktop Wallpaper.

4.Now click OK.
You can also choose the My Current Home Page option in Web tab!



Monday, July 29, 2013

A Must Try Notepad Trick

With this notepad trick you can make your Computer Welcome you in its Computerized voice!! Just give it a try..

Follow the given steps

1. Open notepad.
2. Write the following given code.


3. Now replace Username with your name.
4. Save the file as welcome.vbs.
5. Copy this file and navigate it to address given below..(for Win XP)

6. For Win 7/Win 8/Win Vista..
C:\Users\{User-name}\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.
[Note: AppData is a Hidden  Folder]
7. Paste the file.

Now when you restart your computer, it will welcome you in its computerized voice!!

Unblocking a Blocked Website

Some countries, schools, and businesses block websites in order to reduce distractions, conserve bandwidth, or censor content. There are a number of methods to use for bypassing blocked websites. Some are..
Method 1 

1. Open Command Prompt.
2. Type ping websitename.com, where websitename is the name of the website.
3. Now you can see the IP address in square [] brackets. Over here it is [173.194.36.64].


4. Copy this Ip address and type it into the address bar in your browser.

Method 2

1. Go to Google.com
2. In the search box type cache:websitename.com , where websitename is the site name and hit Enter.
Google will take automatically take you to the previously saved version of that website.

Method 3

We can also use proxy servers to visit blocked sites!!The proxy displays the blocked website, and allows you to interact with it. All you have to do is visit a proxy service website. Type the URL of the site you wish to unblock, and press Surf. Now you can browse this website like any other normal website!

How to Find Proxy Websites and Proxy Servers
Just Google search free proxy websites or proxy servers.

How to Setup Proxy Servers using their IP Address
If you want to visit a blocked website using web proxy, you do not need any setup. However to use a proxy server that can only be accessed by using its IP address and port number, you must make some required changes in your browser.

Changes For Google Chrome and Internet Explorer Users

Google Chrome uses the same network settings as Internet Explorer. So, in order to configure Google Chrome to use a proxy server, you have to configure Internet Explorer. You can configure a proxy server in Internet Explorer by following the instructions given below:-
  • Open Internet Explorer.

  •  Go to Tools--> Internet Options.
  • Click on Connections Tab, select LAN Settings.
  • Check on Use a Proxy Server for this Connection.
  • In the Address field, add the IP Address of your Proxy server. In the Port field, enter the Port Number.
  • Click on OK and OK again.

Changes For Mozilla Firefox Users
  • OpenMozilla Firefox.
  • Go to Tools--> Options.
  • Click on Advanced Tab.
  • Click on Network tab.
  • Click on Settings.
  • Encircle Manual Proxy Configuration.
  • Enter the IP Address and Port Number at the appropriate place. In most cases, it will be a HTTP server.  







After finishing configuration you can view blocked sites like normal websites!!

Friday, July 26, 2013

Personalized Log on Wallpaper Without any Software!

Here are the steps to Personalize your Log on Wallpaper
  1. Open Regedit
            A quick way to access Regedit that applies to Windows XP, Vista, and 7 is the following:

  •  Click on Start 
  •  Click on Run.
  •  Type regedit in the dialog box.
  •  Click OK


     2.   Now, to change the LOG ON WALLPAPER follow the given steps...

  •  Navigate to HKEY_USERS\.DEFAULT\Control Panel\Desktop.
  •  In the right hand pane, double click on Wallpaper.
  •  In the Value Data option, enter the full path to your bmp file you want to be your wallpaper. Example: For a file named image.bmp placed in Windows folder, type C:\WINDOWS\image.bmp
  • To tile the image set "TileWallPaper" to 1. 
  •  To Stretch the wallpaper set "WallPaperStyle" to 2 .

       3.  Close the Registry Editor and Restart the PC to apply the changes.


Once the changes are applied, each time you start your PC , you will see the log on wallpaper.
To undo the trick, simply delete the address to your image mentioned in Value Data option.