Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Servlets and the fly likes Banner Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Banner" Watch "Banner" New topic
Author

Banner

nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
hello everybody,
Can anyone tell me the way to show a banner on which two,three strings comes up in a sequenctial way.What i want is when a use enters a URL in browser a page containig a banner should be shown.As i am new to servlets i do not have much information about all these things.I am listing my code,please do make the changes wherever possible so that server should be able to show a page to the user on his /her request.
import java.io.*;
import javax.servlet.*;
import java.awt.*;
public class serve extends GenericServlet implements Runnable
{
Label l;
String str[]={"nitin","sharma","what","is","going on"};
Thread t;
PrintWriter pw;
public void service(ServletRequest request,ServletResponse response)throws ServletException,IOException
{

response.setContentType("text/HTML");
pw=response.getWriter();
pw.println("<html>");
pw.println("<Title>servelt buletin board</title>");
pw.println("<Body>");
pw.println("<b>hello");
pw.println("<p>");
pw.println("<Input type=text name=lopo value=ok>");
pw.println("</Body>");
pw.println("<html>");
l=new Label();
t=new Thread(this);
t.start();
}
public void run()
{
for(int i=0;i<str.length;i++)
{
try
{
Thread.sleep(2000);
pw.println(l.setText(str[i]));
}
catch(InterruptedException e)
{
System.out.println("kamina");
}
if(i==4)
{
i=0;
}
}
}
}
Mark Simms
Ranch Hand

Joined: Jul 20, 2000
Posts: 36
You've got to force a response somehow.....
best advice ?
Wait till servlet 2.3 specs are completed.....
the new event driven model will help you do this....
and it will be much easier.

Mark
nitin sharma
Ranch Hand

Joined: Feb 24, 2001
Posts: 290
Somebody please come up with something.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Banner