JSP response into a Javascript code

Suppose I have a form that I submit, and its action is set to a JSP page that returns a series of elements <option>, for example:
    <option>2005</option>
    <option>2006</option>
Is it possible to GET that JSP response, inside the JavaScript code?
Or should I better state, inside the JSP code, to return ONLY the numbers and then I get it on the JavaScript and use the .add() funtion to add the item to a <select> ?
How do I save that response inside the JavaScript?
For example, I am trying with this Javascript function that handles the changes on a drop-down list:
  function clickedOnPType(lista)
  document.form1.action = "searchAvailableYears.jsp?pType=" + txtPType;}
  document.form1.submit();
}...And I am getting, in return, a series of <option> with the correct data...
Thanking you in advance,
MMS

Oh hello... in one of my 1000 searches I found that
post days ago and I was already trying with your
code, but I was getting several errors like
"undefined is null or not an object" (in IE),
"xmlhttp.responseXML has no properties" (in
Firefox).... Well one thing i wanted to discuss here is is wat properties does in general a XmlHttpRequest Object contains
checkout the below interface which gives a clear understanding of the Object member properties.
interface XMLHttpRequest {
  attribute EventListener   onreadystatechange;
  readonly attribute unsigned short  readyState;
  void  open(in DOMString method, in DOMString url);
  void  open(in DOMString method, in DOMString url, in boolean async);
  void  open(in DOMString method, in DOMString url, in boolean async, in DOMString user);
  void  open(in DOMString method, in DOMString url, in boolean async, in DOMString user, in DOMString password);
  void  setRequestHeader(in DOMString header, in DOMString value);
  void  send();
  void  send(in DOMString data);
  void  send(in Document data);
  void  abort();
  DOMString  getAllResponseHeaders();
  DOMString  getResponseHeader(in DOMString header);
  readonly attribute DOMString  responseText;
  readonly attribute Document   responseXML;
  readonly attribute unsigned short  status;
  readonly attribute DOMString  statusText;
};therefore as you can see XmlHttpRequest.reponseXML returns a Document Object which has below set of properties.
http://www.w3schools.com/dom/dom_document.asp
http://www.javascriptkit.com/domref/documentproperties.shtml
and as said earlier one can send AJAX response in three ways
1).Plain text(with comma seperated values maybe): Which we can collect using XmlHttpRequest.responseText 2).XML: @ client side XmlHttpRequest.reponseXML create a DOM Object using which one can parse it get values
of attributes and values of different tags and then update the view accordingly.
3).JSON(Javascript Object Notation): It is a bit complicated thing to discuss at this moment
however it uses the first property(Plain text) and then
uses set of libraries to parse and update the view.
checkout below links to understand it
http://www.ibm.com/developerworks/library/j-ajax2/
http://oss.metaparadigm.com/jsonrpc/
>  function handleOnChange(ddl)
>
var ddlIndex = ddl.selectedIndex;
var ddlText = ddl[ddlIndex].text;
var frmSelect = document.forms["form1"];
var frmSelectElem = frmSelect.elements;
if(ddl.name="pType")
     txtYear = "";
txtDay = "";
          txtTime = "";
          unblock(document.form1.year);
          block(document.form1.day);
          block(document.form1.time1);
     laProxLista = frmSelectElem["year"];
if (ddl.options[ddl.selectedIndex].text !=
txtPType = ddl.options[ddl.selectedIndex].text;
else if(ddl.name="year")
     txtDay="";
     txtTime="";
          unblock(document.form1.day);
          block(document.form1.time1);
laProxLista = frmSelectElem["day"];
f (ddl.options[lista.selectedIndex].text != "---")
txtYear = ddl.options[lista.selectedIndex].text;
else if(ddl.name="day")
{          txtTime = "";
          unblock(document.form1.time1);
laProxLista = frmSelectElem["time1"];
(ddl.options[ddl.selectedIndex].text != "---")
txtDay = ddl.options[ddl.selectedIndex].text;
else //time1
laProxLista = null;
if (ddl.options[ddl.selectedIndex].text != "---")
txtTime1 = ddl.options[ddl.selectedIndex].text;
if ( txtPType != "---")
xmlhttp = null
// code for initializing XmlHttpRequest
Object On Browsers like Mozilla, etc.
if (window.XMLHttpRequest){ 
xmlhttp = new XMLHttpRequest()
// code for initializing XmlHttpRequest
Object On Browsers like IE
else if (window.ActiveXObject) { 
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp != null)
if(ddl.name = "pType")
// Setting the JSP/Servlet url to get
XmlData
url = "searchAvailableYears.jsp?pType="
+ txtPType;
               else if(ddl.name = "year")
url = "searchAvailableDOY.jsp?pType=" + txtPType
PType + "&year=" + txtYear;
               else(ddl.name = "day")
url = "searchAvailableTimes.jsp?pType=" +
e=" + txtPType + "&year=" + txtYear + "&day=" +
txtDay;
xmlhttp.onreadystatechange =
handleHttpResponse;
// Open the Request by passing Type of
Request & CGI URL
xmlhttp.open("GET",url,true);
// Sending URL Encoded Data
xmlhttp.send(null);
else{
// Only Broswers like IE 5.0,Mozilla & all other
browser which support XML data Supports AJAX
Technology
// In the Below case it looks as if the
browser is not compatiable
alert("Your browser does not support
XMLHTTP.")
} //else
} //if chosen
//function
     //----------------------------Well as far as i can see i do not have any issues with it because your code looks
preety much involved with your business logic but one thing i would like to reconfim
here is the variable "xmlhttp" a global one.
if no declare xmlhttp variable as a global variable.
<script language="javascript">
var xmlhttp;
function handleOnChange(ddl){
function verifyReadyState(obj){
function handleHttpResponse() {
</script>
> function verifyReadyState(obj)
if(obj.readyState == 4){
if(obj.status == 200){
if(obj.responseXML != null)
return true;
else
return false;
else{
return false;
} else return false;
}I believe,this is preety much it.
> function handleHttpResponse() [/b]
if(verifyReadyState(xmlhttp) == true)
//-----------HERE!! ---- I GET "UNDEFINED" IN THE
DIALOG BOX
//------- BELOW THE CODE LINE....---
var response = xmlhttp.responseXML.responseText;
alert(response);
it is obvious that you would get Undefined here as responseText is not a property of Document Object or to be more specific to the Object what xmlhttp.responseXML returns.
you might have to use that as alert(xmlhttp.responseText);
and coming back to parsing the XML reponse you have got from the server we need to use
var response = xmlhttp.responseXML.documentElement; property for it...
and if you put as a alert message it has to give you an Output like"Object"
alert(response);
if that doesn't the browser version which you are using may not support XML properly.
var response = xmlhttp.responseXML.documentElement;
removeItems(laProxLista);
var x = response.getElementsByTagName("option")
  var val
  var tex
  var newOption
              for(var i = 0;i < x.length; i++){
                 newOption = document.createElement("OPTION")
                 var er
                 // Checking for the tag which holds the value of the Drop-Down combo element
                 val = x.getElementsByTagName("value")
try{
// Assigning the value to a Drop-Down Set Element
newOption.value = val[0].firstChild.data
} catch(er){
// Checking for the tag which holds the Text of the Drop-Down combo element
tex = x[i].getElementsByTagName("text")
try{
// Assigning the Text to a Drop-Down Set Element
newOption.text = tex[0].firstChild.data
} catch(er){
// Adding the Set Element to the Drop-Down
laProxList.add(newOption);
here i'm assuming that i'm sending a xml reponse of format something below.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<drop-down>
   <option>
        <value>1</value>
        <text>label1</text>
   </option>
   <option>
        <value>2</value>
        <text>label2</text>
   </option>
   <option>
        <value>3</value>
        <text>label3</text>
   </option>
</drop-down>and i'm trying to update both option's value and label which would be something like
<select >
<option value="1">label1</option>
<option value="2">label2</option>
<option value="3">label3</option>
<option value="4">label4</option>
</select>else where if you are interested in getting a format like the one below
<select >
<option>label1</option>
<option>label2</option>
<option>label3</option>
<option>label4</option>
</select> try the below snippet
var response = xmlhttp.responseXML.getElementsByTagName("text");
var length = response.length;
var newOption
for(var i =0 ; i < length;i++){
   newOption = this.document.createElement("OPTION");
   newOption.text = response.childNodes[0].nodeValue;
// or newOption.text = response[i].firstChild.data
laProxList.add(newOption);
Another thing...
I have tried to set the content type inside the JSP
to
response.setContentType("text/html");
AND to
response.setContentType("text/xml");
but none of the above is getting me results......use of response.setContentType("text/xml"); is more appropriate here.. as you are outputting XML or a plain text here...
make sure you set the reponse headers in the below fashoin while outputting the results....
response.setContentType("text/xml");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 1);
response.setDateHeader("max-age", 0); and if you are serious about implementing AJAX i would advice you start learn basics of XmlHttpRequest Object and more about DOM parsing is being implemented using javascript.
http://www.w3.org/TR/XMLHttpRequest/#xmlhttprequest0
http://www.jibbering.com/2002/4/httprequest.html
http://java.sun.com/developer/technicalArticles/J2EE/AJAX/
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
http://www.javascriptkit.com/domref/documentproperties.shtml
and then go about trying different means of achieving them using simpler and cool frameworks
like DWR,dojo,Prototype,GWT,Jmaki,Back Base 4 Struts,Back Base 4 JSF....etc and
others frameworks like Tomahawk,Ajax4Jsf,ADF Faces,ICE FACES and many others which work with JSF.
Please Refer
http://swik.net/Java+Ajax?popular
http://getahead.org/blog/joe/2006/09/27/most_popular_java_ajax_frameworks.html
Hope that might help :)
and finally an advice before implementing anything specfic API which may be related to any technologies (JAVA,javascript,VB,C++...) always refer to API documentation first which always gives you an Idea of implementing it.
Implementing bad examples posted by people(even me for that matter) directly doesn't make much sense as that would always lands you in trouble.
and especially when it is more specific to XmlHttpRequest always make habit of refering
specific Browser site to know more about why specific Object or its property it not working 4i
IE 6+: http://msdn2.microsoft.com/en-us/library/ms535874.aspx
MOZILLA: http://developer.mozilla.org/en/docs/XMLHttpRequest
Safari: http://developer.apple.com/internet/webcontent/xmlhttpreq.html
Opera 9+: http://www.opera.com/docs/specs/opera9/xhr/
Hope there are no hard issues on this...
REGARDS,
RaHuL

Similar Messages

  • How to put a jsp variable into a javascript function?

    Please read the following coding. I want to pass the variable ans from jsp to the function check_answer() of javascript. ans is a string got from database. But I cannot put the variable ans into the Javascript function. Can anyone help?
    <script language="Javascript">
    function check_answer() {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer()'>");
    %>

    The following should be able to pass ans.
    <script language="Javascript">
    function check_answer(ans) {
    if (testing.result.value==ans ){
    window.alert("You have got 10 marks.");
    </script>
    <body>
    <form name="testing"...>
    <%
    ResultSet rs = stmt.executeQuery("select * from level where...");
    while(rs.next())
    out.println("<tr>");
    out.println("<td>" + rs.getString("question") + "</td>");
    ans = rs.getString("answer");
    out.println("</tr>");
    out.println("<input type='text' name='result'>);
    out.println("<input type='button' value='Enter' onclick='check_answer('<%= ans%>')'>");
    %>jag

  • How to pass a jsp variable into javascript??

    <p><%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
    <p><%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
    <p><html>
    <p><c:set var="binrmapi" value="http://localhost/paas-api/bingorooms.action;jsessionid=XXXXXX?userId=TEST2&sessionId=1&key=1" />
    <p><c:import var="testbinrm" url="${fn:replace(binrmapi, 'XXXXXX', jsessionid)}"/>
    <p><c:set var="tuples" value="${fn:split(testbinrm, '><')}" />
    <p>Time until next game
    <p><c:forEach var="tuple" items="${tuples}">
    <p><c:if test="${fn:contains(tuple, 'row ')}">
    <p> <p><code>
    <p> <c:set var="values" value="${fn:split(tuple, '=\"')}" />
    <p> <font color="blue">
    <p> <c:out value="${values[17]}" />
    <p><c:set var="remainingtime" value="${values[17]}" />
    <p> </font>
    <p> </code>
    <p></c:if>
    <p></c:forEach>
    <p><form name="counter"><input type="text" size="8" name="d2"></form>
    <p><script>
    <p>var milisec=0
    <p>var seconds=eval("document.myForm.remaining").value;
    <p>function display(){
    <p> if (milisec<=0){
    <p> milisec=9
    <p> seconds-=1
    <p>}
    <p>if (seconds<=-1){
    <p> milisec=0
    <p> seconds+=1
    <p> }
    <br>else
    <p> milisec-=1
    <p> document.counter.d2.value=seconds+"."+milisec
    setTimeout("display()",100)
    <p>}
    <p>display()
    <p></script>
    <p></body>
    <p></html>
    <p>This is my code that i was working on, in the jsp part of the script, i get a api call and save a value of time in the variable remainingtime.. and in the javascript, i try to have a countdown clock counting down the remaining time.. but i guess it doesnt work.. how can i get that working? thanks alot
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001
    Message was edited by:
    hamham3001

    Re: How to pass a jsp variable into javascript??Here is the sameple one, hope it will solves your problem.
    <html>
    <body>
    <form name=f>
    <%!
    String str = "A String"
    %>
    <script>
    var avariable = <%=str%>
    <script>
    </form>
    </body>
    </html>
    Let me know if you face any problem

  • Passing jsp variable into javascript.....

    Hai friends,
    Look this code.....
    var mywindow= window.open( ......)
    mywindow.<%= loc%>.style.visibility = "hidden";     
    loc is my jsp variable passing dyanamically to the script....
    But it is not taking....
    when i assign jsp var into javascript like
    mywindow.somehardcodedvalue.style.visibility = <%= loc%>;     
    it is working fine ....
    pl reply me.......

    Hi,
    It is not working.My code is like....
    String loc=(String)arrStr;
    %>
    <script language="JavaScript" type="text/JavaScript">
    mywindow.<%= loc%>.style.visibility = "hidden";     
    </script>
    <%

  • Parsing JSP variable into JavaScript

    Hi,
    I am trying to parse a JSP variable into a pice of JavaScript code:
    <%
    some jsp code .....
    String table_name=cols[0].toString();
    %>
    <script language="javascript">
    var jsTemp = <%=table_name%>
    alert ('jsTemp')
    </script>
    <%some more JSP....
    This does not create an alert, any ideas why? Am I missing a quote/semi-colon somewhere?

    Sure this is being executed,
    when trying to run, this does not work:
    String table="TEST";%>
    <script language="javascript">var jsTemp = <%=table%> alert ('jsTemp');</script>
    <%more JSP...
    when trying to similarly run, I get the popup 'HELLO':
    String table="TEST"; //not used anymore%>
    <script language="javascript">var jsTemp = "HELLO"; alert ('jsTemp');</script>
    <%more JSP...
    Is there supposed to be a semi-colon after <%=table%> ? Or is there another issue with this bit of code?

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • Create Javascript Code Dynamically in JSP

    I would like to generate some Javascript code dynamically in my jsp code. How can i do that?

    The same way you create HTML code dynamically in your JSP code.

  • JSP to write javascript code

    somebody in the net say :
    " You could however have JSP write javascript code when creating
    the page that would set the javascript variables with values
    from your JSP variables. "
    how can we do that ?? can somebody show me a sample code ??

    I really hope this is my last answer to this question.
    Firstly, make clear of the relationship between client side and server side. There is no free lunch at all. Say if you don't want to make another connection to the server from the client side, all you have to do is sent whatever the client is needed to the client side at the very beginning. I believe that should be something really basic to be considered. It is just like, if you don't go out to buy something from the supermarket on your own, nor the supermarket provides any kind of delivery service to you. How can you physically get something you want to buy? This is the same in nature.
    So, your wish is definitely being denied naturally. The only way you can do is, prepare everything on the HTML code for the javascript. Otherwise, make another connection to the server from the client. Don't try to stuck on something which is definitely not possible.

  • Javascript code missing when inserting Fireworks html into DW document

    I tried to insert fireworks html in a Dreamweaver file. After importing the fireworks html in the Dreamweaver document, the associated Javascript code was missing.
    Of course, the Fireworks html file includes the Javascript code and works properly. It is just that when I insert the Fireworks html into the Dreamweaver file, the associated Javascript code gets lost although the manual clearly says that fireworks html is inserted "along with its associated images, slices, and JavaScript".
    I use Fireworks CS5 and Dreamweaver CS5, but I also tried it using FW CS4 and DW CS4 which did not solve the problem.
    I tried two ways to insert the html code (both with the same negative result):
    1.) using the DW menu: Insert > Image Objects > Fireworks HTML
    2.) Copying the HTML to the clipboard in Fireworks, and then pasting it into the Dreamweaver document
    The Fireworks and the Dreaweaver files are both HTML4 docs.
    Of course, I could insert the Javascript code manually, but then I would have to detach the associated template from the DW doc, and I would rather not do that because then later updates to the site will become more complicated.
    BTW, I also tried to insert the fireworks html in another Dreamweaver document not using any template, but the JavaScript code got lost though.
    I would be very grateful if somebody had an idea how to solve this  problem.
    Many thanks for your help!
    Siria
    Message was edited by: SiriaW

    Dear Murray,
    I believe you can solve your problem by changing this -
    </head>
    to this -
    <!-- #BeginEditable "head" --><!-- #EndEditable -->
    </head>
    by editing this template directly.
    I tried this, but it did not change anything. As I wrote before, the JavaScript code is not even inserted when I use a "blank", not-template-controlled DW page.
    But nevertheless, your hint is very helpful. By making the complete head editable, I can at least insert the Javascript code manually.
    But is the javascript that is currently shown there part of the FW HTML insertion?  Do you want to preserve that on the child pages?
    It belongs to the template. And yes, I want to preserve it on the child pages. I just want to insert this into the head of the child page:
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    Maybe we should see the FW code you are trying to insert?
    Sure. Here is the code I tried to insert (of course, most of the Java Script does not need to be inserted as it is already in the template):
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <!-- saved from url=(0014)about:internet -->
    <html>
    <head>
    <title>example.jpg</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!--Fireworks CS5 Dreamweaver CS5 target.  Created Wed Jul 21 00:26:08 GMT+0800 (Malay Peninsula Standard Time) 2010-->
    <script language="JavaScript">
    <!--
    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    function MM_nbGroup(event, grpName) { //v6.0
    var i,img,nbArr,args=MM_nbGroup.arguments;
      if (event == "init" && args.length > 2) {
        if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
          img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
          if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
          nbArr[nbArr.length] = img;
          for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
            if (!img.MM_up) img.MM_up = img.src;
            img.src = img.MM_dn = args[i+1];
            nbArr[nbArr.length] = img;
      } else if (event == "over") {
        document.MM_nbOver = nbArr = new Array();
        for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
          if (!img.MM_up) img.MM_up = img.src;
          img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
          nbArr[nbArr.length] = img;
      } else if (event == "out" ) {
        for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
      } else if (event == "down") {
        nbArr = document[grpName];
        if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
        document[grpName] = nbArr = new Array();
        for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
          if (!img.MM_up) img.MM_up = img.src;
          img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
          nbArr[nbArr.length] = img;
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    //-->
    </script>
    </head>
    <body bgcolor="#ffffff" onLoad="MM_preloadImages('example_bilder/example_r2_c2_s2.jpg','example_bilder/example_r2 _c2_s3.jpg','example_bilder/example_r1_c4_s1.jpg','example_bilder/example_r4_c2_s2.jpg','e xample_bilder/example_r4_c2_s3.jpg','example_bilder/example_r1_c4_s2.jpg','example_bilder/ example_r6_c2_s2.jpg','example_bilder/example_r6_c2_s3.jpg','example_bilder/example_r1_c4_ s3.jpg','example_bilder/example_r8_c2_s2.jpg','example_bilder/example_r8_c2_s3.jpg','examp le_bilder/example_r1_c4_s4.jpg','example_bilder/example_r10_c2_s2.jpg','example_bilder/exa mple_r10_c2_s3.jpg','example_bilder/example_r1_c4_s5.jpg');">
    <table style="display: inline-table;" border="0" cellpadding="0" cellspacing="0" width="915">
    <!-- fwtable fwsrc="lebenslauf_inhalt_slices_optimiert.png" fwpage="Page 1" fwbase="example.jpg" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="1" -->
      <tr>
       <td><img name="example_r1_c1_s1" src="example_bilder/example_r1_c1_s1.jpg" width="58" height="274" border="0" alt=""></td>
       <td><table style="display: inline-table;" align=""left" border="0" cellpadding="0" cellspacing="0" width="195">
          <tr>
           <td><img name="example_r1_c2_s1" src="example_bilder/example_r1_c2_s1.jpg" width="195" height="68" border="0" alt=""></td>
          </tr>
          <tr>
           <td><a href="javascript:;" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','example_r2_c2_s1','example_bilder/example_r2_c2_s2.jpg',' example_bilder/example_r2_c2_s3.jpg',1);" onClick="MM_nbGroup('down','navbar1','example_r2_c2_s1','example_bilder/example_r2_c2_s3. jpg',1);MM_swapImage('example_r1_c4_s1','','example_bilder/example_r1_c4_s1.jpg',1);"><img name="example_r2_c2_s1" src="example_bilder/example_r2_c2_s1.jpg" width="195" height="16" border="0" alt=""></a></td>
          </tr>
          <tr>
           <td><img name="example_r3_c2_s1" src="example_bilder/example_r3_c2_s1.jpg" width="195" height="14" border="0" alt=""></td>
          </tr>
          <tr>
           <td><a href="javascript:;" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','example_r4_c2_s1','example_bilder/example_r4_c2_s2.jpg',' example_bilder/example_r4_c2_s3.jpg',1);" onClick="MM_nbGroup('down','navbar1','example_r4_c2_s1','example_bilder/example_r4_c2_s3. jpg',1);MM_swapImage('example_r1_c4_s1','','example_bilder/example_r1_c4_s2.jpg',1);"><img name="example_r4_c2_s1" src="example_bilder/example_r4_c2_s1.jpg" width="195" height="16" border="0" alt=""></a></td>
          </tr>
          <tr>
           <td><img name="example_r5_c2_s1" src="example_bilder/example_r5_c2_s1.jpg" width="195" height="15" border="0" alt=""></td>
          </tr>
          <tr>
           <td><a href="javascript:;" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','example_r6_c2_s1','example_bilder/example_r6_c2_s2.jpg',' example_bilder/example_r6_c2_s3.jpg',1);" onClick="MM_nbGroup('down','navbar1','example_r6_c2_s1','example_bilder/example_r6_c2_s3. jpg',1);MM_swapImage('example_r1_c4_s1','','example_bilder/example_r1_c4_s3.jpg',1);"><img name="example_r6_c2_s1" src="example_bilder/example_r6_c2_s1.jpg" width="195" height="17" border="0" alt=""></a></td>
          </tr>
          <tr>
           <td><img name="example_r7_c2_s1" src="example_bilder/example_r7_c2_s1.jpg" width="195" height="14" border="0" alt=""></td>
          </tr>
          <tr>
           <td><a href="javascript:;" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','example_r8_c2_s1','example_bilder/example_r8_c2_s2.jpg',' example_bilder/example_r8_c2_s3.jpg',1);" onClick="MM_nbGroup('down','navbar1','example_r8_c2_s1','example_bilder/example_r8_c2_s3. jpg',1);MM_swapImage('example_r1_c4_s1','','example_bilder/example_r1_c4_s4.jpg',1);"><img name="example_r8_c2_s1" src="example_bilder/example_r8_c2_s1.jpg" width="195" height="16" border="0" alt=""></a></td>
          </tr>
          <tr>
           <td><img name="example_r9_c2_s1" src="example_bilder/example_r9_c2_s1.jpg" width="195" height="15" border="0" alt=""></td>
          </tr>
          <tr>
           <td><a href="javascript:;" onMouseOut="MM_nbGroup('out');" onMouseOver="MM_nbGroup('over','example_r10_c2_s1','example_bilder/example_r10_c2_s2.jpg' ,'example_bilder/example_r10_c2_s3.jpg',1);" onClick="MM_nbGroup('down','navbar1','example_r10_c2_s1','example_bilder/example_r10_c2_s 3.jpg',1);MM_swapImage('example_r1_c4_s1','','example_bilder/example_r1_c4_s5.jpg',1);"><i mg name="example_r10_c2_s1" src="example_bilder/example_r10_c2_s1.jpg" width="195" height="16" border="0" alt=""></a></td>
          </tr>
          <tr>
           <td><img name="example_r11_c2_s1" src="example_bilder/example_r11_c2_s1.jpg" width="195" height="67" border="0" alt=""></td>
          </tr>
        </table></td>
       <td><img name="example_r1_c3_s1" src="example_bilder/example_r1_c3_s1.jpg" width="69" height="274" border="0" alt=""></td>
       <td><img name="example_r1_c4_s1" src="example_bilder/example_r1_c4_s1.jpg" width="539" height="274" border="0" alt=""></td>
       <td><img name="example_r1_c5_s1" src="example_bilder/example_r1_c5_s1.jpg" width="54" height="274" border="0" alt=""></td>
      </tr>
    </table>
    </body>
    </html>

  • Inserting asp dynamic content into javascript code

    I am inserting the following javascript text scroller code
    into my page. As you will see, each line of text to be displayed on
    the scroller is preceded with fcontent[0], fcontent[1] etc.
    Since the text will be populated by a database field with a
    repeat region applied, how do I get the fcontent[0] to increase in
    value with each repeated record?
    Secondly, will the javascript code support the mix of asp
    code as well?
    var fcontent=new Array();
    begintag='<div style="font: normal 14px Arial; padding:
    5px;">'; //set opening tag, such as font declarations
    fcontent[0]="<b>What\'s new?</b><br>New
    scripts added to the Scroller category!<br><br>The
    MoreZone has been updated. <a
    href='../morezone/index.htm'>Click here to visit</a>";
    fcontent[1]="Dynamic Drive has been featured on Jars as a top
    5% resource, and About.com as a recommended DHTML destination.";
    fcontent[2]="Ok, enough with these pointless messages. You
    get the idea behind this script.</a>";
    closetag='</div>';

    Try this
    use eval() to evaluate your code stored in the variable.
    http://uk2.php.net/manual/en/function.eval.php
    but Chances are tiny mce is encoding the php as html and i am not sure if addt will also be html encoding it it as well, so you need to check in the database if the text is encoded or escaped in some fasion. dont use tiny mce to insert the code just use a normal text area field and if addt is html encoding then you will have to use addt html de encode function to reverse what ever addt may have done to it.

  • Retrieving Java.vendor into Javascript code

    Hi, I need to check whether the user has the "Use Java 2 version<??> <applet>" (i.e. is using Sun, rather than Microsoft) checked in advanced options under 'internet options' in IE6.
    I tried to do this by using the code examples in this thread to pull back the java.vendor value (see below for html and applet)
    However, even if the check box is not ticked, I recieve the Java.vendor value "Sun Microsystems"
    However, when I run the following example applet (written by someone else who has managed to pull back system info), I get back the the Java.vendor value of "Microsoft" correctly, when the above box is unchecked, and the value of "Sun Microsystems" when the value is checked. <http://www.codeconduct.com/java/SysInfoDemo/SysViewerDemo.htm>
    I also noticed that when I ran my script, the Java symbol pops up in the system tray.
    Why the discrepancy? and how can I alter my code to send back the correct java.vendor to my Javascript code.
    Thanks for your help
    Roger
    //////////////DETECTPLUGIN.HTML///////////////////////////////
    <HTML>
    <HEAD>
    <TITLE>Detect Java Runtime</TITLE>
    </HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    var browsername;
    function getJava()
    var applet = document.myApplet;
    if(applet == null)
    document.writeln("Java Runtime Environment not installed");
    document.writeln("JRE Version: " + document.myApplet.getJavaVersion());
    </SCRIPT>
    <body onLoad="getJava()">
    <OBJECT id="myApplet" classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    WIDTH = 1
    HEIGHT = 1 >
    <PARAM NAME = CODE VALUE = "DetectPluginApplet.class" >
    <PARAM NAME="scriptable" VALUE="true" >
    <embed type="application/x-java-applet;version=1.3"
    code = DetectPluginApplet width = 2 height = 2 MAYSCRIPT = "true" >
    </embed>
    </EMBED>
    </object>
    </BODY>
    </HTML>
    //////////////////DetectPluginApplet.java/////////////////
    import java.awt.*;
    public class DetectPluginApplet extends java.applet.Applet
    public void init()
    add(new Label("DetectPluginApplet"));
    public String getJavaVersion()
    return System.getProperty("java.vendor");
    }

    I should add that I have Sun's Java 2 Runtime Environment 1.4.0_02 installed on my machine. Also, the checbox in 'advanced options' is under "Java(Sun)"

  • Jsp throw numberformatexception.see my code .reply as soon as possible

    i am developed application onclick checkbox delete the record.on first field i give the href to serailno for open the update page. like this <a href="UpdateBoq.jsp?S_NO=<%=sno%>">.sno is serialno.is come from database wihen i am click on serial no it show the updatepage.jsp is not open the updatepage.jsp but it throw the exception number format.this is my code.anybody help me this my project working i am only the single persion to develop this application in jsp.please help me.as soon as possible
    <%@ page language="java" import="java.sql.*"%>
    <%@ page import="java.text.SimpleDateFormat" %>
    <%@ page import="java.util.Date" %>
    <%! int count = 0; %>
    <%! String itemcode;%>
    <%! String sns;%>
    <%! String contunit; %>
    <%! float qty; %>
    <%! float oup;%>
    <%! float oep;%>
    <%! int sno;%>
    <%! int stcode;%>
    <%! float sum=0.0f;%>
    <%! float sum1=0.0f;%>
    <jsp:useBean id="sos" class="boq.Calculation" scope="request"/>
    <%
    //String userID = String.valueOf(session.getAttribute("APP_USER_ID"));
    //String userID = String.valueOf(session.getAttribute("LOGIN_ID"));
    String strDelete = request.getParameter("btnDelete");
    String strserialno=request.getParameter("serialno1");
    String strmopno = request.getParameter("mop");
    String strjobno = request.getParameter("job");
    String strwop=request.getParameter("siten");
    String strno=request.getParameter("siteno");
    if (strDelete != null)
    String del=request.getParameter("hidcount");
    int delcount=-1;
    if (del!=null)
    System.out.println("I am in start of delete Action");
    delcount = Integer.parseInt(del);
    String strCheckBox="";
    String strHidVal="";
    for (int i=0; i<=delcount; i++)
    strCheckBox = request.getParameter("checkbox"+i);
    if(strCheckBox!=null)
    strHidVal = request.getParameter("hid"+i);
    System.out.println("country code is :"+strHidVal);
    System.out.println(del);
    Connection con=null;
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.87:1521:orcl","system","tiger");
    System.out.println(con);
    Statement st2 = con.createStatement();
    Statement st1 = con.createStatement();
    String str0="select * from BOQ where S_NO= '"+ strHidVal + "'";
    ResultSet rs = st1.executeQuery(str0);
    String str="delete from BOQ where S_NO= '"+ strHidVal + "'";
    System.out.println(strCheckBox);
    int a=st2.executeUpdate(str);
    catch(Exception e)
    %>
    <script language="JavaScript">
    alert("<%=e.getMessage()%>");
    </script>
    <%
    finally
    if(con!=null)
    con.close();
    %>
    <html>
    <head>
    <title>CRS</title>
    <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
    <link rel="stylesheet" href="css/ems.css" type="text/css">
    </HEAD>
    <body leftmargin=0 topmargin=2>
    <jsp:include page="Index.html" />
    <form name=form1 action="BOQVIEW.jsp" method=post>
    <table border=0 cellspacing=1 cellpadding=1 width=100% height=5>
    <tr>
    <td valign="top" height="23">
    <table width="100%" border="0" cellspacing="1" cellpadding="1">
    <tr>
    <td bgcolor='#E6E4E4' width=45 align="Center" colspan=2>
    <font color="#5d7a80" size="2">
    BOQ OF MOPS
    </font>
    </td>
    </tr>
    </table>
    </td>
    </tr>
    <tr>
    <td valign=top>
    <table width="100%" cellpadding="1" cellspacing="1" border="0">
    <tr>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=40>S/NO</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=60>SITE NAME</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=65>SITE NUMBER</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=90>ITEM CODE/MATERIAL CODE</td>
    <td width="180" height="5" class="ReportColumnHeader" align="center"colspan=120>CONTRACT UNIT DESCRIPTION ORIGINAL</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=>QUANTITY</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=90 >ORIGINAL UNIT PRICE</td>
    <td width="130" height="5" class="ReportColumnHeader" align="center" colspan=100>ORIGINAL EXTENDED PRICE</td>
    </tr>
    </table>
    <%
    Connection con=null;
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","tiger");
    System.out.println(con);
    Statement st = con.createStatement();
    Statement st1=con.createStatement();
    String qoq=request.getParameter("qoq");
    int one=Integer.parseInt(qoq);
    ResultSet rs = st.executeQuery("SELECT * from BOQ where SITE_CODE="+one);
    ResultSet rs1=st1.executeQuery("select SUM(O_U_P) AS oriunitprice,SUM(O_E_P) AS oriextendsprice from boq WHERE SITE_CODE="+one);
    %>
    <%
    int count=0;
    while(rs.next())
    sno=rs.getInt(1);
    stcode=rs.getInt(2);
    sns=rs.getString(3);
    itemcode=rs.getString(4);
    contunit = rs.getString(5);
    qty=rs.getFloat(6);
    oup = rs.getFloat(7);
    oep = rs.getFloat(8);
    %>
    <table border="0" cellspacing="1" cellpadding="1" width="100" >
    <tr>
    <td class="ReportCellText1" width="10" height=><input type=checkbox name="<%="checkbox"+count%>" onselect="deleterecord();"> </td>
    <td class="ReportCellText1" width="130" height="5" align="center" colspan=29><a href="UpdateBoq.jsp?S_NO=<%=sno%>"><%=sno%></a>
    </td>
    <td class="ReportCellText1" width="55" height="5" align="center" COLSPAN=60><%=sns%></td>
    <td class="ReportCellText1" width="50" height="5" align="center" COLSPAN=65><%=stcode%></td>
    <td class="ReportCellText1" width="130" height="5" align="center" COLSPAN=90><%=itemcode%></td>
    <td class="ReportCellText1" width="130" height="5" align="center" COLSPAN=120><%=contunit%></td>
    <td class="ReportCellText1" width="130" height="5" align="center" COLSPAN=54><%=qty%></td>
    <td class="ReportCellText1" width="130" height="5" align="center" COLSPAN=90><%=oup%></td>
    <td class="ReportCellText1" width="130" height="5" align="center" colspan=100> <%=oep%></td>
    </tr>
    <tr>
    </table>
    <input type=hidden name="<%="hid"+count%>" value="<%=sno%>">
    <!--
    </tr>
    <tr>
    </tr>
    <tr>
    </tr> !-->
    <%
    count++;
    %>
    <table width="100%" cellpadding="1" cellspacing="1" border="0">
    <TR>
    <td width="60" height="5" class="ReportCellText3" align="center" colspan=></td>
    <td class="ReportCellText3" width="55" height="5" align="center" COLSPAN=></td>
    <td width="60" height="5" class="ReportCellText3" align="center" colspan=></td>
    <td class="ReportCellText3" width="50" height="5" align="center" COLSPAN=></td>
    <td class="ReportCellText3" width="50" height="5" align="center" COLSPAN=></td>
    <td class="ReportCellText3" width="50" height="5" align="center" COLSPAN=></td>
    <td class="ReportCellText3" width="50" height="5" align="center" COLSPAN=></td>
    <%
    rs1.next();
    sum=rs1.getFloat("oriunitprice");
    sum1=rs1.getFloat("oriextendsprice");
    %>
    <td width="60" height="5" class="ReportColumnHeader" align="center" colspan=>TOTLE AMOUNT</td>
    <td class="ReportCellText1" width="85" height="5" align="center" colspan=> <%=sum%></td>
    <td class="ReportCellText1" width="90" height="5" align="center" colspan=> <%=sum1%></td>
    </table>
    <TABLE>
    <input type=hidden name=hidcount value =<%=count%>>
    <input type=hidden name=serialno value=<%=itemcode%>>
    <INPUT TYPE=hidden NAME=mop VALUE=<%=contunit%> >
    <INPUT TYPE=hidden NAME=job VALUE=<%=qty%> >
    <INPUT TYPE=HIDDEN name=siten value=<%=oup%>>
    <input type=hidden name=siteno value=<%=oep%>>
    <table><tr><td>
    <input type = button value = Print size=20 onClick = "window.print();"></td>
    <td><input type = Submit value = "Delete" name="btnDelete" size = 20> </td>
    </form>
    <form action=BOQ.jsp method=post>
    <td><input type=Submit value = "Add New" size=20></td>
    </form>
    <form action=NEWPEexl.jsp method=post>
    <td><input type=Submit value = "Export to Excel" size=20></td></tr></table>
    </form>
    <%
    catch(Exception e)
    out.println(e.getMessage());
    finally
    if(con!=null)
    con.close();
    %>
    </body>
    </html>
    when i am click the serial no it show the update page is update .jsp
    this is the update code
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/fileaccess.tld"
    prefix="fileaccess"%>
    <%@ taglib uri="http://xmlns.oracle.com/j2ee/jsp/tld/ojsp/sqltaglib.tld"
    prefix="database"%>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <%@ page language="java" import="java.sql.,java.util."%>
    <%@ page import="java.text.SimpleDateFormat" %>
    <%@ page import="java.util.Date" %>
    <%! int count = 0; %>
    <%!Connection con=null;%>
    <%!PreparedStatement ps=null;%>
    <%
    String strUpdate = request.getParameter("btnUpdate");
    String sno=request.getParameter("serialno1");
    int snoi=Integer.parseInt(request.getParameter("serialno1"));
    String sc=request.getParameter("sitenumber");
    int sci=Integer.parseInt(request.getParameter("sitenumber"));
    String sn=request.getParameter("sitename");
    String itc=request.getParameter("itemno");
    String cu=request.getParameter("contract");
    String qty=request.getParameter("quantity");
    float qtyf=Float.parseFloat(request.getParameter("quantity"));
    String oup=request.getParameter("orig");
    float oupf=Float.parseFloat(request.getParameter("orig"));
    String oep=request.getParameter("origexp");
    float oepf=Float.parseFloat(request.getParameter("origexp"));
    if (strUpdate != null)
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.87:1521:orcl","system","tiger");
    System.out.println(con);
    System.out.println("Connection Established");
    Statement st = con.createStatement();
    String str="update BOQ set SITE_CODE="sci",SITE_NAME='"sn"',ITEM_CODE='"itc"',CONTRACT_UNIT='"cu"',QTY="qtyf",O_U_P="oupf",O_E_P="oepf" where S_NO="snoi" ";
    int a=st.executeUpdate(str);
    if (a>0)
    %>
    <script type="text/javascript" >
    alert("The Record has been Updated Successfully");
    <% response.sendRedirect("BOQVIEW.jsp"); %>
    </script>
    <%
    catch(Exception e)
    String m = e.getMessage();
    %>
    <font size="1" face="Verdana" color=blue>
    "<%=m%>"</font>
    <%
    try
    if(con!=null)
    con.close();
    catch(SQLException sq)
    out.println(sq.getMessage());
    %>
    <!-- Insert the data code-->
    <HTML>
    <head>
    <title>BOQ</title>
    <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
    <script type="text/javascript">
    function callingdate()
    Calendar.setup({
    inputField : "f_date_b", //*
    ifFormat : "%d-%b-%Y ",
    showsTime : true,
    button : "f_trigger_b", //*
    step : 1
    function callingdate1()
    Calendar.setup({
    inputField : "f_date_b1", //*
    ifFormat : "%d-%b-%Y ",
    showsTime : true,
    button : "f_trigger_b1", //*
    step : 1
    function dating()
    var mylist=document.getElementById("effective_date")
    document.getElementById("date").value=mylist.options[mylist.selectedIndex].text
    function caps() {
    document.form1.country_code.value = document.form1.country_code.value.toUpperCase()
    document.form1.country_name.value = document.form1.country_name.value.toUpperCase()
    </script>
    </head>
    <BODY >
    <% count++;
    %>
    <form name=form1 action=UpdateBoq.jsp method=post>
    <!-- <h3 STYLE = "BACKGROUND-COLOR=blue;
    COLOR=YELLOW"
    align=center color=green>Country Information</h1> !-->
    <table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td bgcolor='#336699' align="Center"><font color="#d2b48c" size=2>BOQ OF MOPS</font> </td>
    </tr>
    </table>
    <%
    Connection con=null;
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.87:1521:orcl","system","tiger");
    System.out.println(con);
    Statement st = con.createStatement();
    String se=request.getParameter("serialno1");
    //int ser=Integer.parseInt(request.getParameter("serialno1"));
    String s="SELECT * from BOQ where S_NO="Integer.parseInt(request.getParameter("serialno1"))" ";
    ResultSet rs = st.executeQuery(s);
    System.out.println(s);
    %>
    <%
    while(rs.next())
    int serialno=rs.getInt(1);
    int stcode=rs.getInt(2);
    String sname=rs.getString(3);
    String itcode=rs.getString(4);
    String conunit=rs.getString(5);
    float qtyw = rs.getFloat(6);
    float oupw=rs.getFloat(7);
    float oepw=rs.getFloat(8);
    %>
    <table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr>
    <td bgcolor='#E6E4E4' align="Center" width=100%><font color="#5d7a80" size=2>BOQ OF MOPS </font> </td>
    </tr>
    </table>
    <table width="100%" border="0" cellspacing="1" cellpadding="0">
    <tr><td >
    1)SERIAL NUMBER:</td><td><input type=text name=serialno1 value= "<%=serialno%>" size=10 onblur = "caps();">
    </td></tr>
    <tr><td >
    2)SITE NUMBER:</td><td><input type=text name=sitenumber value= "<%=stcode%>" size=10 onblur = "caps();">
    </td></tr>
    <tr><td >
    3)SITE NAME:</td><td><input type=text name=sitename value= "<%=sname%>" size=10 onblur = "caps();">
    </td></tr>
    <tr><td>
    4)ITEM CODE/MATERIAL CODE:</td><td><input type=text name=itemno value= "<%=itcode%>" size = 20 onblur = "caps();" >
    </td></tr>
    <tr><td>
    5)CONTRACT UNIT DESCRIPTION:</td><td><input type=text name=contract value= "<%=conunit%>" size = 20 onblur = "caps();" >
    </td></tr>
    <tr><td>
    6)QUANTITY:</td><td><input type="text" name="quantity" value= "<%=qtyw%>" size =40 onblur = "caps();" >
    </td></tr>
    <tr><td>
    7)ORIGNAL UNIT/PRICE:</td><td><input type=text name=orig value= "<%=oupw%>" size = 20 onblur = "caps();" >
    </td></tr>
    <tr><td>
    8)ORIGNAL EXTENDED/PRICE:</td><td><input type=text name=origexp value= "<%=oepw%>" size = 20 onblur = "caps();" >
    </td></tr>
    </TABLE>
    <%
    %>
    <center>
    <table>
    <tr><td>
    <INPUT TYPE=Submit value = Update name="btnUpdate" size=20/></td> </tr></table>
    </form>
    <form action="BOQVIEW.jsp" method = post>
    <center> <table>
    <tr><td>
    <input type="submit" value="View" size="20"></input>
    </td> </tr></table>
    </form>
    </form>
    </table>
    </center>
    <hr>
    <script type="text/javascript">
    Calendar.setup({
    inputField : "f_date_b", //*
    ifFormat : "%d-%b-%Y ",
    showsTime : false,
    button : "f_trigger_b", //*
    step : 1
    Calendar.setup({
    inputField : "f_date_b1", //*
    ifFormat : "%d-%b-%Y",
    showsTime : false,
    button : "f_trigger_b1", //*
    step : 1
    </script>
    </BODY>
    <%
    catch(Exception e)
    out.println(e.getMessage());
    finally
    try
    if(con!=null)
    con.close();
    catch(SQLException sq)
    out.println(sq.getMessage());
    %>
    </HTML>
    this my table database oracle 9i
    CREATE TABLE BOQ
    S_NO INTEGER NOT NULL,
    SITE_CODE INTEGER,
    SITE_NAME VARCHAR2(40),
    ITEM_CODE VARCHAR2(20),
    CONTRACT_UNIT VARCHAR2(60),
    QTY FLOAT(70),
    O_U_P FLOAT(70),
    O_E_P FLOAT(70)
    );</a>

    1. Use code tags, there's button that says 'Code'. Select your text and use that. I'm not going to read your code while it's unformatted like this and especially because you seem to have posted your whole darn project here; and I suspect few others will bother either.
    2. Don't paraphrase the exception; post the exact stack trace.
    3. There's usually a line number given with the exception; which line does your stack trace point to? Try to figure out what you're doing wrong there.
    4. NumberFormatException means that you're trying to parse a string that's not in the correct format. Make sure the data you're getting from the DB is correct.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Jsp session variable in javascript

    hi,
    i want use a jsp session variable inside a javascript code, for this i am using the following function,
    function checkList()
    <% String ecode1=(String)session.getAttribute("e_numb"); %>
    var code=<%=ecode1%>
    alert (code)
    this is showing an error can any one please help me,
    thanks
    saurabh

    You have ',%String ecode1' within the javascript. JSP will not recognize 'String' as a java class unless you import the String class. Something like <%@ page import = "java.util.* " %> Incorrect. String is part of java.lang, which is always imported into a java class.
    Most probably what is missing in the javascript is
    - missing quotes ? Not sure if this value is meant to be interpreted as a number or not.
    - missing semicolon
    function checkList()
    <% String ecode1=(String)session.getAttribute("e_numb"); %>
    var code="<%=ecode1%>";
    alert (code);
    }Lets assume that the value of e_numb is "42"
    after running this as a jsp, it should produce the following on the resulting html page. You can see it by viewing the source.
    function checkList()
    var code="42";
    alert (code);
    }Check that to see it has produced valid javascript
    Cheers,
    evnafets

  • How to write javascript code in SERVLET

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.print("<HTML><HEAD><TITLE> DATA NET</TITLE></HEAD>");
    I have to write the following javascript code ......how to do??
    -------------------------javascript code--------------------------------
    <BODY onLoad="pageload();">
    <SCRIPT>
    function pageload()
    var time;
    time="200";
    URL="Default.jsp";
    self.setTimeout("top.location.href=URL;","time");
    </SCRIPT>
    </BODY>

    you are using this:
    out.print("<HTML><HEAD><TITLE> DATA NET</TITLE></HEAD>");
    to print the header of the HTML page...
    I will ask again... what makes you think that writing Javascript or any other contents of an HTML page would be any different?

  • How to get values from a table(in jsp) for validation using javascript.

    hi,
    this is praveen,pls tell me the procedure to get values from a table(in jsp) for validation using javascript.
    thank you in advance.

    Yes i did try the same ..
    BEGIN
    select PROD_tYPE into :P185_OFF_CITY from
    magcrm_setup where atype = 'CITY' ;
    :p185_OFF_CITY := 'XXX';
    insert into mtest values ('inside foolter');
    END;
    When i checked the mtest table it shos me the row inserted...
    inside foolter .. Now this means everything did get execute properly
    But still the vallue of off_city is null or emtpy...
    i check the filed and still its empty..
    while mtest had those records..seems like some process is cleaining the values...but cant see such process...
    a bit confused..here..I tried on Load after footer...
    tried chaning the squence number of process ..but still it doesnt help
    some how the session variables gets changed...and it is changed to empty
    Edited by: pauljohny on Jan 3, 2012 2:01 AM
    Edited by: pauljohny on Jan 3, 2012 2:03 AM

Maybe you are looking for

  • Asset assigned po(error in advance posting against asset assigned po

    Dear friends we have an issue regarding asset assigned po,while we are giving Advance against a po there is an error Item category 07000 not allowed in accounting transaction 1000/0001 Message no. GLT2001 shakti end the entry is 001 50 0010300861 Out

  • How to change a tab page.

    I use Firefox 29.0.1, NL version. One of my tabs in the upper bar is not working. The string to the web page involved is: http://www.buienradar.nl/weerstation/6210 while '6210' should be '6240' I tried to figure out to change this but didn't find a s

  • InfoObject Text not displaying in BPS Web

    Hi Gurus, We are using a custom InfoObject attribute only characteristics (Only text table). We are using this object in BPS planning. When we launch the BPS_Web and drilldown on this Object, it just shows us the technical value, not the text. We wou

  • Osx 10.6.8 freezes

    imac 5 osx 10.6.8 After about 5 minutes it just freezes where it is and I have to just switch it off? Any fixes?

  • JDeveloper 9.0.3 and Oracle Database 10g

    I currently support a project using JDeveloper 9.0.3, and the client is mandating that we upgrade our database to 10g. Am I going to be required to upgrade to JDeveloper 10g, too? Or is JDeveloper 9.0.3 compatible with a 10g database? Thanks for your