Sunday, January 16, 2011

Jsp and Jquery

<jsp:useBean class="java.lang.String" id="submitURL" scope="request" />
<jsp:useBean class="java.lang.String" id="mdn" scope="request" />
<jsp:useBean class="java.lang.String" id="status" scope="request" />
<jsp:useBean class="java.lang.String" id="customerInfo" scope="request" />
<%@ page import="java.net.*" %>
<%@ include file="/html/common/init.jsp"%>
<%@ page import="com.liferay.portal.util.PortalUtil"%>

<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<portlet:defineObjects />
<div id="login_area">
<form method="post" action="http://xwy.8080/web/mts">
<input type="hidden" id="hurl" name="hurl" value=""> 
<input type="hidden" id="himage" name="himage" value=""> 
<input type="hidden" id="hproduct" name="hproduct" value=""> 
<input type="hidden" id="harticle" name="harticle" value=""> 
<input type="hidden" id="hmake" name="hmake" value=""> 
<input type="hidden" id="hmodel" name="hmodel" value="">
<div id="choose_device">
<div class="entry_text"><em>Please choose the enrolled
device.<img alt="" class="tooltip_trigger"
    src="/image/image_gallery?uuid=61620eee-a27f-4c11-b6b3-0e09c6fbc7d8&amp;groupId=161423&amp;t=1283204049507"
    style="width: 18px; height: 18px;" /></em>
<div class="tooltip"><em>For help determining the
manufacturer and model, please visit <a

</div>
<select id="aui-3-1-1-194">
        <option value="">---Please Select---</option>
        <option value="Acer">Acer</option>
        <option value="Apple">Apple</option>
        <option value="AT&T">AT&T</option>
        <option value="Dell">Dell</option>
        <option value="HTC">HTC</option>
        <option value="LG">LG</option>
        <option value="Motorola">Motorola</option>
        <option value="Nokia">Nokia</option>
        <option value="Palm">Palm</option>
        <option value="Pantech">Pantech</option>
        <option value="RIM">RIM</option>
        <option value="Samsung">Samsung</option>
        <option value="Sharp">Sharp</option>
        <option value="SEMC">Sony Ericsson</option>
</select> <select id="aui-3-1-1-199">

</select> <input class="go_btn" id="device_go" type="submit" value="" />
</div>
<script type="text/javascript">
    jQuery(document).ready(function() {
        
        function arrwalk(e) {
            for (var i=0;i<e.length;i++) {
                jQuery('#aui-3-1-1-199').append(
                    jQuery('<option></option>').val(e[i]).html(e[i])
                );
            }
        }
    
        var acer = ['--Please Select--','JV10'];
        var apple = ['--Please Select--','iPhone 4'];
        var dell = ['--Please Select--','Aero','Samos'];
        var htc = ['--Please Select--','Aria (A636)','Tilt 2'];
        var lg = ['--Please Select--','GU 295','Vu Plus (GR70)'];
        var motorola = ['--Please Select--','Backflip (MB300)','Tundra (VA76r)'];
        var nokia = ['--Please Select--','2330','2720','6350'];
        var palm = ['--Please Select--','Pixi Plus','Pre Plus'];
        var pantech = ['--Please Select--','Breeze II (P2000)','Ease (P2020)','Impact (P7000)','Link (P7040)','Pursuit (P9020)'];
        var rim = ['--Please Select--','Curve 8520','Curve 8900','Bold 9700','Torch 9800'];
        var samsung = ['--Please Select--','a777','Captivate (i897)','Flight (A797)','Jack','Mythic (A897)','Eternity II','Rugby II (a847)','Solstice (A887)','Strive (A687)'];
        var sharp = ['--Pease Select--','FX (STX-2)','FX'];
        var att = ['--Please Select--','USB Sierra Lightning'];
    var sony = ['--Please Select--','SEMC Xperia X10'];
    
        jQuery('#aui-3-1-1-194').change(function() {
            jQuery('#aui-3-1-1-199').empty();
            var manvalue = jQuery('#aui-3-1-1-194 :selected').text();
            switch (manvalue) {
                case "Acer":
                    arrwalk(acer);
                    break;
                case "Apple":
                    arrwalk(apple);
                    break;
                case "AT&T":
                    arrwalk(att);
                    break;
                case "Dell":
                    arrwalk(dell);
                    break;
                case "HTC":
                    arrwalk(htc);
                    break;
                case "LG":
                    arrwalk(lg);
                    break;
                case "Motorola":
                    arrwalk(motorola);
                    break;
                case "Nokia":
                    arrwalk(nokia);
                    break;
                case "Palm":
                    arrwalk(palm);
                    break;
                case "Pantech":
                    arrwalk(pantech);
                    break;
                case "RIM":
                    arrwalk(rim);
                    break;
                case "Samsung":
                    arrwalk(samsung);
                    break;
                case "Sharp":
                    arrwalk(sharp);
                    break;
                case "SEMC":
                    arrwalk(sony);
                    break;
            }
        });
        jQuery('#aui-3-1-1-199').change(function() {
            var phone = jQuery('#aui-3-1-1-194 :selected').text() + jQuery('#aui-3-1-1-199 :selected').text();
            var prodId="";
            var phoneUrl="";
            var articleId="";
            var phoneImage="";
            
             switch(phone) { 
             case "DellAero": 
                
             case "AcerJV10": 
                     prodId = "89,262,264"; 
                     phoneUrl = "bls"; 
                     phoneImage = "acer_jv10.jpg"; 
                     break; 
             default: 
                     articleId = "6579"; 
                     phoneUrl = "bla"; 
                     phoneImage = "default.jpg"; 
                     break; 
             
                }
                jQuery('#hurl').val(phoneUrl);
                jQuery('#himage').val(phoneImage);
                jQuery('#hproduct').val(prodId);
                jQuery('#harticle').val(articleId);
                jQuery('#hmake').val(jQuery('#aui-3-1-1-194 :selected').text()); 
                jQuery('#hmodel').val(jQuery('#aui-3-1-1-199 :selected').text());
                
        });
    });
    
