Ways to retrieve data into Jsp page on ComboBox (or any other event ) event

Hi all,
I want to retrieve records from database and display it in Text field.
Can any one tell me the ways to do it, i know i can do this by using javascript (javascript to submit the form), but i dont want to use javascript any where in my code,
what i want to know is there any other ways to implement this functionality, and which is the best one.
Kindly help me,
Thanks in advanced.

With plain webapps, there is no way. In one way or another, the server needs to be invoked to be able to provide the data, so that is either a submit or through an Ajax call. Both would involve javascript. Why are you scared of Javascript anyway?

Similar Messages

  • Best way to retrieve data for jsp

    Hi,
    I'm fairly new to java and am preparing to create some jsp's for our intranet. The pages need to include data from a db2 database. I know pretty much what I need to do, but I'm trying to decide the best(most efficient) way to retrieve the data to display. I've looked at a number of examples and the more I look, the more confused I get (it would be so easy on the AS400 which is my background so you can see how new this is to me). I see my options as: using an 'include' statement to include another java file that retrieves the data; or use a java bean; or just instantiate an instance of the class and 'call' the methods for that class directly; or lastly, place all the code directly in the jsp to connect to the database and query the table.
    What's the real difference between these options and what's usually the most efficient and preferred way?
    Thanks for any advice and clarification.

    As a general rule, it's a good idea to separate the
    presentation (JSP and HTML) from the business rules
    (database access). I know you didn't do that on the
    AS/400, you had display files and business logic in
    the same program (at least, we certainly do in ours),
    but it's a good policy to follow in the web world.
    That means, don't put your database access code in
    the JSP. Other than that, it depends on the data.
    If you have simple data (e.g. customer's name and
    d address) then a Java bean would suffice. If you
    have complex data (e.g. customer's payment history)
    then a bean still might suffice. You would use an
    "include" if you had some data (static or dynamic)
    that you wanted to appear in several different pages
    in the same form.Thanks, I figured putting the code in the JSP was not the best way, but I wasn't sure about the other options.

  • Implementing Database codes FAIL /error in parsing data into jsp page

    Hi there,
    I have this problem trying to build a portal application. I am using the JSPDynPage, jsp page and a bean to build a page.
    I have this problem parsing data from JSPDynPage to the beans and to the jsp page.
    I tested out the connection between the beans and the jsp page. There is no error parsing information from the beans to the jsp page.
    So i tried to test out the codes for the database from the beans.
    Will this work? Because it does not display the results i want.
    I need an Solution asap to find out wad is wrong also also the correct codes to the database.
    public String db(){
    try {
                 InitialContext iC = new InitialContext();
                 DataSource dataSource = (DataSource)iC.lookup("java:env/jdbc/mySQL");
                 java.sql.Connection connection = dataSource.getConnection();
                 PreparedStatement st = connection.prepareStatement("SELECT name FROM test WHERE id='123'");
                 ResultSet resultSet = st.executeQuery();
                 while (resultSet.next()){
                      name = resultSet.getString("name");
                      name = name.toString();
                 connection.close();
                 return name;
                 } catch(Exception n){
                      e = "Exception";
                      return e;
    This is the method i put in the beans to test out the database connection.
    Thanks Loads
    Quatre

    Hi there,
    Thanks for the reply, i thought that no one is going to reply me anymore. Thanks loads.
    Bean Class name: Bean1
    Bean Packeage name: Beans1
    Bean id : myBean1
    Jsp Codes
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean id="myBean1" scope="application" class="Beans1.Bean1" />
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId" >
       <hbj:textView id = "ll" text="lalalalalalalalalasasa" />
      <%--
    <hbj:textView id = "l">
                   <% l.setName(myBean1.getName());%>
    </hbj:textView>
    --%>
    <hbj:textView
                    id="appraisal_yr_label"
                    text="Apprasial Year:">
                    </hbj:textView>
                    <hbj:textView id = "la" >
                    <% la.setText(myBean1.getName());%>
                    </hbj:textView>
       </hbj:form>
      </hbj:page>
    </hbj:content>
    Beans1.java
    package Beans1;
    import java.io.Serializable;
    public class Bean1 implements Serializable{
    private String name = new String();
    private String e = new String();
    private String year = new String();
         public void setName(String name){
              this.name = name;
         public String getName(){
              return name;
    JSPDynPage
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
    import Beans1.Bean1;
    import com.sapportals.htmlb.*;
    import com.sapportals.htmlb.enum.*;
    import com.sapportals.htmlb.event.*;
    import com.sapportals.htmlb.page.*;
    import com.sapportals.portal.htmlb.page.*;
    import com.sapportals.portal.prt.component.*;
    public class testDBv5 extends PageProcessorComponent {
      public DynPage getPage(){
        return new testDBv5DynPage();
      public static class testDBv5DynPage extends JSPDynPage{
        private Bean1 myBean1= null;
        private String name = new String();
        public void doInitialization(){
              try{
                                  IntitialContext context = new javax.naming.InitialContext();
                                  DataSource dataSource = (DataSource)context.lookup("java:env/jdbc/appDB");
                                  Connection connection = dataSource.getConnection();
                                  Statement stmt = connection.createStatement();
                                  ResultSet rs = stmt.executeQuery("Select AppraisalYear From tblAppraisal Where AppraisalYear='2007'");
                                          while(rs.next()){
                                            year = rs.getString("AppraisalYear");
                                            rs.close();
                                            stmt.close();
                                            connection.close();
                                            return year;
                                       }catch (Exception n){
                                            n.printStackTrace();
              IPortalComponentProfile profile = ((IPortalComponentRequest)getRequest()).getComponentContext().getProfile();
                     Object o = profile.getValue("myBean1");
                     if(o==null || !(o instanceof Bean1)){
                        myBean1 = new Bean1();
                        profile.putValue("myBean1",myBean1);
                     } else {
                          myBean1 = (Bean1) o;
                        Object value = request.getSession().getValue("myBeans1");
                        if (value==null || (value instanceof Bean1)){
                             myBean1 = new Bean1();
                        request.getSession().putValue("myBean1", Object value);
              DataBase cn = new DataBase();
              name = cn.dataBaseConnection();
              myBean1.setName(name);
    //name = "gir";
    //myBean1.setName(name);
    // IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
    //IPortalComponentContext myContext = request.getComponentContext();
    //Bean1 myNameContainer = (Bean1) myContext.getValue("myBean1");
    //myNameContainer.setName(name);
          // fill your bean with data here...
        public void doProcessAfterInput() throws PageException {
        public void doProcessBeforeOutput() throws PageException {
          this.setJspName("testDBv5.jsp");
    //testing purpose
      public static void main (String[] arg){
         testDBv5DynPage ef = new testDBv5DynPage();
               ef.doInitialization();
    Thanks Loads
    Quatre

  • What are the different ways of retrieving data from Oracle8i

    What are the different ways of retrieving data from Oracle8i
    into my HTML page ?
    Is it JDBC and ODBC ?
    Is there any other way ?
    null

    Methods I tried,
    Applet using SQLJ/JDBC with JDBC drivers thin or Oci8,
    Oracle Web Publishing Assistant,
    HTP/HTF PL/SQL packages (if you have OAS 4.0)
    Webserver Generator of Designer 2000 (if you have OAS 4.0)
    Arun (guest) wrote:
    : What are the different ways of retrieving data from Oracle8i
    : into my HTML page ?
    : Is it JDBC and ODBC ?
    : Is there any other way ?
    null

  • Displaying calculated data in JSP pages

    This is a general question about displaying data in JSP pages which has been calculated through ViewObj Routines. I have exposed the methods to the application level however, I want these methods to automatically run on the launch of the page. I can so this with a data action in the struts file. However, I have lots of these methods (all bringing single values of data), it seems inelegant to have 10 data actions or so. What's the best way to expose and show data on a JSP page automatically which has been calculated from the database rows.
    Thanks in advance

    You could convert the vo row to a hash using BeanUtils and then you could do what you want with it programmaticaly to automatically dissplay the lhash values.

  • How to Hightlight the Data in Jsp Page

    How to Hightlight the Data in Jsp Page,
    I am doing doing search page,based on values given search page those are sent to servlet,in servlet based on some conditions if particuler id i am getting then i am redirecting to Respective jsp page with highlight the data from database..
    Thanks in advance...

    "Highlighting data in JSP sounds strange".
    Without looking at your search specific algorithms I feel you are finally going to display a page (HTML content) to user which contains highlighted text. Highlighting is not directly related to server side language you use (JSP, ASP, PHP etc.). This is purely HTML and CSS. However, server side script (such as JSP) should generate HTML content for getting highlight effect.
    Following HTML shows highlighted text using background-color property on span element.
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
      </head>
      <body>
          <p style="font-size:1.1em">This is a long paragraph which contains <span style="background-color: yellow;">highlighted text</span> and non highlighted text.</p>
      </body>
    </html>Thanks,
    Mrityunjoy
    Edited by: mrityunjoy on 14 Jun, 2010 3:30 AM

  • Different ways to download data into a Oracle database

    Apart from the below are there any other ways to download data into an Oracle database ?
    1. Import data using import/export features.
    2. Oracle external tables.
    3. Data Pump
    4. SQL Loader.
    5. PL/SQL => utl_file package.
    6. Oracle SQL developer tool - it was a nice surprise this morning to know that this tool can be used to import data into Oracle database.
    Thanks
    Gony

    I will be able to do that once I complete my transition into an Oracle DBA
    Next Great DBA
    I downloaded oracle to my laptop today.
      I will become the next great DBA.
    No need for education or taking a course,
      I'll use the forum and learn by brute force.
    The guru's won't mind, they know it all
      They are so profound, their ego's enthrall.
    They have it written by steps 1 through 10.
      If I don't get it once, I'll just ask it again.
    I won't write it down, seems simple enough
      After all, I've used Access with SQL and stuff.
    Why you upset? Why you tell me to read?
      I've no time for a manual, No Sir, Indeed!
    Why waste my time with a book or a link,
      I have this forum, no need to think.
    I have no work history, just out of college,
      But I'm smarter than those who are three times my age.
    I'll become certified with an OCP,
      Have you the answers, just give them to me.
    Then we'll be equal just wait and see!
      But, Why are you paid 100K more than me?Edited by: sb92075 on Jul 12, 2009 7:57 AM

  • Is there a way to enter data into a numbers cell on the screen directly, no keypad?

    Is there a way to enter data into a numbers cell on the screen directly, no keypad?
    Using a stylus or finger?

    No. You have to use the built-in keyboard or a bluetooth connected external keyboard.
     Cheers, Tom

  • Is there a way to download data into CSV format?

    Is there a way to download data into CSV format?
    I can't do this using delimiter as ',' because user wants the decimal format in the ','s only.
    Any suggestions?

    go through this link...
    Download CSV file in presentation server through FM GUI_DOWNLOAD
    Re: how to create a CSV file
    type-pools:TRUXS.
    data: begin of itab occurs 0,
          vbeln like vbap-vbeln,
          posnr like vbap-posnr,
          end of itab.
    data:  itab1 type TRUXS_T_TEXT_DATA.
      select vbeln
             posnr
             up to 10 rows
             from vbap
             into table itab.
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = ','
      TABLES
        I_TAB_SAP_DATA             = itab
    CHANGING
       I_TAB_CONVERTED_DATA       =  itab1
    EXCEPTIONS
       CONVERSION_FAILED          = 1
       OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename = 'C:TEMPtest.TXT'
        TABLES
          data_tab = itab1
        EXCEPTIONS
          OTHERS   = 1.

  • Scripts :EMail - gettiing 3 page data into 2 pages

    Hi all,
    I have created the layout using sap script for sales order and  when i see the print preview of sales order i can able to see th 3 pages in the layout in the NACE i have configured it to EMAIL so far i am getting email as per the design.
    Problem is that when  i click on print preview of email i can able to see all 3 pages of data  into 2 pages. half of second page data is displayed in first page which is not supposed to get on 2 pages , it should be displayed in 3 pages only.
    please help me out.
    Regards
    Venkat Boddu

    I dont think it will work....because as you said, it has wave type vector across all 5 pages then it is a single object which is not going to divide or split when moving pages.
    you have to manually divide the vector art in five section, put them on 5 pages ....and then when you will move the pages then artwork will move along the page.

  • Is there a way to retrieve data from a water damaged ipod?

    my ipod got water on the inside, and it wont charge. when i plug it in, the image shows it as charging but its not. im guessing that there is a short circuit, do to he water. is there a way to retrieve data from my ipod?

    http://www.google.com/search?client=safari&rls=en&q=svae+data+from+water+damaged +iphone&ie=UTF-8&oe=UTF-8#hl=en&client=safari&rls=en&sa=X&ei=Wwy6TtCXG-n22gX-6t2 8Bw&ved=0CCEQvwUoAQ&q=save+data+from+water+damaged+iphone&spell=1&bav=on.2,or.r_ gc.r_pw.,cf.osb&fp=bd3772843da9910d&biw=1074&bih=704
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • HT3302 is there any way to retrieve data ( photos) in particular from an IPOD TOUCH 4 if it has not been backed up??

    is there any way to retrieve data from an IPOD TOUCH 4 if the device has never been backed up to a computer??

    Only if you used PhotoStream then try getting them (photos only) from your PhotoStream. See that topic of:
    iOS: Importing personal photos and videos from iOS devices to your computer

  • Is there an easier way to insert date into an MS SQL Server database ?

    Is there an easier way to insert date into an MS SQL Server database without using the DateFormat?

    USe a PreparedStatement and then the method setDate (or setTimestamp )
    http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html

  • Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Could u plz help me to find simple example for how to save data file in a spread sheet or any other way in the real time controller for Sbrio 9642 using memory or usb flash memory

    Here are a few Links to a helpful Knowledge Base article and a White Paper that should help you out: http://digital.ni.com/public.nsf/allkb/BBCAD1AB08F1B6BB8625741F0082C2AF and http://www.ni.com/white-paper/10435/en/ . The methods for File IO in Real Time are the same for all of the Real Time Targets. The White Paper has best practices for the File IO and goes over how to do it. 
    Alex D
    Applications Engineer
    National Instruments

  • HT201365 Does Find My iPhone collect data on user whereabouts for Apple or any other third party?

    Does Find My iPhone collect data on user whereabouts for Apple or any other third party?

    Google search produced this article: http://support.apple.com/kb/HT4865

Maybe you are looking for