• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

weird code idiom in jsp

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

interesting.now, I come across this in one of jsp page. why would the author specify the input tag through document.write instead of directly writing it .
is there any reason to do like above?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No reason at all.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I concur.

Everything is hard-coded it seems. The only reason one might use document.write() is to produce dynamic content
based on variables. Maybe at some point the literals were variable ?

now it could also be based on where the fragment is. If at the very end of the rendering of the table it may be
stopping someone clicking the deleteAll before everything is finished being presented.

WP
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William P O'Sullivan wrote:
The only reason one might use document.write() is to produce dynamic content
based on variables.

This may have been true in 1998. Even for such purposes document.write is a dinosaur. There are much better ways to inject dynamic content in the current millennium.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The checkbox will only be shown if JavaScript is enabled - which makes sense, because it's a JavaScript URL that wouldn't work without it.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64718
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are still better ways to do it. document.write is looked at in the JavaScript world with the same level of derision that scriptlets are in JSPs -- perhaps even more so.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks every one for their valuable input. may be the intention of the author is what Ulf pointed out .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic