Need help in writing a .jsp page

Hi Guys,
I am new to JSP. My requirement is " I have a link on my webpage. When the user clicks that link, a HTML page is displayed which has parameters to be entered (for ex: from_date , to_date). When the user clicks the submit button, a jsp page should be displayed in which a query is run to display the output. For example, the user enters the from_date and to_date parameter values to know the employees employed within those dates in their company. The query is "select empname,empno,sal,dept,comm from emp where employed_date between from_date and to_date" . The following should run and display in the jsp page.
How can i write a .jsp to extract the parameters that are entered in the HTML form in to a .jsp and run the query with those parameters to display the output. Help needed in making me write this .jsp for this query.
Help Aprreciated.
Thanks

Hm, your requirements sound like homework assignment from classroom. If so, is itn't better that you find the answer youself? There are plenty of very relevant references for how to use jsp to handle html forms or talk to a rdbms through a jdbc connection. For example, for jsp and html forms, you can google "jsp html forms"; for jsp and sql query, search for "jsp jdbc".
Tell me if this is not helpful.

Similar Messages

  • Need help on sharing a jsp page between clients?

    Hi,
    Let me explain this:
    In my jsp application I have two jsp pages that work as a find dialog like applet find dialog.One of those shows the columns from rowset(which user can enter the criteria ) and the other gets the values from first one, makes the sql query and execute the query against the rowset and retrieve the data. There is no pure servlet, both are jsp pages.
    This application is deployed on AS9i-oc4j.
    Problem is : When this find dialog is working for a client. The other client could not load this find dialog until the work for the first one be done. I mean only one client could load and fire the sql statement via this jsp pages(find dialog) at the same time. Which is not acceptable in web applications. Seems only one instance of these pages created by oc4j . if I am right on this then
    Question is : Why oc4j doesn’t create the number of instances based on the number of clients that call these pages? Did I miss something. Or any property in Application module need to be set?
    I would appreciate to share me your idea on this.
    Thanks.

    In my primary mind maybe the bottleneck is where the execution of rowset happens. Since that portion of code takes time to retrieve data for business components. If this is the case then Is this problem goes away if I define a thread for this portion of code?
    Thanks in advance for any idea.

  • Some dummies need help in master detail jsp page

    We don't know how to use data control to generate a jsp master detail page in case of many-to-many relationships. We didn't find any info about this and our testcase never display the data of the last iterator.
    We have
    a collection that contains department object.
    a collection that contains the relationship between department and employee (the many-to-many relationship)
    an object that represent the employee
    The structure is correct in the data control.
    We are able the create our page for both first and second collection but it is not possible to display the detail of the corresponding employee in the detail table. When the table is generated from this level no data is displayed.
    Is it somewhere described how to solve such problem ?
    Does somebody know how to do ?

    Hm, your requirements sound like homework assignment from classroom. If so, is itn't better that you find the answer youself? There are plenty of very relevant references for how to use jsp to handle html forms or talk to a rdbms through a jdbc connection. For example, for jsp and html forms, you can google "jsp html forms"; for jsp and sql query, search for "jsp jdbc".
    Tell me if this is not helpful.

  • Need help using JSTL on JSP pages

    Kindly let me know what should be done in order to get the following JSP to work:
    <jsp:useBean id="subtypes" class="com.jsptest.Code.Subtypes"/>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr>
                   <td width="15%" valign="top" align="center" bgcolor="#009999"><table width="149" border="0" cellpadding="0" cellspacing="0" bgcolor="#009999">
                            <tr>
                                 <th scope="row"> </th>
                               </tr>
                               <c:forEach var="val" items="${subtypes.allSubtypesDescriptions[0]}" varStatus="status">
                               <tr>
                                    <th width="117" scope="row"><a href="/jspteste/testpage3.jsp?subtypeDesc=<c:out value="${val}"/>>"><font face="Courier New, Courier, monospace"><c:out value="${val}"/></font></a></th>
                             </tr>
                             <tr>
                                  <th>----</th>
                             </tr>
                             </c:forEach>
                               <tr>
                                 <th scope="row"> </th>
                               </tr>
                        </table>
              </td>
    </table>I keeps giving me the following error:
    exception
    org.apache.jasper.JasperException: org.apache.jasper.el.JspPropertyNotFoundException: /testjstl.jsp(32,7) '${subtypes.allSubtypesDescriptions[0]}' Property 'allSubtypesDescriptions' not found on type com.jsptest.Code.Subtypes
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    root cause
    org.apache.jasper.el.JspPropertyNotFoundException: /testjstl.jsp(32,7) '${subtypes.allSubtypesDescriptions[0]}' Property 'allSubtypesDescriptions' not found on type com.jsptest.Code.Subtypes
         org.apache.jasper.el.JspValueExpression.getValue(JspValueExpression.java:104)
         org.apache.jsp.testjstl_jsp._jspx_meth_c_005fforEach_005f0(testjstl_jsp.java:199)
         org.apache.jsp.testjstl_jsp._jspService(testjstl_jsp.java:119)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    The Subtypes class is above:
    import com.jsptest.dbAccess.DbConnection;
    public class Subtypes extends DbConnection{
         private char[] categoryCode;
         private char[] subtypeCode;
         private String subtypeDescription;
         private String[][] allSubtypesDescriptions;
         public void setCategoryCode(char[] categoryCode){
              this.categoryCode  = categoryCode;
         public void setSubtypeCode(char[] subtypeCode){
              this.subtypeCode = subtypeCode;
         public void setSubtypeDescription(String subtypeDescription){
              this.subtypeDescription = subtypeDescription;
         public char[] getSubtypeCode(){
              String sqlStmt;
              sqlStmt = "SELECT category_subtype FROM category_subtypes WHERE subtype_description =\'" + subtypeDescription + "\'";
              subtypeCode = pullSingleStringRecord(sqlStmt).toCharArray();
              return subtypeCode;
         public char[] getCategoryCode(){
              String sqlStmt;
              sqlStmt = "SELECT category_code FROM category_subtypes WHERE subtype_description = \'" + subtypeDescription + "\'";
              categoryCode =  pullSingleStringRecord(sqlStmt).toCharArray();
              return categoryCode;
         public String[][] getAllSubtypeDescriptions(){
              String sqlStmt;
              sqlStmt = "SELECT subtype_description FROM category_subtypes ORDER BY subtype_description";
              allSubtypesDescriptions = pullAllRecordsAsString(sqlStmt);
              return allSubtypesDescriptions;
    }Appreciate your inputs.
    T. San.

    You are calling ${subtypes.allSubtypesDescriptions[0]} and not ${subtypes.allSubtypeDescriptions[0]}
    note the difference in your method name and your variable name.
    m

  • Need help in writing data from JSP to excel

    Hi ,
    I need help in writing the data from JSP to excel.I somehow able to retrieve the data into excel but unable to get the required format.
    For eg: The amount should be displayed in 0.00 format .when i am exporting it to excel it is displaying as 0 :( .
    I am using the following code in JSP.
    "out.print(amt + '\t');"
    Would like to know if there is any otherway where in i can get my requirement.
    Thanks
    Tom

    Hi,
    Try using format part of the JSTL tag libs.
    Syntax :
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <fmt:formatNumber value="40" pattern="$#,##0.00"/>
    I need help in writing the data from JSP to excel.I
    somehow able to retrieve the data into excelHow do u convert the jsp to excel?
    One way to convert the jsp page to excel, is to render it as an excel appl instead of html. Set the content type of the response to application/ms-excel.
    response.setContentType("application/ms-excel")Hope this Helps....

  • Need help accessing the router web page.  I have been tol...

    Need help accessing the router web page.  I have been told my router is acting like a switch and the IP address is not in the proper range.  I have tried reseting the router (hold for 30 sec and unplug for 5 mins).  Didn't work.
    thanks

    What router are you using?  Almost all Linksys routers use 192.168.1.1 as the default local IP address, but there is at least one that uses 192.168.16.1 , namely the WTR54GS  (not the WRT54GS).
    You need to try again to reset the router to factory defaults.
    To reset your router to factory defaults, use the following procedure:
    1) Power down all computers, the router, and the modem, and unplug them from the wall.
    2) Disconnect all wires from the router.
    3) Power up the router and allow it to fully boot (1-2 minutes).
    4) Press and hold the reset button for 30 seconds, then release it, then let the router reset and reboot (2-3 minutes).
    5) Power down the router.
    6) Connect one computer by wire to port 1 on the router (NOT to the internet port).
    7) Power up the router and allow it to fully boot (1-2 minutes).
    8) Power up the computer (if the computer has a wireless card, make sure it is off).
    9) Try to ping the router. To do this, click the "Start" button > All Programs > Accessories > Command Prompt. A black DOS box will appear. Enter the following: "ping 192.168.1.1" (no quotes), and hit the Enter key. You will see 3 or 4 lines that start either with "Reply from ... " or "Request timed out." If you see "Reply from ...", your computer has found your router.
    10) Open your browser and point it to 192.168.1.1. This will take you to your router's login page. Leave the user name blank (note: a few Linksys routers have a default user name of "admin" (with no quotes)), and in the password field, enter "admin" (with no quotes). This will take you to your router setup page. Note the version number of your firmware (usually listed near upper right corner of screen). Exit your browser.
    If you get this far without problems, try the setup disk (or setup the router manually, if you prefer), and see if you can get your router setup and working.
    If you cannot get "Reply from ..." in step 9 above, your router is dead.
    If you get a reply in step 9, but cannot complete step 10, then either your router is dead or the firmware is corrupt. In this case, use the Linksys tftp.exe program to try to reload your router with the latest firmware. After reloading the firmware, repeat the above procedure starting with step 1.
    If you need additional help, please state your ISP, the make and model of your modem, your router's firmware version, and the results of steps 9 and 10. Also, if you get any error messages, copy them exactly and report back.
    Please let me know how things turn out for you.
    Message Edited by toomanydonuts on 01-21-2008 04:40 AM

  • Need help for writing extract program

    hi
    i need help for writing extract program to retriew data from legacy system.
    i already developed bdc programs for me31k and me21.
    my requirement is to write extract program s for those t.codes.
    to retriew data from legacy system and stored in flat file.

    i need help with a java program. it is a program that allows the user to enter a student's GPA, number of extracurricular activities, and number of service activities. The user can not enter a gpa above 4.0 or below 0. The user can not enter a negative number for the number of both activities. If the student meets the following criteria: 1) GPA of 3.8 or above and at least one extracurricular activity and one service activity, 2) GPA below 3.8 but at least 3.4 and a total of at least three extracurricular and service activities, 3) GPA below 3.4 but at least 3.0 and at least two extracurricular activities and three service activities, the message "Scholarship candidate" should display. If the student does not meet the criteria above, then the message"not a candidate" should display. Can you help me, please?
    You haven't posted ANY 'java program' for us to help with.
    The forum is NOT a coding service. It is to help you with YOUR code.
    Post the code you have written and SHOW us (don't just tell us) how you compile it and execute it and the results you get. Then we can help you with any problems you are are having.
    If you need help understanding just what the program should be doing you need to ask your instructor to clarify the assignment.

  • Any body help me in writing a JSP page

    I want to write a JSP page through which i can store the downloaded file in to client machine please help me fast

    Hi,
    Thanks, My question i can't do that thing by using a JSP file, I am not getting that any body can give me the code for a JSP file. I am not getting by using this code-------
    s1=request.getParameter("text");
    URL url = new URL("s1");
    URLConnection connection = url.openConnection();
    InputStream stream = connection.getInputStream();
    BufferedInputStream in = new BufferedInputStream(stream);
    FileOutputStream file = new FileOutputStream("result.txt");
    BufferedOutputStream os = new BufferedOutputStream(file);
    int i;
    while ((i = in.read()) != -1) {
    os.write(i);
    Its giving some Internal error
    When I am specifying some url like "http://www.sun.com" in the place of s1 its not showing any error but its not opening that page.
    Pleaseeeeeeeee give me some solution for this
    Thanks In advance

  • Help needed..Unable to acess JSP page..

              Hai!
              I started Admin Server and Managed Server. When i tried to acess jsp page that
              is deployed in the default webapplication of Managed server , In the log file
              of Managed Server It is adding AdminServer to the Client list and application
              hangs(Nothing will be displayed in browser..Neither error message nor Desired
              page ). I am wondering why this is happening as Admin server is neither participating
              in a cluster nor is the Target for default webapplication of Managed server .
              Any help?
              TIA
              Rgds
              Manohar
              

    First check whether a simple jsp file with just "Hello World" is running or not.
    If it is running than my guess is that the library you are importing in JSP is not getting imported.
    This could be because your library is not in your classpath when you are deploying the application, check that in you ear file, WEB-INF/lib folder for this.
    Basically you will try several things out to get to source of error.
    all the best.

  • Need Help in writing a UDF

    Hi,
    Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
    The fields are like this:
    1)         batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
    2)         lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
    3)        How to use JDBC connection factory class in the UDF.
    Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
    Thanks in Advance,
    Sreedhar.

    Hi,
    Following with my query I've tried to use this code but still I'm unable to execute the mapping.
    import java.util.*;
    import com.sap.aii.mapping.lookup.*;
    import com.sap.aii.mapping.lookup.*;
    DataBaseAccessor accessor = null;
    DataBaseResult JDBCOutPayload = null;
    String BusinessSystem="clarify_dev_bizsys";
    //give your business system having channel name
    String CommunicationChannel="JDBC_TO_CDEV";
    //give your channel name
    String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
    //give your sql query
    try {
    Channel channel =
    LookupService.getChannel(BusinessSystem,CommunicationChannel);
    accessor = LookupService.getDataBaseAccessor(channel);     
    DataBaseResult resultSet = accessor.execute(InputPayload);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){  
         Map rowMap = (Map)rows.next();
         Object cValue = rowMap.get("batchno");
    //field name of field required , as in database
          catch (Exception e) {}
          finally {
                  if (accessor != null)
                  accessor.close();
           result.addValue((String)cValue);
    --> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
    --> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
    Kindly help me how to resolve this query of mine.
    Thanks in Advance.
    Sreedhar.

  • Please help me with the jsp page

    Hi,
    I have a parent jsp page. I have a button in that page. If I click the button in the parent page, a child page will be opened which consists of huge data. I have set an option such that if I click the jsp page it asks to open directly or save so as to edit the data in MSWORD format. The child page has a print button at the end of the page which prints all the data. But since the data is very vast I want page breaks at certain places so that when I edit the data and click print button it prints the data with page breaks at certain points. I know that in MSWORD we have page breaks. But I should not do it manually as there would be thousands and thousands of pages to be printed.
    ANY IDEA OR HELP IN THIS MATTER IS GREATLY APPRECIATED. I HAVE BEEN TRYING TO SOLVE THIS MATTER AND POSTED IN MANY SITES. BUT NOBODY RESPONDED. ATLEAST PLEASE LET ME KNOW IF THE IDEA WHICH I MENTIONED IS WORNG OR NOT.
    THANKYOU
    MOUNTAINEER

    use java report?

  • URGENT: Need help reading URL of current page

    Hello kind people!
    I need help, and its very simple:
    How do i read the URL of a web page?
    For example, the URL of this page is:
    http://forums.sun.com/thread.jspa?threadID=5327796
    So how can i be able to read in this URL in my java program?
    thanks SO MUCH
    P.S. I HAVE searched the java docs and everything, the closest thing i found was request.getRequestURL().? but i have no idea how to use it. you have NO IDEA how appreciative i would be if you could simply show me exactly how to read in the URL of a given page.
    thanks SO MUCH
    Edited by: homegrownpeas on Aug 31, 2008 5:19 PM

    Going by what I understand here is a simple version of how you can read data from over HTTP.
    This expects the "page" to be text (hence an InputStreamReader instead of an InputStream.)
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStreamWriter;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.HashMap;
    * GPLv2.
    * @author karlm816
    public class HomeGrownPeas {
          * @param args
         public static void main(String[] args) {
              HashMap<String, String> params = new HashMap<String, String>();
              params.put("threadID", "5327796");
              System.out.println(loadHttpPage("http://forums.sun.com/thread.jspa", params));     
         public static String loadHttpPage(String sUrl, HashMap<String, String> params) {
              // Build the HTTP request string
              StringBuilder sb = new StringBuilder();
              if (params != null) {
                   for (String key : params.keySet()) {
                        if (sb.length() > 0) {
                             sb.append("&");
                        sb.append(key);
                        sb.append("=");
                        sb.append(params.get(key));
              System.out.println("params: " + sb.toString());
              try {
                   URL url = new URL(sUrl);
                   URLConnection connection = url.openConnection();
                   connection.setDoOutput(true);
                   connection.setRequestProperty("Content-Length", "" + sb.length());
                   connection.setUseCaches(false);
                   if (connection instanceof HttpURLConnection) {
                        HttpURLConnection conn = (HttpURLConnection) connection;
                        conn.setRequestMethod("POST");
                   OutputStreamWriter osw = new OutputStreamWriter(connection.getOutputStream());
                   osw.write(sb.toString());
                   osw.close();
                   // Now use sb to hold the resutls from the request
                   sb = new StringBuilder();
                   BufferedReader in = new BufferedReader(
                         new InputStreamReader(
                         connection.getInputStream()));
                   String s;
                   while ((s = in.readLine()) != null) {
                        sb.append(s);
                        // To make it more "human readable"
                        sb.append("\n");
                   in.close();
             } catch (IOException e) {
                  e.printStackTrace();
                  return null;
            return sb.toString();
    }

  • I have a godaddy website with a welcome page- I need help adding a few additional pages with a hyperlink to my welcome page.

    I need help attaching a few hyperlinks my godaddy welcome page. I have 2 more ipages articles, I also converted them to pdf. Godaddy only helped (last year) with the 1st article.  I do not know how to attach a hyperlink to the artlcles and add the hyperlinks to my welcome page.

    The program is called Pages not iPages. Just let us know if you do not speak English and what language you do speak so we can adjust for that.
    The issues are to do with your web page not with Pages.
    I think you are asking how to link from your web page to your pdf articles. You must first copy those pdfs to your web server, or some other web location, and then provide html links on your welcome page to those pdf files.
    The pdfs themselves may contain links to other locations but I can not see that that is what you are asking for.
    Nor to what those links would be to.
    From your heading I think you may have confused the name of Pages, the word processing program, with web pages which are two different things.
    Peter

  • Need helping in writing query for finding percentage of duration

    Can any one please help in writing query for this.
    The table is like this :-
    ID     Region     Month     Duration
    I1 R1     Jan     80
    I2     R2     Jan     70
    I3     R1     Jan     70
    I4     R3     Jan     40
    I5     R1     Feb     80
    I6     R2     Feb     30
    I7     R3     Mar     100
    I want to write a query to find
    % of duration for each and every region against each and every month.
    Please help in solving this query. I am in urgent need of this.
    Thanks in advance.

    I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
    Nicolas.

  • Need help on Oracle APEX- Retaining Page items of one Session in another

    Hi,
    I am creating an apex application in which there exist two pages. Out of 2 pages, I need to provide authentication on one page and no authentication on the other one.
    When I access the first page by public, I must pass some page items to the second page. Since, I have aunthentication on page 2, there will be a new session created and I could not retain the page items that are passed from Page 1 to Page2.
    Please help me in retaining the page item values of Page1 in Page2.
    Thanks for your help.

    Hi Andy,
    I have passed the values from page 2 to page 3. Due to Authentication on Page 3, the passed values are cleared and a new session created.
    Is there a way to retain the item values using Application items or Application computations?
    Please help.
    Thanks,
    Hanu.

Maybe you are looking for

  • App.opendoc does not display security warning window like e.g. "open a file" function?

    When I link from one PDF to the other via "open a file" function (both PDFs are located in %userprofile%/mydocuments directory), Reader X and XI open a security warning box. If I agree to open the target file, this specific file always opens without

  • Place multiple columns (from a word doc) in a document?

    Hello, I am trying to place a word document with three columns of text in an indesign document. I tried changing the settings to "three columns" but that didn't help, the document shows up as one long column that of course runs off the bottom of the

  • Byte[] Arrays in CMP Entity bean

    Hello One of my fields for a CMP Entity beans is a byte[] Array. When i do a home.create(primarykey, byteData) i get an exception saying - "Trying to insert a null in a non-nullable column" My data is not a null at that point. If i change the byte[]

  • WSS version in JDeveloper 10.1.3.3

    What is the version of WSS (Web Service Security) that is supported in JDeveloper 10.1.3.3? Thanks

  • Inserting flv's into a PDF

    The way I see it, the non-answer to this question (see below) could be because of many reasons; it was such a stupid question that no-one sees it as necessary to answer, or maybe it is a known problem that Adobe does not want to be reminded of, for e