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