Java code not working in Jsp page....

I like to say to myself "there is no magic" when I come to a perplexing situation, today is one of those times.
The following code when executed from the java class retrieves all the specified objects from the database and displays the requested attributes without issue:
try {
DBBody dbb = new DBBody();
Entity[] allbods = dbb.retrieveAll(true);
for(int k=0;k < allbods.length;k++) {
Body body = (Body)allbods[k];
System.out.println("From the dbase index position: " + k +" : " + "\n" + "Id: " + body.getId() + "\n" + "Type: " + body.getType() + "\n" + "Load: " + body.getLoad() + "\n XML:" + body.toXml() + "\n");
dbb.close();
} catch (Exception adb) {
adb.printStackTrace();
: the **exact same** code as displayed above when run in a Jsp only lists the values for the "body.getId()" and "body.getType()" methods...for a reason I can't discern, "body.getLoad()" and "body.toXml()" return empty strings in the Jsp. Everything else returns as when the code is run from the class. Both "getLoad()" and "toXml()" return strings but behind the scenes use StringBuffer objects that are converted to Strings...getId() returns an int and "getType()" returns a String also, but for whatever reason (to repeat) only those two attributes come through IN THE JSP, in the class ALL attributes are retrieved without a problem...so, what is wrong with Jsp? Java? I get no error message what so ever, just empty strings for the two specified method returns...what am I overlooking. I am running the embedded Jsp engine of the Jetty Http Server that I've incorporated into my application, which uses the latest Jsp version.
Any help on this issue would be greatly appreciated.

If you dont want to paste your code, then you will
certainly not get any responses from the so called
Java Engineers rest is left to you. We can get dukes
elsewhere instead.
SwarajSwaraj, I apologize if I was taken to be abrassive with my last comment, I myself am a java engineer so I have no animosity, as for your request to copy the entire code it is no longer needed I have solved the problem and the solution follows just incase anyone else runs into similar issues. It indeed had nothing to do with StringBuffer working improperly but rather it was how I was getting my dbase connection.
As many of you who have developed applications with jdbc support to popular dbase vendors may already know, a connection must be established to the database by specifying various parameters, namely the name of the jdbc connection driver classes for the desired vendor (eg. "com.microsoft.jdbc.sqlserver.SQLServerDriver" for MS Sql Server instances) and the driver specific db connection url. Of course the driver classes must be available on the class path so that they can be accessed. Without these parameters the connection will not be initialized..well it turns out my "bug" was caused by my inadvertently ommitting the connection parameters in my Jsp, you might wonder "but you said it executed fine in the jsp except for the missing "getBody()" and "toXml()" results..how could it even execute at all if you didn't establish a connection?"
The answer is I designed the application to use a default connection driver class (the jdbc odbc bridge driver) and a default connection url (one that is tied to my testing instance of MsSqlServer2000) it turns out that the jdbc odbc bridge is very light weight...it lacks support for certain very useful MsSql datatypes namely "ntext", I use the "ntext" type for fields that can grow to any size (stylesheet code,xml code...etc.) but the bridge driver doesn't support "ntext" BUT rather than throw an exception error like proper error handling would require it silently eats the request (very very bad) ...this exacerbated the problem I had significantly (had it thrown an error I would have known immediately that the connection was using the wrong driver and url and fixed it sooner) as it is ...I was led down blind allies thinking my code was faulty, (which it wasn't strictly speaking ..I was just missing some extra code to account for the possibility that the bridge driver is instantiated by accident) so after adding the following code above the Jsp code shown previously:
//Configure a connection to a Microsoft Sql Database.
DBConfig.setVendorId(DBConfig.MSSQL_VID);
DBConfig.setDBHostId("xiassql");
DBConfig.setDBHostPort("1433");
DBConfig.setDBUrl(DBConfig.buildDBUrl());
:The code worked perfectly. The "DBConfig" class does exactly that..allowing me to pass in connection attributes including the type of vendor "DBConfig.MSSQL_VID", (I have built in support for 5 popular vendors so far), the dbase host name "xiassql" and the port "1433" , then we build the url using the specified attributes and the connection is complete. After adding the code above the Jsp returned all the retrieved values perfectly. So, when testing applications that enable backend dbase connections if you get seemingly identical code behaving differently from class to Jsp, suspect an issue relating to your connection url and classes (assuming you have multiple support and a default value as I do in my app.) also any changes in the execution context from class to Jsp can cause similar errors (like not declaring the same classes at the top of the Jsp file , or less likely using an outdated Jsp engine!)
Regards,
PS I will take off the Duke Dollars on this question since I answered it myself!

Similar Messages

  • Urgent: SAX parser bean is not working in JSP page

    Hi All,
    I have created a bean "ReadAtts" and included into a jsp file using
    "useBean", It is not working. I tried all possibilities. But Failed Plz Help me.
    Below are the details:
    Java Bean: ReadAtts.java
    package sax;
    import java.io.*;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import java.util.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    import javax.xml.parsers.ParserConfigurationException;
    public class ReadAtts extends DefaultHandler implements java.io.Serializable
         private Vector attNames = new Vector(); //Stores all the att names from the XML
         private Vector attValues = new Vector();
         private Vector att = new Vector();
         private Locator locator;
         private static String start="",end="",QueryString="",QString1="",QString2="";
    private static boolean start_collecting=false;
         public ReadAtts()
         public Vector parse(String filename,String xpath) throws Exception
    QueryString=xpath;
         StringTokenizer QueryString_ST = new StringTokenizer(QueryString,"/");
         int stLen = QueryString_ST.countTokens();
         while(QueryString_ST.hasMoreTokens())
              if((QueryString_ST.countTokens())>1)
              QString1 = QueryString_ST.nextToken();
    else if((QueryString_ST.countTokens())>0)
                   QString2 = QueryString_ST.nextToken();
         SAXParserFactory spf =
    SAXParserFactory.newInstance();
    spf.setValidating(false);
    SAXParser saxParser = spf.newSAXParser();
    // create an XML reader
    XMLReader reader = saxParser.getXMLReader();
    FileReader file = new FileReader(filename);
    // set handler
    reader.setContentHandler(this);
    // call parse on an input source
    reader.parse(new InputSource(file));
         att.add("This is now added");
         //return attNames;
    return att;
    public void setDocumentLocator(Locator locator)
    this.locator = locator;
    public void startDocument() {   }
    public void endDocument() {  }
    public void startPrefixMapping(String prefix, String uri) { }
    public void endPrefixMapping(String prefix) {  }
    /** The opening tag of an element. */
    public void startElement(String namespaceURI, String localName,String qName, Attributes atts)
    start=localName;
    if(start.equals(QString2))
    start_collecting=true; //start collecting nodes
    if(start_collecting)
    if((atts.getLength())>0)
    for(int i=0;i<=(atts.getLength()-1);i++)
    attNames.add((String)atts.getLocalName(i));
    attValues.add((String)atts.getValue(i));
    /** The closing tag of an element. */
    public void endElement(String namespaceURI, String localName, String qName)
    end = localName;
    if(end.equals(QString2))
         start_collecting=false; //stop colelcting nodes
    /** Character data. */
    public void characters(char[] ch, int start, int length) { }
    /** Ignorable whitespace character data. */
    public void ignorableWhitespace(char[] ch, int start, int length){ }
    /** Processing Instruction */
    public void processingInstruction(String target, String data) { }
    /** A skipped entity. */
    public void skippedEntity(String name) { }
    public static void main(String[] args)
    String fname=args[0];
    String Xpath=args[1];
    System.out.println("\n from main() "+(new ReadAtts().parse(fname,Xpath)));
    //System.out.println("\n from main() "+new ReadAtts().attNames());
    //System.out.println("\n from main() "+new ReadAtts().attValues());
    JSP File:
    <%@ page import="sax.*,java.io.*,java.util.*,java.lang.*,java.text.*;" %>
    <jsp:useBean id="p" class="sax.ReadAtts"/>
    Data after Parsing is.....
    <%=p.parse"E:/Log.xml","/acq/service/metrics/system/stackUsage")%>
    Expected Output:
    The jsp file should print all the vector objects from the "ReadAtts" bean
    Actual Output:
    Data after Parsing.......[]
    Thanks for your time.....
    Newton
    Bangalore. INDIA

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • HTML multipart form is not working in jsp page

    Hi
    i have jsp page, has a HTML from with file upload field , when i click the send button , nothing happened as if the button did not submit the form. ie the message at line 12 is not printed out.
    can any one help please.
    <%@ page errorPage="..\error\error.jsp" %>
    <%@ page pageEncoding="windows-1256" %>
    <%@ page language="java" import="javazoom.upload.*,java.util.*,java.sql.ResultSet" %>
    <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" >
      <jsp:setProperty name="upBean" property="folderstore" value="<%=request.getRealPath("thuraya//uploads")%>"  />
    </jsp:useBean>
    <jsp:useBean id="dbc" class="mypackage.DBConnection" scope="session" />
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.println("addbtn");
            //do upload file + insert in database
             if (MultipartFormDataRequest.isMultipartFormData(request))
             // Uses MultipartFormDataRequest to parse the HTTP request.
             MultipartFormDataRequest mrequest = new MultipartFormDataRequest(request);
             String todo = null;
             if (mrequest != null) todo = mrequest.getParameter("todo");
                 if ( (todo != null) && (todo.equalsIgnoreCase("upload")) )
                    Hashtable files = mrequest.getFiles();
                    if ( (files != null) && (!files.isEmpty()) )
                        UploadFile file = (UploadFile) files.get("filename");
                        if (file != null)
                                            out.println("<li>Form field : uploadfile"+"<BR> Uploaded file : "+file.getFileName()+" ("+file.getFileSize()+" bytes)"+"<BR> Content Type : "+file.getContentType());
                                            String fileName=file.getFileName();
                                            String ran=System.currentTimeMillis()+"";
                                            String ext=fileName.substring(   ( fileName.length()-4),fileName.length() );
                                            file.setFileName(ran+ext);
                        // Uses the bean now to store specified by jsp:setProperty at the top.
                        upBean.store(mrequest, "filename");
                                            String title=request.getParameter("title");
                                            String content=request.getParameter("elm1");
                                            int x=dbc.addNews(title,content,file.getFileName(),2,1);
                                            if(x==1)
                                                     out.print("New Vedio has been addedd Successfully");
                                                      response.setHeader("Refresh","1;URL=uploadVedio.jsp");
                                                     else{
                                                      out.print("An Error Occured while adding new Vedio");
                                                      response.setHeader("Refresh","1;URL=uploadVedio.jsp");
                    else
                      out.println("<li>No uploaded files");
             else out.println("<BR> todo="+todo);
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input onClick="submit()" name="addBTN" type="button" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

    the problem is not because of java code insdie jsp page
    I have removed all things but the form and it is still not working
    here is the modified code:
    <!-- add news-->
    <%
    if(request.getParameter("addBTN") != null){
            out.print("addBTN");
    %>
    <!-- end of add news-->
    <form action="" method="post" enctype="multipart/form-data" name="upform" >
      <table width="99%" border="0" align="center" cellpadding="1" cellspacing="1">
        <tr>
          <td colspan="2" align="right" bgcolor="#EAEAEA" class="borderdTable"><p>'6'A) .(1 ,/J/</p></td>
        </tr>
        <tr>
          <td width="87%" align="right"><label>
            <input name="title" type="text" class="rightText" id="title">
          </label></td>
          <td width="13%" align="right">9FH'F 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><textarea name="elm1" cols="50" rows="10" id="elm1" style="direction:rtl" >
              </textarea></td>
          <td align="right">*A'5JD 'D.(1</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input type="file" name="filename" id="filename">
          </label></td>
          <td align="right">5H1)</td>
        </tr>
        <tr>
          <td align="right"><label>
            <input name="addBTN" type="submit" class="btn" id="addBTN" value="  '6'A) .(1 ">
          </label></td>
          <td align="right"> </td>
        </tr>
      </table>
    </form>
    <!-- TinyMCE -->
    <script type="text/javascript" src="jscripts/tiny_mce/tiny_mce.js"></script>
    <script type="text/javascript">
            tinyMCE.init({
                    mode : "textareas",
                    theme : "simple",
                    directionality : "rtl"
    </script>
    <!--end of TinyMCE -->

  • Java script not working in JSP.

    Hi everyone
    I've got a problem with a java scipt that's not doing what I want it to do.
    I have a jsp which gets data from a database to display.
    On the jsp there is a "add" button which on click will open another jsp to add a contact, when I add the contact the jsp calls a web servlet which adds the contact to the database.
    After the contact is added the servlet directs the page back to the contacts page, and it must display the newly added contact in the jsp.
    I've configured a script that checks if there is a attribute called "addContact", if it has a value of "added" it must reload the page on load, which in turn will display the newly added contact, it refreshes but it doesn't display the newly added contact, it worked but after awhile it stopped working.
    Beneath is my code for the contact list jsp and the servlet.
    ContactList.jsp
    <?xml version="1.0"?>
    <%@ page import="contacts.Contacts"%>
    <%@ page import="java.util.*"%>
    <jsp:useBean id = "contactsData" scope = "page" class ="contacts.ContactsData"/>
    <html>
         <head>
              <title>Contact List</title>
              <script language=JavaScript>
              <!--
                   function clicked(clickedValue)
                        if(clickedValue == "add")
                             window.location = "AddContact.jsp";
              -->
              </script>
         </head>
              <%
              String refreshSession = (String)session.getAttribute("addContact");
              if(refreshSession != null && refreshSession.equals("added"))
              %>
              <body onload="window.location.reload(true);">
              <%
              session.removeAttribute("addContact");
              else
              %>
              <body>
              <%
              %>
              <h1>Contacts</h1>
              <form>
                   <table cellpadding="5">
                        <%
                             ArrayList contactList = contactsData.getContacts();
                             Iterator contactsIterator = contactList.iterator();
                             Contacts contacts;
                             while(contactsIterator.hasNext())
                                  contacts = (Contacts) contactsIterator.next();
                                  String contactName = contacts.getContactName();
                        %>
                                  <tr>
                                       <td><input type="radio" name="deleteContact" value=<%=contactName%>></td>
                                       <td><a href = "UpdateContact.jsp?paramName=<%=contactName%>"><%=contactName%></a></td>
                                       <td><%=contacts.getCompany()%></td>
                                       <td><%=contacts.getWorkNumber()%></td>
                                       <td><a href = "mailto:<%=contacts.getEmail() %>"><%=contacts.getEmail() %></a>
                                  </tr>
                        <%
                        %>
                   </table>
                        <br>
                        <input type="button" value="Add" onClick="clicked('add')"/>
              </form>
         </body>
    </html>NewContactServlet.java
    package contacts;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import contacts.*;
    public class NewContactServlet extends HttpServlet
         public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              res.setHeader("Expires", "Tues, 01 Jan 1980 00:00:00 GMT"); //no cache allowed
              HttpSession session = req.getSession(true); //get current session
              String contactssession = (String)session.getAttribute("contactsSession");
              if(contactssession.equals("add"))
                   Contacts contacts = new Contacts();
                   ContactsData contactsData = new ContactsData();
                   contacts.setContactName(req.getParameter("contactName"));
                   contacts.setCompany(req.getParameter("companyName"));
                   contacts.setWorkNumber(req.getParameter("workNum"));
                   contacts.setCellNumber(req.getParameter("cellNum"));
                   contacts.setFaxNumber(req.getParameter("faxNum"));
                   contacts.setEmail(req.getParameter("email"));
                   contacts.setCountry(req.getParameter("country"));
                   contactsData.addContact(contacts);
              else if(contactssession.equals("add"))
              session.setAttribute("addContact","added");
              res.sendRedirect("ContactList.jsp");
    }

    Ren2407 wrote:
    Hi stevejluke
    Thanks for the reply.
    ContactsData stores the Contacts into a database, Access to be precise.
    The store of the Contacts works fine and it gets redirected to the ContactsList.jsp page, but I need to click refresh on the browser to see the new
    contact. I've tried to make it load automatically when the browser opens but it wouldn't, it worked before.
    I'm using Apache to host the webpage.I don't see any errors.So lemme get this straight:
    You have the contactsList.jsp which when Add is clicked you go to addContact.jsp in the same window. Then when addContact is submitted it goes to the neContact servlet which adds the contact to the database and then sends a redirect back to the contactsList.jsp.
    When contactsList.jsp is re-shown it doesn't display the new data so you are using javascript to force-refresh the page, which used to work, but doesn't anymore.
    My guess is that your browser or some proxy between your browser and server is caching the page. You have to tell all clients not to cache that page using META tags:
    <?xml version="1.0"?>
    <%@ page import="contacts.Contacts"%>
    <%@ page import="java.util.*"%>
    <jsp:useBean id = "contactsData" scope = "page" class ="contacts.ContactsData"/>
    <html>
         <head>
              <title>Contact List</title>
                    <meta HTTP-EQUIV="expires" CONTENT="0" />
                    <meta HTTP-EQUIV="Pragma" CONTENT="no-cache" />
                    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache" /> You could then get rid of your javascript refresh code altogether.
    p.s. I am a big fan of using JSTL. Try to get rid of all your scriptlets and replace it with JSTL. It would look something like this:
              <h1>Contacts</h1>
              <form>
                   <table cellpadding="5">
                        <c:forEach var="contact" items="${contactsData.contacts}">
                                  <tr>
                                       <td><input type="radio" name="deleteContact" value="${contact.name}"></td>
                                       <td><a href = "UpdateContact.jsp?paramName=${contact.name}">${contact.name}</a></td>
                                       <td>${contact.company}</td>
                                       <td>${contact.workNumber}</td>
                                       <td><a href = "mailto:${contact.email}">${contact.email}</a>
                                  </tr>
                        </c:forEach>
                   </table>
                        <br>
                        <input type="button" value="Add" onClick="clicked('add')"/>
              </form>

  • Period overlaps code not working in apex page

    Hi there,
    Employees have a schedule with a begin and end date. Schedule periodes may not overlap each other for the same employee.
    I have a function returning error text validation as follow:
    declare
    l_dummy number;
    begin
    select  count(*)
    into    l_dummy
    from    fus_medewerker_roosters
    where   mdr_code = :p61_mdr_code
    and     id <> :p61_id
    and     to_date(:p61_begin_periode,'DD-MON-YY') <= eind_periode
    and     to_date(:p61_eind_periode,'DD-MOn-YY')>= begin_periode
    +;+
    if l_dummy > 0
    then
    return 'This employee already has a schedule in this periode.';
    else
    return null;
    end if;
    end;
    But the code is not working. It does save data for an employee even if the periodes overlaps.
    But the code works fine in workshop:
    declare
    l_dummy number;
    begin
    select  count(*)
    into    l_dummy
    from    fus_medewerker_roosters
    where   mdr_code = :p61_mdr_code
    and     id <> :p61_id
    and     to_date(:p61_begin_periode,'DD-MON-YY') <= eind_periode
    and     to_date(:p61_eind_periode,'DD-MOn-YY')>= begin_periode
    +;+
    if l_dummy > 0
    then
    DBMS_OUTPUT.PUT_LINE ('This employee already has a schedule in this periode.');end if;
    end;
    What is going wrong. Why is it working fine in workshop but not in my page?
    Regards,
    Diana
    Edited by: dianap on Sep 4, 2009 8:31 AM

    Hi Andy,
    I left out the id is not :p11_id
    and the code is working fine now.
    I have another problem now.
    The user can make a choice between a department or an employee.
    The validation works fine when a schedule is given to a employee (choossing a department from the department list and a employee from the employee list)
    But if the user wants to give a schedule to a department(one or more employee depending on the employees of that department) then he chooses the department from the department select list, leaving the employee select list empty. When i want to save these changes, i get a invalid number error. I tried making the validation conditional for when the employee item is null.
    But still i get invalid number.
    Any suggestions how i could solve this problem?
    Thanks,
    Diana

  • Select from  Berkeley DB through java code not working

    Hi,
    I have developed an application using Jdeveloper 11g where in the Database Navigator I have created a new connection say Conn1 ,selected Generic Jdbc as the connection type and org.sqlite.Jdbc as the Driver Class.The JDBC URL is for example jdbc:sqlite:C:\Temp\ABC\abc.db .I have created a table say zipcodes. Now,I developed an ADF Fusion Web App in Jdev and selected View Obj in the model part.In the subsequent steps I selected the Berkley DB Connection as Conn1 and thus created the App Module and View Object.I then created a java class in the model part with code as
    package abc;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Properties;
    public class MainClass {
    public static void main(String[] args)
    try {
    String driver = "org.apache.derby.jdbc.EmbeddedDriver";
    Class.forName(driver).newInstance();
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:derby:C:\Temp\ABC\abc.db");
    Statement s = conn.createStatement();
    ResultSet rs = s.executeQuery("SELECT city, state, zipcode FROM zipcodes");
    while(rs.next()) {
    System.out.println("City : "+ rs.getString(1));
    System.out.println("State : "+ rs.getString(2));
    System.out.println();
    rs.close();
    s.close();
    conn.close();
    } catch(Exception e) {
    System.out.println("Exception: "+ e);
    e.printStackTrace();
    I imported db.jar, dbexample.jar, sqlite.jar ,derby.jar. and in the view part selected a jsf page and drag and dropped an attribute from the view control...Now when I run the application the error is that: Application module not connected to a database...
    What can be the possible problem?????How do I resolve it
    Thank you.

    Hello,
    What is the OS platform and version of Berkeley DB being used?
    abc.db is the Berkeley DB database right?
    Thanks,
    Sandra

  • ListIterator not working in JSP page

    Hello,
    I am using an ArrayList in a JSP as follows:
    <%
    ArrayList missingFieldsArr = (ArrayList) HeaderBean.getMissingFieldsArr();
    ListIterator i = (ListIterator)missingFieldsArr.listIterator();
    %>
    <hbj:scrollContainer
      id="scrContError"
      width="320"
      height="50"
    >
      <table width="60%">
      <% while(i.hasNext()) {
        String str = (String) i.next();
      %>
        <tr>
          <td width="100%"> 
            <hbj:textView
           id="txtErrorLst"
           wrapping="true"
           text="<%=str%>"
         />     
         </td>
       </tr>     
      <% } %>
      </table>
    </hbj:scrollContainer>
    Iterating through the ArrayList works when I test via portalapp.xml in NDS, but it does not when I test via the iview in the Portal.  The error I'm receiving is:
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : pcd:portal_content/com.nbcuni.sc_portal_Content/com.nbcuni.Roles/com.nbcuni.SAP_SC_Testing_Pre-Bom/com.nbcuni.product_information_prebom_ws/com.nbcuni.pre_bom_pg/com.nbcuni.pre_bom
    Component Name : PBS.Inbox
    The exception was logged. Inform your system administrator..
    Exception id: 06:37_30/12/05_0106_4554750
    See the details for the exception ID in the log file
    Any thoughts? 
    Thanks for your help,
    -Jamie

    Hi Jamie,
    for what reason do you think it's the list iterator? All you know from the info you have passed through to us, that it is your component...
    > Exception id: 06:37_30/12/05_0106_4554750
    > See the details for the exception ID in the log file
    ==> Please submit the detailed exception / message / stacktrace from the default.X.trc file.
    Best regards
    Detlev

  • Javascript is not working in JSP

    Hi everybody,
    My javascript is not working in JSP.I m not able to fix this problem.Please tell where the problem in code.
    thx in advance.
    <%@page import="javax.servlet.http.*" %>
    <%@page import="java.sql.*" %>
    <html>
    <head>
    <script type="text/javascript" >
    funtion checkentries()
    if(document.LForm.uname.value==null || document.LForm.upassword.value==null)
    alert("Please fill all entries")
    else
    document.LForm.submit()
    </script>
    </head>
    <body>
    <table width=100% height=100% valign="center" align="center" border=0>
    <tr height=10% ><td>
    <%@ include file="Header.jsp" %>
    <hr>
    </td></tr>
    <tr height=1% width=100%>
    <td align=right>Register
    <hr>
    </td>
    </tr>
    <tr height=77% width=100% ><td>
    <table>
    <tr><td width=65%>
    </td>
    <td bgcolor="black" width="1" ></td>
    <td align="right" valign="top" >
    <form method="POST" action="/EIS/Home.do" name="LForm">
    User Name: <input type="text" align=right name="uname"><br>
    Password: &nbsp&nbsp&nbsp<input type="password" name="upassword"><br>
    <input type="submit" name="submit" value="Submit" onclick="checkentries()">
    </td>
    </tr>
    </table>
    </td></tr>
    <tr height=10% ><td>
    <hr>
    <%@ include file="Footer.jsp" %>
    </td></tr>
    </table>
    </body>
    </html>

    in this part:
    if(document.LForm.uname.value==null || document.LForm.upassword.value==null)should be:
    if(document.LForm.uname.value=="" || document.LForm.upassword.value=="")or
    if(document.LForm.uname.value.length==0 || document.LForm.upassword.value.length==0)

  • BLOB image not shows in JSP page!!

    Hi Dear all,
    I had tried to configure how to show BLOB image to jsp page . The code are works fine and servlet works ok but image can not show only. can you help me that what need to be added. Please help me.
    Can any experts help me? BLOB image not shows in JSP page. I am using ADF11g/DB 10gR2.
    My as Code follows:
    _1. Servlet Config_
        <servlet>
            <servlet-name>images</servlet-name>
            <servlet-class>his.model.ClsImage</servlet-class>
        </servlet>
        <servlet-mapping>
            <servlet-name>images</servlet-name>
            <url-pattern>/render_images</url-pattern>
        </servlet-mapping>
      3. class code
    package his.model;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Iterator;
    import java.util.Map;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.Row;
    import oracle.jbo.ViewObject;
    import oracle.jbo.client.Configuration;
    import oracle.jbo.domain.BlobDomain;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    public class ClsImage extends HttpServlet
      //private static final Log LOG = LogFactory.getLog(ImageServlet.class);
      private static final Log LOG = LogFactory.getLog(ClsImage.class);
      public void init(ServletConfig config)
        throws ServletException
        super.init(config);
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
        throws ServletException, IOException
        System.out.println("GET---From servlet============= !!!");
        String appModuleName = "his.model.ModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleName");
        String appModuleConfig = "TempModuleAssetMgt";//this.getServletConfig().getInitParameter("ApplicationModuleConfig");
        String voQuery ="select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = 'P1000000000006'" ;// 'P1000000000006' this.getServletConfig().getInitParameter("ImageViewObjectQuery");
        String mimeType = "jpg";//this.getServletConfig().getInitParameter("gif");
        //?IMAGE_NO='P1000000000006'
        //TODO: throw exception if mandatory parameter not set
        ApplicationModule am =
          Configuration.createRootApplicationModule(appModuleName, appModuleConfig);
          ViewObject vo =  am.createViewObjectFromQueryStmt("TempView2", voQuery);
        Map paramMap = request.getParameterMap();
        Iterator paramValues = paramMap.values().iterator();
        int i=0;
        while (paramValues.hasNext())
          // Only one value for a parameter is expected.
          // TODO: If more then 1 parameter is supplied make sure the value is bound to the right bind  
          // variable in the query! Maybe use named variables instead.
          String[] paramValue = (String[])paramValues.next();
          vo.setWhereClauseParam(i, paramValue[0]);
          i++;
       System.out.println("before run============= !!!");
        // Run the query
        vo.executeQuery();
        // Get the result (only the first row is taken into account
        System.out.println("after run============= !!!");
        Row product = vo.first();
        //System.out.println("============"+(BlobDomain)product.getAttribute(0));
        BlobDomain image = null;
        // Check if a row has been found
        if (product != null)
          System.out.println("onside product============= !!!");
           // We assume the Blob to be the first a field
           image = (BlobDomain) product.getAttribute(0);
           //System.out.println("onside  run product============= !!!"+image.toString() +"======="+image );
           // Check if there are more fields returned. If so, the second one
           // is considered to hold the mime type
           if ( product.getAttributeCount()> 1 )
              mimeType = (String)product.getAttribute(1);       
        else
          //LOG.warn("No row found to get image from !!!");
          LOG.warn("No row found to get image from !!!");
          return;
        System.out.println("Set Image============= !!!");
        // Set the content-type. Only images are taken into account
        response.setContentType("image/"+ mimeType+ "; charset=windows-1252");
        OutputStream os = response.getOutputStream();
        InputStream is = image.getInputStream();
        // copy blob to output
        byte[] buffer = new byte[4096];
        int nread;
        while ((nread = is.read(buffer)) != -1)
          os.write(buffer, 0, nread);
          //System.out.println("Set Image============= loop!!!"+(is.read(buffer)));
        os.close();
        // Remove the temporary viewobject
        vo.remove();
        // Release the appModule
        Configuration.releaseRootApplicationModule(am, false);
    } 3 . Jsp Tag
    <af:image source="/render_images" shortDesc="Item"/>  Thanks.
    zakir
    ====
    Edited by: Zakir Hossain on Apr 23, 2009 11:19 AM

    Hi here is solution,
    later I will put a project for this solution, right now I am really busy with ADF implementation.
    core changes is to solve my problem:
        byte[] buffer = new byte[image.getBufferSize()];
        int nread;
        vo.remove();
        while ((nread = is.read(buffer)) != -1) {
          os.write(buffer);
        }All code as below:
    Servlet Code*
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response) throws ServletException,
                                                             IOException {
        String appModuleName =
          "his.model.ModuleAssetMgt";
        String appModuleConfig =
          "TempModuleAssetMgt";
      String imgno = request.getParameter("imgno");
        if (imgno == null || imgno.equals(""))
          return;
        String voQuery =
          "select ITEM_IMAGE from MM_ITEMIMAGE where IMAGE_NO = '" + imgno + "'";
        String mimeType = "gif";
        ApplicationModule am =
          Configuration.createRootApplicationModule(appModuleName,
                                                    appModuleConfig);
        am.clearVOCaches("TempView2", true);
        ViewObject vo = null;
        String s;
          vo = am.createViewObjectFromQueryStmt("TempView2", voQuery);
        // Run the query
        vo.executeQuery();
        // Get the result (only the first row is taken into account
        Row product = vo.first();
        BlobDomain image = null;
        // Check if a row has been found
        if (product != null) {
          // We assume the Blob to be the first a field
          image = (BlobDomain)product.getAttribute(0);
          // Check if there are more fields returned. If so, the second one
          // is considered to hold the mime type
          if (product.getAttributeCount() > 1) {
            mimeType = (String)product.getAttribute(1);
        } else {
          LOG.warn("No row found to get image from !!!");
          return;
        // Set the content-type. Only images are taken into account
        response.setContentType("image/" + mimeType);
        OutputStream os = response.getOutputStream();
        InputStream is = image.getInputStream();
        // copy blob to output
        byte[] buffer = new byte[image.getBufferSize()];
        int nread;
        vo.remove();
        while ((nread = is.read(buffer)) != -1) {
          os.write(buffer);
        is.close();
        os.close();
        // Release the appModule
    Configuration.releaseRootApplicationModule(am, true);
    }Jsp Tag
    <h:graphicImage url="/render_images?imgno=#{bindings.ImageNo.inputValue}"
                                                        height="168" width="224"/>

  • UIComponent broadCastAction is not working in mobile page

    We are using the broadCastAction in one of our critical flows to submit to an action in Managed bean but we are facing issue in our ADF fusion web app for mobile . When we create a page with mobile render option selected the broadCastAction is not getting triggered . broadCastAction shows null in the getter of BroadCastAction.
    <tr:commandButton text="AutoSubmit" id="cb2"
    action="processResponse"
    binding="#{pageFlowScope.testBean.braodCastAction}"
    rendered="false"/>
    This is working in normal page without "render in mobile" selected , we need a solution for it to work on mobile compatible page as well

    Hi Frank
    UIComponent braodCastAction is from javax.faces.component.UIComponent . It is used to invoke action of a UI component through Java code
    if we have button like
    <tr:commandButton text="AutoSubmit" id="testCommandbtn" action="processMobile"
    binding="#{pageFlowScope.mobileBean.braodCastAction}"
    rendered="true" />
    Then through getter method of broadcastAction we can invoke the action of this button using the below code
    braodCastAction.broadcast(new ActionEvent(braodCastAction));
    This is working in the normal jspx page but not working in a page where we select render in mobile

  • Java does not work at all upon using the update manager to update to firefox 3.6.10 for Ubuntu 9.0.4

    OS: Ubuntu 9.0.4
    Browser: Firefox 3.6.10
    upon updating to firefox 3.6.10, java does not work at all.
    websites that use java do not work at all anymore, when they worked just fine before the updating thru update manager. e.g. hulu website cannot play any of the shows.
    i can give the folder of bookmarked pages i tried.
    how to do that on here, i've yet to see if possible.
    i can even give saved text from the terminal concerning certain attempts.
    when i updated thru update manager, it gave some weird java plugin that wasn't there before "The IcedTea Web Browser Plugin IcedTea6 Java Web Browser Plugin (execution of applets on webpages)".
    i uninstalled this as instructed by an answer found in one of the pages i saved, cuz it was conflicting w/another java program the updater said i needed. right now, i don't remember for sure what it was. it perhaps was realplayer flash or Java itself. w/all the hours/days of searching i put in, it's difficult if not downright impossible for me to remember all the specifics of what i tried.
    i've searched throughout many webpages (including many searches on mozilla, ubuntu, java, etc) for instruction in fixing the problem.
    oh, and incidentally, on the Java site, when i try the verify test of Java, firefox pops up with that yellow bar right below the slew of tabbed website windows, giving the statement "additional plugins are required to display all the media on this page. (w/link to) install missing plugins ." which is what i do, go thru the requesting plugin installation. it comes up with, guess what, the IcedTea Java Plugin. i click on the 'next' in the "Plugin Finder Service" box that pops up, & all it gives me is "No plugins were installed. IcedTea ...Plugin failed. and the link 'find out more about plugins or manually find missing plugins'". the link takes me to some of the very things/plugins that wouldn't install in the first place. the Java test failure is a LOL funny, as what plugin it is saying is required (IcedTea) is a recommended alternate program to display the very test in the first place.
    i followed the given instructions on those many searched pages, in every case (barring what i may have just plain missed), but to no avail.
    i've even gone to the point of trying to reinstall the previous 3.5.13 firefox version, from mozilla site. even that wouldn't install.
    i've tried installing Java for my sys direct from it's site. nada.
    now it's time for me to post the problem & perhaps someone will come up with some kind of "dummy" way to fix it.
    until then many sites a regularly use are totally useless to me on this fast puter.
    the only way i can get to use such sites, are two choices: 1. use a dinosaur laptop, which is slower than molasses & cannot handle to any streaming stuff, or 2. use an available internet access puter at the library. but useage for ea person per day is limited to only one hour a day. and one can end up waiting for an hour or more ( in the busiest periods) to even get to use one.
    so, is there anyone at all, who knows any for-sure working fix for this problem?
    thanks muchly :^D
    p.s. i can't pay anybody any money for such help, as is required in certain sites (e.g. Java website), cuz i don't have any.
    i can pay in labor tho, if there is someway to find someone who can physically be at this puter w/me, taking me step-by-step
    sorry for the 20-pg essay. i hope it was all clearly understood. if, not, well, clear communication is always what is needed, ask away.

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

  • Java applet not working savevid keepvid

    Hi all,
    I'm sure I'm not the only one who has been confounded by Java applets not working in certain download web services; in my case, keepvid.com and savevid.com to download copies of youtube videos.  It has been a huge headache and even debilitating in my case.  I teach film and video to middle schoolers, and we often use youtube as a resource for our class projects. 
    I found a solution today, I think, and wanted to share it:
    I installed the browser called "Torch" and it seems to work fine, so far.

    thanx 4 replying
    using the browser to view Applet is not recomended that is because if u change the the source-code and recompile the applet then run it using the broswer it will run the old-version
    Also i've found the solution here
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html

  • ScriptLink tag not working for application page sharepoint 2010

    <ScriptLink> tag not working for application page sharepoint 2010 for including javascript in application page, it appends either 1033 or _layout to path specified for javascript.But javascripts are located in custom document library on site and not
    in _layouts folder.
    Please help and explain in details as I tried lot on this.

    Hi,
    Use the following line of code
    <SharePoint:Scriptlink runat="server" Name="~sitecollection/Style Library/[YOUR SITE]/js/functions.js" Language="javascript" />
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • HT1338 I installed Mac OSX Snow Leopard 10.6.3 And now my Java is not working, what can I do to fix's this?

    I installed Mac OSX Snow Leopard 10.6.3 And now my Java is not working,what can I do to fix's this?

    Run Software Update to get to 10.6.8 and update Java.

  • Java Plugin not working with firefox 3.o.13  and linux.

    this is my ln -s to the plugin at /usr/lib/mozilla/plugins
    libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    Any ideas why java is not working?
    Here's the ln -s again:
    #pwd
    #/usr/lib/mozilla/plugins
    # ls -l
    lrwxrwxrwx 1 root root 63 Sep 28 20:41 libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    Here are my java stats:
    # java -version
    java version "1.6.0_16"
    Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
    Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
    Firefox 3.0.13:
    Mozilla/5.0 (X11; U; Linux i686;
    Gentoo Linux:
    # uname -a
    Linux tma 2.6.30-gentoo-r5 #10 SMP Sun Sep 20 21:52:19 PDT 2009 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux
    I installed java from a jdk*.sh file and set the class path in /etc/bash/bashrc (not that it matters.
    The appletviewer does work.

    solved: I knew you all knew I could figure this out.
    #cp -R /usr/lib/mozilla/plugin/ /usr/lib/firefox-mozilla/
    asuming this is true:
    tma plugins # pwd
    /usr/lib/mozilla/plugins
    tma plugins # ls -l
    total 4
    lrwxrwxrwx 1 root root 63 Sep 28 20:41 libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    tma plugins #

Maybe you are looking for