• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Banner

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
}
}
}
}
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
nitin sharma
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somebody please come up with something.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic