Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 13th, 2002, 11:08 PM
itsource itsource is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 181 itsource User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 7 m 31 sec
Reputation Power: 7
rotating banner code

I have code from jsp book that use bean. but this code can rotate only image but not has link when click image
Code:
import java.util.Random;
public class BannerBean
{
	private int index,count;
	static private String [] banner_url =
	{
		"image1.gif",
		"image2.gif",
		"image3.gif"
	}
	public Bannerbean()
	{
		count = banner_url.length;
		Random r = new Random();
		index = r.nextInt(count);
	}
	public String getBannerurl()
	{
		return banner_url[nextIndex()];
	}
	private int nextIndex()
	{
		if(++index==count) index=0;
		return index;
	}
}



when use this code in jsp
<img src='<jsp:getProperty name="banner" property="bannerurl"/>'>

I want to edit code that can click each image and go to link. I know only define 2 dimention array
Code:
static private String [][] banner_url =
	{
		{"image1.gif","http://url1.com"},
		{"image2.gif","http://url2.com"},
		{"image3.gif","http://url3.com"}
	}

but I don't know how to continue. Anyone help please?

Reply With Quote
  #2  
Old July 15th, 2002, 09:58 AM
tron's Avatar
tron tron is offline
SwollenMember
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Location: the master control
Posts: 234 tron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 44 m 46 sec
Reputation Power: 9
i am a bit confused on what you are trying to do...do you want the image to be a link?

also...

Quote:
public class BannerBean


is this working for you...

Quote:
public Bannerbean()

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > rotating banner code


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway