struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Geppert <jo...@web.de>
Subject Create a single javascript
Date Wed, 12 Aug 2009 12:46:06 GMT

Hello,

maybe anybody can give my some input for an idea I have today.
I work on the current struts2-jquery-plugin.
http://code.google.com/p/struts2-jquery/

At the moment the tags create after each generated html tag 
an separate <script> tag like this:

<div id="mydiv1"></div>
<script type="text/javascript">
$(document).ready(function () { do something with mydiv1; });
</script>
<div id="mydiv2"></div>
<script type="text/javascript">
$(document).ready(function () { do something with mydiv2; });
</script>

This looks a little bit dirty, so I look for a way to collect all the
generate javascript stuff
to one big javascript 

<div id="mydiv1"></div>
<div id="mydiv2"></div>
<script type="text/javascript">
$(document).ready(function () { do something with mydiv1;  do something with
mydiv2; });
</script>

Maybe all the generated javascript can be put on an Stack
and can be rendered with an separate sj:footer tag.

The JSP can look like this:
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head/>
  </head>
  <body>
    <sj:div id="div1"></sj:div>
    <sj:div id="div2"></sj:div>
    <sj:a id="link1" href="%{ajaxurl}" target="result">Link</sj:a>
    <sj:datepicker />
    <sj:footer/>
  </body>
</html>

Is there a way or should I put this idea out of my mind?

Best Regards
Johannes Geppert

-----
---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

-- 
View this message in context: http://www.nabble.com/Create-a-single-javascript-tp24935752p24935752.html
Sent from the Struts - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message