Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

refresh question  RSS feed

 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Normally to refresh a page to another URL uses the line below.
response.setHeader("Refresh", "2; URL=mypage.jsp");

I want to know if it is possible to substitute the url as a variable. Example:
String var="mypage.jsp";
response.setHeader("Refresh", "2; URL="+var);
 
Vijayendra V Rao
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you use ?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A redirect will not introduce a delay.

lin, why not just try it and see?
 
michael yue
Ranch Hand
Posts: 204
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It didn't work. I think maybe its because of the " " . Both the number of seconds and url must be in it I think. any possible way to overcome this? Or another way to perform refresh? Thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65826
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether you pass in a string literal or a string created 'on the fly' is immaterial. This is basic java debugging. How can you check the string to make sure that it is formatted correctly before passing it?
 
Shankar Narayana
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!