aspose file tools
The moose likes JSP and the fly likes weird code idiom in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "weird code idiom in jsp" Watch "weird code idiom in jsp" New topic
Author

weird code idiom in jsp

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575


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

Joined: Jan 10, 2002
Posts: 56180
    
  13

No reason at all.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

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

Joined: Jan 10, 2002
Posts: 56180
    
  13

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
Marshal

Joined: Mar 22, 2005
Posts: 35238
    
    7
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.


Android appsImageJ pluginsJava web charts
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56180
    
  13

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

Joined: Jan 28, 2008
Posts: 5575

Thanks every one for their valuable input. may be the intention of the author is what Ulf pointed out .
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: weird code idiom in jsp
 
Similar Threads
Checking if browser supports JAVASCRIPT and COOKIES...
Javascript Menu display on mouseover
How to map onclick to another input element
problem with &lt script &gt tag
How to use JSTL varraible in to jsp