</script>

</form>
</div>

Batch

set JAVA_HOME=.\java\64_jdk1.6.0_06

echo off

net use M: /d
net use M: \\WTPCPAPGT303\GPORT

set PROD_OSAGENT_PORT=14074
set QA_OSAGENT_PORT=14006

set OSAGENT_PORT=%QA_OSAGENT_PORT%
set OSAGENT_ADDR=WTPCPAPGT302
set VBROKER_ADM=.\out

set CLASSPATH=patch;lib\sysprop;
for %%i in ("lib\activeMq\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\beans\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\common\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\concurrent\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\corba\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\db\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\groovy\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jaas\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jasperreport\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jaxp1_0-ea1\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jce\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jdist\*.zip") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jgl\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\jsse\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\lmoms\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\logging\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\mail\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\misc\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\oromatcher\*.jar" "lib\oromatcher\*.zip") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\quickfix\*.jar") do call "bin\gpro\cpappend.bat" %%i
for %%i in ("lib\xml\*.jar") do call "bin\gpro\cpappend.bat" %%i

set JAVA_ARGS=%JAVA_ARGS% -Xms32m -Xmx64m -Xss640k
set JAVA_ARGS=%JAVA_ARGS% -XX:ParallelGCThreads=20
set JAVA_ARGS=%JAVA_ARGS% -XX:+UseConcMarkSweepGC
set JAVA_ARGS=%JAVA_ARGS% -XX:+UseParNewGC
set JAVA_ARGS=%JAVA_ARGS% -XX:SurvivorRatio=8
set JAVA_ARGS=%JAVA_ARGS% -XX:TargetSurvivorRatio=90
set JAVA_ARGS=%JAVA_ARGS% -XX:MaxTenuringThreshold=31
set JAVA_ARGS=%JAVA_ARGS% -XX:+AggressiveOpts
set JAVA_ARGS=%JAVA_ARGS% -XX:+UseBiasedLocking

set JAVA_ARGS=%JAVA_ARGS% -Dcom.sun.management.jmxremote
set JAVA_ARGS=%JAVA_ARGS% -Dcom.sun.management.jmxremote.ssl=false
set JAVA_ARGS=%JAVA_ARGS% -Dcom.sun.management.jmxremote.ssl.need.client.auth=false
set JAVA_ARGS=%JAVA_ARGS% -Dcom.sun.management.jmxremote.authenticate=false
set JAVA_ARGS=%JAVA_ARGS% -Dsun.rmi.dgc.client.gcInterval=600000
set JAVA_ARGS=%JAVA_ARGS% -Dsun.rmi.dgc.server.gcInterval=600000


set JAVA_ARGS=%JAVA_ARGS% -DORBagentAddr=%OSAGENT_ADDR%
set JAVA_ARGS=%JAVA_ARGS% -DORBagentPort=%OSAGENT_PORT%
set JAVA_ARGS=%JAVA_ARGS% -DORBsyncGC=false
set JAVA_ARGS=%JAVA_ARGS% -Dorg.omg.CORBA.ORBClass=com.visigenic.vbroker.orb.ORB
set JAVA_ARGS=%JAVA_ARGS% -Dorg.omg.CORBA.ORBSingletonClass=com.visigenic.vbroker.orb.ORB
set JAVA_ARGS=%JAVA_ARGS% -DglobalNameSpace=GP_
set JAVA_ARGS=%JAVA_ARGS% -DORBservices=CosNaming
set JAVA_ARGS=%JAVA_ARGS% -DSVCnameroot=NamingServiceRoot
set JAVA_ARGS=%JAVA_ARGS% -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
set JAVA_ARGS=%JAVA_ARGS% -DVM_THREAD_BUG=1
set JAVA_ARGS=%JAVA_ARGS% -DinforeachHome=Directory/clsa/gpro/cfg/reports
set JAVA_ARGS=%JAVA_ARGS% -DcreatorReleasesPortfolio=yes
set JAVA_ARGS=%JAVA_ARGS% -DobjectsHome=out/Objects
set JAVA_ARGS=%JAVA_ARGS% -Dgpro.common.base.dir=Directory/CLSA/Gpro/dev/cfg

Ajax Load

Generally this is done by showing/hiding a div or two over the top of your content. You can get a fancy loading gif fromhttp://www.ajaxload.info/ to get you started. Then you'll want to place a DIV on your page:
<div id="loading">

  <p><img src="loading.gif" /> Please Wait</p>

</div>
You'll want this hidden by default, so you'd need to add this CSS:
#loading { display:none; }
You'd also want to setup the display for this too:
#loading { display:none; position:fixed; left:0; top:0; width:100%; height:100%;
           background-image:url("transparentbg.png"); }
The file transparentbg.png would be a 25x25 black PNG set to about 80% opaque. Next you would need a way to show and hide this with jQuery:
function showLoading() {
  $("#loading").show();

}
function hideLoading() {

  $("#loading").hide();
}
Now you can use this when you need to do something like querying an external page for data:
showLoading();
$.post("data.php", {var:"foo"}, function(results){

  $("content").append(results);

  hideLoading();
});