Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use either custom tags or jsp

Status
Not open for further replies.

heeeep72

Programmer
Dec 15, 2004
33
CH
Hi *,

our system (a Tomcat Web-Application using DWR/AJAX for client-server communication) works like this: some JavaBeans are prepared on the server side. In the client side JavaScript there is a method initialiser(), which gets the existing beans, and they are handed over to some drawing function responsible for displaying those beans on the user interface (in rows of data). The beans are travelling in the HTTP request, better say: in the SessionContainer.

Code:
// JavaScript:
function initialiser() {
	(...)
	// AJAX request to get all beans, callback to redrawMyRows()
	MyServerSide.getAllBeans(redrawMyRows);
	(...)
}

function redrawMyRows(beansToDraw) {
	(...)
	clearMyRows();
	addMyRows(beansToDraw);
	(...)
}

function clearMyRows() {
	(...)
	var theBody = document.getElementById('theBody');
	// Remove all children.
	removingAllChildren(theBody);
	(...)
}


Code:
Part of our jsp:

<form id="F" name="F" action="" enctype="multipart/form-data" method="post" onReset="return false">
	<input name="something" value="<%=request.getParameter("somethingelse") %>"/>
	<div id='progress'>Loading...</div>
	<table border="0">
		<thead>
			<tr>
			</tr>
		</thead>
		<tbody id="theBody">
		</tbody>
	</table>
</form>


until now there were not too many JavaBeans in the server, so we did not change this way, but now huge masses of data will be loaded into the users window (many rows at loading of the window), and DWR/AJAX is not good for handling this: too slow, etc. I've been told to use either


-custom tags, or
-solve it with the jsp itself



the form is sending form's info to JavaScript functions with help of the post method, as you can see above. It sends information to JavaScript with the "onReset" attribute.

Could some gurus please give me some ideas, what is the way to solve this with either custom tags, or with the jsp itself.
(certainly you don't need to explain me how to develope custom tags, because I can look after this in some tutorials on the Net). I just need the basic ideas, what could be better of these two solutions, and why, and if I choose one of them: how to start with that...

any help greatly appreciated!
thx ,
heeeep
 
I suppose, that custom tags are good for the same goal, as "normal" tags, which are implemented in prefabricated tag libraries. E.g. for iterating through my beans I can use 'forEach'. It is implemented in the JavaServer Pages Standard Tag Library, short JSTL ( as far as I know. Why should I write my own custom tag then ?? Could someone shed light on this ??

What criterions are there for starting to write your own custom tag ? And if I am sure that you want to write one, how to start that (what should be analyzed, etc) ??

I only miss this starting criterion, and the starting step. (after this I could write my own custom tag, following the instructions of a tutorial or a book - I don't think, that it's such a very hard thing)

Some gurus out there, please :) !!!
Thank you so much in advance!

heeeep
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top