This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of TensorFlow 2.0 in Action and have Thushan Ganegedara on-line!
See this thread for details.
Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Banner

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
Somebody please come up with something.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic