Add Rotator App(AdvertisementRotator):
1.)Add should come as graphical hyper link
2.)Add should come randomly
3.)Add should be changed at regular intervals
4.)Follow mvc1 architecture (jsp with java class /java bean)
AddRotatorApp
- |-->java resources
- |-->src
- |-->xyz.bean
- |-->Rotator.java
- |-->webcontent
- |-->addrotator.jsp
- |-->1.png, 2.png, 3.png, 4.png, 5.png
- |-->WEB-INF
- |-->web.xml
Rotator.java
- package xyz.bean;
- import java.util.Random;
- public class Rotator {
- int addNo;
- private String images[] = { "1.png", "2.png", "3.png", "4.png", "5.png" };
- private String links[] = { "http://www.raymond.in", "http://onlyvimal.co.in", "https://www.peterengland.com",
- "http://www.siyaram.com", "https://www.ramrajcotton.in" };
- public void nextAdd() {
- Random rad = null;
- rad = new Random();
- addNo = rad.nextInt(5);
- }
- public String getImage() {
- return images[addNo];
- }
- public String getLink() {
- return links[addNo];
- }
- }//class
addrotator.jsp
- <!-- Create or locate Java Bean -->
- <jsp:useBean id="rotator" class="xyz.Rotator" scope="session"/>
- <% rotator.nextAdd();
- response.addHeader("refresh","2");
- %>
- //Display Add as Graphical hyperlink
- <a href="<jsp:getProperty name="rotator" property="link"/>">
- <img src="<jsp:getProperty name="rotator" property="image"/>" width="500" height="200">
- </a>
web.xml
- <?xml version="1.0" encoding="UTF-8"?>
- <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
- <display-name>AdvertisementRotator</display-name>
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- <welcome-file>index.htm</welcome-file>
- <welcome-file>index.jsp</welcome-file>
- <welcome-file>default.html</welcome-file>
- <welcome-file>default.html</welcome-file>
- <welcome-file>default.jsp</welcome-file>
- </welcome-file-list>
- </web-app>
thanks bro..but from which blog we can find source code??
ReplyDeleteHey hi Pradip.. , We have Nataraz sir code which we was collected from his website(http://www.nataraz.in/software/). Due to some works we didn't focused on codes but we'll add all examples codes in future, but for sake of you we'll post AdvertisementRotator example within 20min..
DeleteThanks..!
This comment has been removed by the author.
ReplyDelete