• 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

How to create scrolling text?

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys,

I would like to create code which will scroll any text message input by user. Any one can help me? Please check my code as follow:

[jspcode]
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Entry Form</h1>
<form name="Name Input Form" action="response.jsp">
Enter Your Name:
<input type="text" name="name" />
<input type="submit" value="OK" />
</form>
</body>
</html>
[/jspcode]

[jspcode]
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<jsp:useBean id="mybean" scope="session" class="org.mypackage.web.MyWeb" />
<jsp:setProperty name="mybean" property="name" />

<!-- HTML codes by Quackit.com -->
<marquee behavior="scroll" direction="left">
<h1>Hello, <jsp:getProperty name="mybean" property="name" />!</h1>
</marquee>

</body>
</html>
[/jspcode]

[javacode]
public class MyWeb {

private String name;

public MyWeb()
{
name=null;
}

/**
* @return the name
*/
public String getName() {
return name;
}

/**
* @param name the name to set
*/
public void setName(String name) throws Exception{
this.name = name;

while(true){
System.out.print("\r"+ name);
Thread.sleep(200);
name = name.substring(1) + name.substring(0,1);
}
}
}
[/javacode]

[javacode]

Thaning You,
Yatin Shah
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic