Integrating JSP code into HTMLDB

All,
I've read a couple posts about using iFrames to integrate existing JSP applications into HTMLDB, but I'm wondering if it is possible to do new development with JSP's and taglib's directly in HTMLDB (i.e. within an HTML region or something like that).
Thanks.

All,
I've read a couple posts about using iFrames to integrate existing JSP applications into HTMLDB, but I'm wondering if it is possible to do new development with JSP's and taglib's directly in HTMLDB (i.e. within an HTML region or something like that).
Thanks.

Similar Messages

  • Move jsp code into servlet, not work!!

    Hi:
    I am new in servlet and java, I can use jdom to read xml file
    into a jsp file, but whan I move jsp code into servlet, they are not work
    have any ideals?
    Thank!

    Hi:
    my.jsp
    <%@ page contentType="text/html"%>
    <%@ page import="java.io.File,
    java.util.*,
    org.jdom.*,
    org.jdom.input.SAXBuilder,
    org.jdom.output.*" %>
    <%
    String Records = "c:/XMl/Quotes.xml";
    SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    Document l_doc = builder.build(new File(Records));
    my servlet
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import org.jdom.*;
    import org.jdom.input.*;
    import org.jdom.input.SAXBuilder;
    import org.jdom.output.*;
    public class XmlJdom extends HttpServlet
    String Records = "c:/xml/Quotes.xml";
    SAXBuilder builder = null;
    Element Author = null;
    Element Text = null;
    Element Date = null;
    * Initializes the servlet.
    public void init(ServletConfig config) throws ServletException
    super.init(config); //pass ServletConfig to parent
    try
    // JDOM can build JDOM trees from a variety of input sources. One
    // of those input sources is a SAX parser.
    SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser");
    catch ( org.jdom.JDOMEXception e)
    public void doGet(
    HttpServletRequest request,
    HttpServletResponse response)
         throws IOException, ServletException
         PrintWriter out = null;
         out = response.getWriter();
         try{                
         Document l_doc = builder.build(new File(Records));
    Element root = l_doc.getRootElement();
    //get a list of all recode in my XML document
    String l_pages = root.getChild("quote");
    String Iterator e = l_pages.iterator();
    while ( e.hasNext())
    Element l_quote= (Element) e.next();
         Element l_Author = l_quote.getChild("Date").getChild("Text");
    XMLOutputter l_format = new XMLOutputter();
    String ls_result = l_format.outputString(l_doc);
    out.println(ls_result);
    catch( org.jdom.JDOMException e )
         finally
              if( out != null)
                   out.close();
    Please tell me, what is wrong!!!
    Element root = l_doc.getRootElement();
    /* get a list of all the links in our XML document */
    List l_pages = root.getChildren("quote");
    Iterator Myloop = l_pages.iterator();
    while ( Myloop.hasNext())
    Element l_quote= (Element) Myloop.next();
         Element l_Author = l_quote.getChild("Date").getChild("Text");
    XMLOutputter l_format = new XMLOutputter();
    String ls_result = l_format.outputString(l_doc);
    ls_result = l_format.outputString(l_doc);
    %>
    <html><head><title></title></head>
         <body>
              <pre>
              <%=ls_result%>
              </pre>
         </body>
    </html>

  • Integrating tracking codes into iweb.....

    I was so successful in solving a problem I was having here last night that I thought Id throw another question out that has been baffling me, not hard to do I might add, how do you integrate tracking codes at the beginning of each page so that Google analytics for example can track the traffic on your iweb sites??
    This is also a requirement if you are using some affiliate programs so it is really very important to do. Any help anyone out there can give is VERY much appreciated! This is without a doubt the best information forums I have ever read!!....Thanks again in advance for any help on this subject!!...Matt
    http://www.rdeal4u.net

    Google Analytics code (ga.js) required the script to be added into your page source to precisely track the page; Step 4 in the following:
    http://www.google.com/support/analytics/bin/answer.py?answer=66983#0.1.1_step3
    adding GA code in HTML Snippet will cause the code to track widget markup pages, which will give inaccurate results.
    that at this time there is no way to enter tracking code into the pages.
    This is true, because they don't know iweb inner working bits.
    But I can prove them wrong, here is example of HTML code inserted in my page:
    http://hdl.50webs.com/Test/
    the floating nav bar and I have urchin.js loaded from google are coded directly to the page (you need to look at Safari Activity window)
    They suggested I go to www.apple.com/feedback then select the appropriate product (iweb) and seen in a message on the subject directly to the engineers.
    I suggest all that are having a problem with this go ahead and send a message to them as well, you know what they say, the squeaky wheel gets the grease!!
    It's a good idea.

  • Simple question: inserting JSP code into HTML forms

    I have a form with which I am trying to insert a Java String into one of its text boxes. The problem is the string has serval words in it and when the form is viewed only the first word appears.
    The code is:
    String tEntity = request.getParameter("entity"); // the string is intended, and is serveral words
    <TD><INPUT TYPE="textarea" Name="entity" value=<%out.println(tEntity);%>></td>
    Form example the String may be "string of more than one words" but when the form is viewed only the first word "string" appears.
    Any feedback would be much appreciated!
    thanks
    Dan

    hai
    u need to use doubli codes like below
    <INPUT TYPE="textarea" Name="entity" value="<%out.println(tEntity);%>">or best u can give
    <textarea name="entry">
    <%out.println(tEntity);%>
    </textarea>archi

  • Integrating C code into labview for ARM

    Hello,
          I wish to use the library functions written by Luminary engineers for their cortex-m3 controllers. If i wish to use these libraries written in C language in Labview, what i should do? There are large number of labraries are available in their websites. If any one has implemented these libraries in labview please write to me. 
    Nabhiraj

    I would also check the Using External Code in LabVIEW manual, found here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • Html block of code into jsp page.

    Is there possible, using JSF and tiles, to include dynamically a block of html code into a jsp file, or tile ?
    I've tried to create an html file and to include it in a jsp, but at runtime the contents of the html code is not refreshed.
    Any ideas ?
    Maybe using a custom component that acts like a div container for the html code ?
    Thanks in advance.
    Edited by: veveu on Mar 4, 2008 7:18 AM

    I thought about including it in an outputText tag but i never tried it because the output text shouldn't be rendered as html code (by definition).
    Thank you for your brilliant solution, it works fine now.

  • Tutorial on integrating C/C++ code into LabVIEW (6.0 through 7.0)?

    Where can I get a tutorial that will show me how to integrate C or C++ code into LabVIEW?

    I would also check the Using External Code in LabVIEW manual, found here
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • 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

  • 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>
    <%

  • Sending colour from a JSP page into a MySQL database field

    Dear All,
    I am working on trying to send different colours into a MySQL database field from a JSP page.
    This is so that I can represent different pieces of data on my webpage tables in different colours providing status depending on the user request.
    What is the best way to write JSP code for this?
    thanks,
    Alasdair

    Double-posted:
    http://forum.java.sun.com/thread.jspa?threadID=598637

  • Exporting Content of a JSP page into Excel Spread Sheet

    I am trying to export the content of a JSP page into an excel spread sheet. I know this issue had been posted before, but if you any one has the source code of a sample that's working please send it to me at [email protected]
    Your help is appreciated.
    Jamais.

    http://forum.java.sun.com/thread.jspa?threadID=664249

  • Jsp code is not working after some modification in design why?

    hi,
    I am in the final touch of my course work in jsp.i did all the coding and tested..everything was working properly..after i did some modification in the structure of the page the update query is not working..i dont understand why?
    i am attaching my old page and new page here...plz help me to solve this...
    old page editstudent.jsp
    <html>
    <body>
    <%@ page language="java" import="java.sql.*,java.text.SimpleDateFormat,java.util.Date" %>
    <%
    SimpleDateFormat formatter;
    formatter = new SimpleDateFormat("dd-MM-yyyy");
    String refno=request.getParameter("refno");
         String student=request.getParameter("student");
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con=DriverManager.getConnection("jdbc:odbc:lsmsdsn","","");
         Statement st1=con.createStatement();
    ResultSet rs=st1.executeQuery("select * from sponsordetails where refno='"+refno+"'");
    %>
    <form name=editsponsorform method="POST" action="editsponsor.jsp" >
    <input type="text" name="refno" size="20" value="<%=refno%>"></p>
    <p>Sponsor Name <input type ="text" name="sponsorname" size="50" value="<%=rs.getString(2)%>"></p>
    <p>Sponsor's Address&nbsp<textarea name="sponsorsaddress" rows="5" cols "80" tabindex="10"><%=rs.getString(3)%></textarea></p>
    <p>Sponsor's Phoneno <input type ="text" name="sponsorsphoneno" size="30" value="<%=rs.getInt(4)%>"></p>
    <p>Sponsor's Fax <input type ="text" name="sponsorsfax" size="30" value="<%=rs.getInt(5)%>"></p>
    <input type="submit" name="b1" value="Save & Continue" >
    <input type="Reset" name="b2" value="Cancel "onClick="window.location='home.html'">
    old page editsponsor.jsp
    <html>
    <body>
    <%@ page language="java" import="java.sql.*,java.text.SimpleDateFormat,java.util.*" %>
    <%
    String refno=request.getParameter("refno");
    String sponsorname=request.getParameter("sponsorname");
    String sponsorsaddress=request.getParameter("sponsorsaddress");
    String d=request.getParameter("sponsorsphoneno");
    int sponsorsphoneno=Integer.parseInt(d);
    String d1=request.getParameter("sponsorsfax");
    int sponsorsfax=Integer.parseInt(d1);
    Connection con =null;
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:lsmsdsn","","");
         PreparedStatement st=con.prepareStatement("update sponsordetails set sponsorname= ?,sponsorsaddress=?,sponsorsphoneno=?,sponsorsfax=? where refno=?");
    st.setString(1,sponsorname);
    out.println(sponsorname);
    st.setString(2,sponsorsaddress);
    st.setInt(3,sponsorsphoneno);
    st.setInt(4,sponsorsfax);
    st.setString(5,refno);
    st.executeUpdate();     
         st.executeUpdate();
         out.println("record updated successfully"+"<A HREF='loginhtml.html'>login page</A>.");
    finally {
         try {
              if (con !=null) {
              con.close();
         catch (SQLException se)
         out.println(se.getMessage());
    %>
    </body>
    </html>
    New page editstudent.jsp
    <html>
    <body>
    <%@ page language="java" import="java.sql.*,java.text.SimpleDateFormat,java.util.Date" %>
    <%
    SimpleDateFormat formatter;
    formatter = new SimpleDateFormat("dd-MM-yyyy");
    String refno=request.getParameter("refno");
         String student=request.getParameter("student");
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection con=DriverManager.getConnection("jdbc:odbc:lsmsdsn","","");
         Statement st1=con.createStatement();
    ResultSet rs=st1.executeQuery("select * from sponsordetails where refno='"+refno+"'");
    %>
    <form name=editsponsorform method="POST" action="editsponsor.jsp" onSubmit="return validateEditsponsorform()">
    <table width="821" border="1" align="center" bordercolor="#F8F8F8" bgcolor="#F5F5F5">
    <tr>
    <td colspan="6" bgcolor="#CCCCCC"><p class="style6"> </p>
    <p class="style6"> </p>
    <p class="style6"> </p></td>
    </tr>
    <tr>
    <td width="130">Ref No:</td>
    <td width="158">
    <input type="text" name="refno" disabled="true" value="<%=refno%>" />
    </td></tr>
    <tr>
    <td width="130">Sponsor Name</td>
    <td width="158">
    <input type="text" name="sponsorname" value="<%=rs.getString(2)%>"/>
    </td></tr>
    <tr>
    <td>Sponsor's Address:</td>
    <td>
    <textarea name="sponsorsaddress" cols="20" rows="5"><%=rs.getString(3)%></textarea>
    </td></tr>
    <tr>
    <td>Sponsor's Phone No:</td>
    <td>
    <input type="text" name="sponsorsphoneno" value="<%=rs.getInt(4)%>"/>
    </td></tr>
    <tr>
    <td>Sponsor's Fax:</td>
    <td>
    <input type="text" name="sponsorsfax" value="<%=rs.getInt(5)%>" />
    </td></tr>
    <tr>
    <td>
    <input type="submit" name="b1" value="Submit & continue" />
    </td>
    <td><label>
    <input type="reset" name="b2 " value="cancel" onClick="window.location='home.html'" />
    </td>
    </tr>
    </table>
    </form>
    new page editsponsor.jsp
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Edit</title>
    <style type="text/css">
    <!--
    .style2 {
         color: #CC6600;
         font-weight: bold;
         font-size: small;
    .style4 {
         color: #0000CC;
         font-weight: bold;
         font-size: large;
    -->
    </style>
    </head>
    <body bgcolor="#F5F7F4" topmargin="0">
    <%@ page language="java" import="java.sql.*,java.text.SimpleDateFormat,java.util.*" %>
    <div align="center">
    <table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FBFCFF">
    <!--DWLayoutTable-->
    <tr>
    <td height="150" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <!--DWLayoutTable-->
    <tr>
    <td width="800" height="139" valign="top"><img src="images/banner copy.jpg" width="800" height="150" /></td>
    </tr>
    </table>
    <%
    String refno=request.getParameter("refno");
    String sponsorname=request.getParameter("sponsorname");
    out.println(sponsorname);//i am getting the values here.............
    String sponsorsaddress=request.getParameter("sponsorsaddress");
    out.println(sponsorsaddress);
    String d=request.getParameter("sponsorsphoneno");
    out.println(d);
    int sponsorsphoneno=Integer.parseInt(d);
    out.println(sponsorsphoneno);
    String d1=request.getParameter("sponsorsfax");
    int sponsorsfax=Integer.parseInt(d1);
    out.println(sponsorsfax);
    Connection con =null;
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         con=DriverManager.getConnection("jdbc:odbc:lsmsdsn","","");
    PreparedStatement st=con.prepareStatement("update sponsordetails set sponsorname= ?,sponsorsaddress=?,sponsorsphoneno=?,sponsorsfax=? where refno=?");
    st.setString(1,sponsorname);
    out.println(sponsorname);
    st.setString(2,sponsorsaddress);
    st.setInt(3,sponsorsphoneno);
    st.setInt(4,sponsorsfax);
    st.setString(5,refno);
    st.executeUpdate();
         out.println("record updated successfully"+"<A HREF='loginhtml.html'>login page</A>.");
    finally {
         try {
              if (con !=null) {
              con.close();
         catch (SQLException se)
         out.println(se.getMessage());
    %>
    </body>
    </html>
    the database is not updating...its updating when i am giving values directly to update query..why?help me plzzz..
    thanks in advance

    ashish1234 wrote:
    hi,
    I am in the final touch of my course work in jsp.i did all the coding and tested..everything was working properly..after i did some modification in the structure of the page the update query is not working..i dont understand why?
    i am attaching my old page and new page here...plz help me to solve this...
    the database is not updating...its updating when i am giving values directly to update query..why?help me plzzz..With all that Java code in your JSPs, it doesn't look like you are in the final touch of learning JSP, but just at the beginning. Try to move all that java code into Servlets and JavaBeans. The JSP should be all about display, and nothing else.
    What is your problem? I don't know. All that unformatted code is un-readable. On top of being scriptlet code which is hard enough to read.
    You should search the logs to see if there is an error message hidden in there. That is one of the major problems with putting regular Java code in JSPs, the error messages get hidden, and become near impossible to translate.

  • 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?

  • JSP code in a database field

    I have a database content driven website, and I would like to know how to get jsp code to work inside the database content field.
    Here is the code I use to get the content and return it to the browser:
    rs = stmt.executeQuery ("select * from pages where pageid = " + spid);
    out.println (rs.getString ("pagecontent"));Here is a example of jsp code that I want to include into the database content field:
    <% out.println ("inside html"); %>Currently any jsp code gets treated as text. I would like the jsp to get compiled. Does anyone know how to handle this?
    Thanks in advance for any answers.
    David

    Usually, the way you do this is by separating the JSP code from the DB code.
    Create a Java Bean that gets the page content. Then create a JSP that calls the required method on that Java Bean. Then the JSP only needs to be compiled once by the container, and the database calls are made when needed.
    Example:
    class DbAccess {
      public String getContent() {
        ... DB access code here ...
    }JSP page:
    <%= DbAccess.getContent() %>Manuel Amago.

Maybe you are looking for

  • Installing Oracle9i on Windows XP Pro

    Hi, I've just installed Oracle9i Server on Windows XP, the Database is installed probarly & is working fine, but the Enterprise Manager Console window is right aligned. Everything in it, the File Menu is starting from the right side, the vertical bar

  • How to get free iWork, iPhoto on compatible devices bought after 1 Sept?

    Hi Guys, So, I just upgraded to iOS7 and one of the things I was looking forward to was having access to the iWork and iLife apps which Apple announced would be free on newly purchased devices. I bought a 32GB 5th gen iPod touch on Sunday (15th Septe

  • Letter of Volatility

    Please provide me with a Letter of Volatility for the Motion Control Boards PCI-7344 and PCI-7354. I would also appreciate one for the Video Capture Board PCI-1409. A declassification procedure for each of these boards would also meet my requirements

  • Premiere Pro crashing constantly while working with stills & exporting

    I've been using Premiere Pro for a few months now, after being a loyal FCP user (since version 1.2!) and for the most part it's been a relatively painless transition. This latest project is killing me though. There's a lot of stills and they seem to

  • Add to address book function NOT working.

    For some reason the "add to address book" function in mail is not working. I option click an address in a received email, select add to address book - then go into my address book and it's not been added. Also when in Mail and I type in an address fo