Help regarding a simple JSP file and servlet file

Hi all,
I am trying to develop a web based application using Tomca 5.0.16.I wanted to get to know how a simple jsp page could access a servlet.It would be really very beneficial if if any one can give me a sample code that does the interactions,I could run it and understand it,would help me for further development.
Any help would be appreciated
Thanks
AS

I think it depends on how you want to access the servlet.
You can forward or redirect from the JSP page to the servlet, thus making it like you went to the servlet directly from the browser (except of course, before the forward or redirect, some stuff can be done).
You can use URLConnection objects to call the servlet, much like the browser does.
It depends on what you are trying to do.

Similar Messages

  • Help running a simple jsp file,Tomcat 5.0.16

    Hi,
    This question may be addressed many many times,but do reply.
    I have a Win xp operating system
    Installed Tomcat 5.0.16 in it.
    Next the directory structure
    PS : The sampleapp directory is outside the tomcat installation directory.
    E:/sampleapp
    | |
    ROOT WEB-INF
    |
    classes
    |
    <package1><structure> .class files (for servlet works fine!!!!)
    in the WEB-INF,there is the web.xml,then sourcefiles<dir> and the lib directory which is empty.
    Now the servlet files work fine.........
    I have placed my MyJsp.jsp file in the above mentioned ROOT directory.
    I have not done any thing with the <TOMCAT_HOME>/conf/server.xml file
    and the web.xml which I have written.
    When I give the following URI
    http://localhost:8080/sampleapp/MyJsp.jsp,
    I get the HTTP status 404- /MyJsp.jsp
    description: The requested resource (/MyJsp.jsp) is not available.
    Hoping that I have defined the problem specifically.Kindly show some light on this.
    Thanks
    AS

    Nevermind. I just found the answer. For the record, there are two ways in getting JSPs to work:
    1. Precompiling the JSPs and modifying your webapp's web.xml file with the XML fragment generated in YourWebApp/web/WEB-INF/generated_web.xml;
    2. Not precompiling the JSPs, but simply letting tomcat compile it on the fly on first access.
    PRECOMPILATION METHOD
    Go to http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html. Copy-and-paste the ant script under the section "Web Application Compilation" into a file called compile.xml. For me, I save it in ~/development/compile.xml. Then compile the JSPs using the command (all in a single line):
    $ANT_HOME/ant -file <PATH_TO_COMPILE.XML> -Dtomcat.home=<$TOMCAT_HOME> -Dwebapp.path=<$WEBAPP_PATH>
    In my case, I cd into the directory where my app resides:
    cd ~/development/HelloWorld
    and then I type:
    ant -file ~/development/compile.xml -Dtomcat.home=/var/tomcat5 -Dwebapp.path=.
    (Note the trailing dot since my current directory is my webapp's directory itself. Also, in my case, my shell's PATH contains the path to the ant executable, so I just type 'ant' directly.)
    Open the file ~/development/HelloWorld/web/WEB-INF/generated_web.xml and follow the instructions in that auto-generated file, which is: "Place this fragment in the web.xml before all icon, display-name, description, distributable, and context-param elements."
    The web.xml referred to above is YOUR web.xml. In my case, it is the one in ~/development/HelloWorld/web/WEB-INF/web.xml
    When ready to deploy, type:
    ant dist
    as usual. Deploy the .war file in the dist directory as you normally would. In my case, I do:
    rm -rf $CATALINA_HOME/webapps/hello* (removes my HelloWorld webapp directory and its war file)
    cp ~/development/HelloWorld/dist/hello.war $CATALINA_HOME/webapps
    and wait for tomcat to unravel the war file. I can then access the JSP page based on whatever the generated_web.xml had specified. In my case, it would be http://localhost:8080/hello/sample.jsp
    NON-PRECOMPILATION METHOD
    Copy tools.jar from the Java JDK into tomcat's common/lib. (I found this only in the error message in tomcat's log file!! Didn't find it anywhere else!!). Do this one time only, then restart tomcat:
    cp $JAVA_HOME/lib/tools.jar $CATALINA_HOME/common/lib
    Restart tomcat.
    Deploy your webapp as usual which will include your JSP files stored under your webapp's 'web' directory. No precompilation of JSPs is required. Then access your JSP pages such as http://localhost:8080/HelloWorld/my-jsp-page.jsp and tomcat will compile it on the fly on first access. The disadvantage is that there will be a slight delay on first access.
    [Note:  I am putting all this down for the record, because it took me MANY HOURS to figure all this out as the info on how to do this is not found clearly in one place!!  Hope this helps others.]
    My next step is to incorporate the contents of compile.xml as mentioned above, into my regular build.xml file.

  • How run the simple .jsp file on 9 i as application server?

    hi,
    i developed simple .jsp file on notepad,the same .jsp file to run in 9ias server?
    how can any one help me or send steps how to do?
    jpullareddy

    Hi,
    Try out these samples...
    http://otn.oracle.com/sample_code/tech/java/jsp/htdocs/jspdemo/OjspReadme.html
    Thanks,
    Rajat

  • Help running a simple jsp (with struts and core -sun- taglibs)

    Hi, could somebody help me with this simple JSP?
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
         pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:c="http://java.sun.com/jsp/jstl/core"
         xmlns:html="http://struts.apache.org/tags-html">
    <head>
         <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    </head>
    <body>
         <html:text property="text">text</html:text>
         <label>hello</label>
         <c:forEach begin="1" end="5">
              <label>inside</label>
         </c:forEach>
    </body>
    </html>When I run it, the c:forEach tag doesn’t work.
    Output shows “text hello inside” instead of desired “text hello inside inside inside inside inside”
    Any hints will be really appreciated.
    Edited by: 792625 on 03-sep-2010 0:15

    Add the JSTL Core tag library.
    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>

  • Need some help with Slow Downs in Java3D and Servlets

    Hi,
    I realize that there is a separate forum for Java 3D, but I posted there, and did not get any response. This is kinda the crux of my program, so I would like to invite anybody on this forum with knowledge of Java 3D and servlets to give it a stab. Between this post and that one, there are TWENTY duke dollars up for grabs.
    Thanks.
    http://forum.java.sun.com/thread.jspa?threadID=603198

    Let me have an educated guess.
    You calculated the time elapsed before sending in a server request - and at that point you have you updated timeLastStateChange yet, which means by the time of the next calculation of time elapsed this apparent delay is not counted in, hence the slow down in animation rate.
    Hope this helps~
    Alex Lam S.L.

  • Need help regarding converting text to Lines and Arcs.

    In my program i have text.Lets say the text is JAVA.
    Now i need to group that text(JAVA) in the form of line and arcs.
    Its like organizing lines and arcs and make it looks like a text(JAVA).
    Can we have such a possibilities to do that?
    Please help regarding this!!
    Thanks in Advance.
    Boopathy.

    Have a look at TextLayout class (http://java.sun.com/javase/6/docs/api/java/awt/font/TextLayout.html)
    Graphics2D g = ...;
    Point2D loc = ...;
    Font font = Font.getFont("Helvetica-bold-italic");
    FontRenderContext frc = g.getFontRenderContext();
    TextLayout layout = new TextLayout("This is a string", font, frc);
    Shape shape = layout.getOutline(null);
    Edited by: AlexeyUshakov on Sep 29, 2008 8:46 AM

  • Deployment of simple JSP to Oracle Servlet Engine

    Hi
    Anyone there tried to deploy a simple JSP running against OSE.
    Please advice where can I get more information for this.
    Thanks

    Yes I have tried it with simple examples like data access and calling EJB. In-session EJB calls do not work but if your JSP is deployed in another Oracle JVM like 9iAS then EJB calls work.
    There are two manuals you can refer:
    JSP Developers guide at http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83720/toc.htm
    AND
    Java Tools reference guide at http://technet.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83727/toc.htm
    null

  • Help for not recompiling .jsp files

    Hi,
    We are using sun web server 7.0. We have deployed one application which contains few jsp files.
    everytime when we access login.jsp, it creates login_jsp.clss file in /generated folder..
    if we delete login.jsp file and change settings in web.xml for login_jsp.class and try to access then it shows ,
    error : page cannot be found and i found class file deleted from that path.
    If i try the same in tomcat server, it works fine. so need to know the same settings for sun web server 7.
    Is there any setting available for sun web server admin console for the same...
    Thanks
    Rushi

    check disable dynamic reloading
    http://docs.sun.com/app/docs/doc/819-2634/abxfs?a=view
    also , u can check out our tuning guide
    http://docs.sun.com/app/docs/doc/819-2635/abyed?a=view
    pl. provide feedback on these guides within our product docs wiki
    http://wikis.sun.com/display/WebServer/Sun+Java+System+Web+Server

  • Need help regarding image scanning from scanner and resizing it...

    Hi,
    I need help regarding scanning of image directly from scanner. Here is the scenario when the person clicks scan button on the webpage should scan the image and resize it and store it in some temp location. Is there any way i can do this. Any Help regarding this would be great!!!
    Thanks,
    Avinash.
    Edited by: Kalakonda on Jul 24, 2009 8:08 AM

    Kalakonda wrote:
    I need help regarding scanning of image directly from scanner. Here is the scenario when the person clicks scan button on the webpage should scan the image and resize it and store it in some temp location. Is there any way i can do this. Any Help regarding this would be great!!!So what you are doing is you have a Scanner (hardware: like an HP flatbed scanner) attached to a server that you want to use as a scanning station? Is this the senario that you are talking about?

  • Need Help regarding a simple mobile application

    Hello friends,
    I am bit newbee to J2ME technology.
    I have basic understanding about MIDLETS.
    Friends,i am designing an instant messenger using midlet.
    Could anyone send some idea's of how to design a CHAT application.IF some one can give a small code of implementing it could be really helpful....
    Looking for your help!!!
    Thanks In Advance !!!
    Regards,
    RAHUL

    You have been no help but I will post again hoping someone else can reply....
    Here is a more exact detailing of what I am trying to do:
    I am hosting a text file here:
    http://www.geocities.com/biocx/entertainer.txt
    And when I open up MMAPI Demo and go to simple player, and then URL and paste this in, it plays the simple rtttl/midi file. It is doing this through RingToneConverter.
    Now all I want to do, and this is the part I need help with, is while it is playing, I want the notes to be displayed on screen. Can anyone help me with this! I have tried and every time is gives me a problem saying that the RingToneConverter Class isn't abstract and I cannot print to screen...
    If someone could help me with this, it would be greatly appreciated.
    Thank you,
    Mike

  • Help regarding uploading an xml file

    Hi All
    I have to upload data from an xml file.
    I guess the function module SMUM_XML_PARSE can be used for achieving this. But can anybody please tell me the exact procedure to use this function module.
    The program is going for a dump showing a CALL_FUNCTION_CONFLICT_TYPE error.
    The code is as follows
    data: stab like smum_xmltb occurs 0 with header line.
    data: ret1 like bapiret2 occurs 0.
          call function 'SMUM_XML_PARSE'
            exporting
              xml_input       = 'C:TEST.XML'
            tables
              xml_table       = stab
              return          = ret1
    loop at stab.
      write:/ stab-hier,stab-type.
    endloop.
    Thanks in advance
    Sree Ramya

    hii
    as for fm
    CALL FUNCTION 'SMUM_XML_PARSE'
    EXPORTING
    XML_INPUT = inputstring
    TABLES
    XML_TABLE = xmltab
    RETURN = ZBAPIRET2.
    This function module converts yr xml file i.e. in inputstring into zmltab table. Then U can loop on table to check the content.
    go thru this link
    http://www.geocities.com/victorav15/sapr3/abapfun.html#xml
    and also refer the example
    check this code
    1. Convert internal table to XML.
    Here is a sample program to convert internal table to XML
    *& Report ZTESTXML *
    Report ZPRUEBA_MML_13 *
    Export an internal table to XML document *
    NO BORRAR ESTE CODIGO *
    report zprueba_mml_13.
    PANTALLA SELECCION *
    parameters: gk_ruta type rlgrap-filename.
    PANTALLA SELECCION *
    TYPE TURNOS *
    types: begin of turnos,
    lu like t552a-tpr01,
    ma like t552a-tpr01,
    mi like t552a-tpr01,
    ju like t552a-tpr01,
    vi like t552a-tpr01,
    sa like t552a-tpr01,
    do like t552a-tpr01,
    end of turnos.
    TYPE TURNOS *
    TYPE SOCIO *
    types: begin of socio,
    numero like pernr-pernr,
    reposicion like pa0050-zauve,
    nombre like pa0002-vorna,
    turnos type turnos,
    end of socio.
    TYPE SOCIO *
    ESTRUCTURA ACCESOS *
    data: begin of accesos occurs 0,
    socio type socio,
    end of accesos.
    ESTRUCTURA ACCESOS *
    START OF SELECTION *
    start-of-selection.
    perform llena_accesos.
    perform descarga_xml.
    end-of-selection.
    END OF SELECTION *
    FORM LLENA_ACCESOS *
    form llena_accesos.
    refresh accesos.
    clear accesos.
    move: '45050' to accesos-socio-numero,
    'MOISES MORENO' to accesos-socio-nombre,
    '0' to accesos-socio-reposicion,
    'T1' to accesos-socio-turnos-lu,
    'T2' to accesos-socio-turnos-ma,
    'T3' to accesos-socio-turnos-mi,
    'T4' to accesos-socio-turnos-ju,
    'T5' to accesos-socio-turnos-vi,
    'T6' to accesos-socio-turnos-sa,
    'T7' to accesos-socio-turnos-do.
    append accesos.
    clear accesos.
    move: '45051' to accesos-socio-numero,
    'RUTH PEÑA' to accesos-socio-nombre,
    '0' to accesos-socio-reposicion,
    'T1' to accesos-socio-turnos-lu,
    'T2' to accesos-socio-turnos-ma,
    'T3' to accesos-socio-turnos-mi,
    'T4' to accesos-socio-turnos-ju,
    'T5' to accesos-socio-turnos-vi,
    'T6' to accesos-socio-turnos-sa,
    'T7' to accesos-socio-turnos-do.
    append accesos.
    endform. "LLENA_ACCESOS
    FORM LLENA_ACCESOS *
    FORM DESCARGA_XML *
    form descarga_xml.
    data: l_dom type ref to if_ixml_element,
    m_document type ref to if_ixml_document,
    g_ixml type ref to if_ixml,
    w_string type xstring,
    w_size type i,
    w_result type i,
    w_line type string,
    it_xml type dcxmllines,
    s_xml like line of it_xml,
    w_rc like sy-subrc.
    data: xml type dcxmllines.
    data: rc type sy-subrc,
    begin of xml_tab occurs 0,
    d like line of xml,
    end of xml_tab.
    class cl_ixml definition load.
    g_ixml = cl_ixml=>create( ).
    check not g_ixml is initial.
    m_document = g_ixml->create_document( ).
    check not m_document is initial.
    write: / 'Converting DATA TO DOM 1:'.
    call function 'SDIXML_DATA_TO_DOM'
    exporting
    name = 'ACCESOS'
    dataobject = accesos[]
    importing
    data_as_dom = l_dom
    changing
    document = m_document
    exceptions
    illegal_name = 1
    others = 2.
    if sy-subrc = 0.
    write 'Ok'.
    else.
    write: 'Err =',
    sy-subrc.
    endif.
    check not l_dom is initial.
    w_rc = m_document->append_child( new_child = l_dom ).
    if w_rc is initial.
    write 'Ok'.
    else.
    write: 'Err =',
    w_rc.
    endif.
    call function 'SDIXML_DOM_TO_XML'
    exporting
    document = m_document
    importing
    xml_as_string = w_string
    size = w_size
    tables
    xml_as_table = it_xml
    exceptions
    no_document = 1
    others = 2.
    if sy-subrc = 0.
    write 'Ok'.
    else.
    write: 'Err =',
    sy-subrc.
    endif.
    loop at it_xml into xml_tab-d.
    append xml_tab.
    endloop.
    call function 'WS_DOWNLOAD'
    exporting
    bin_filesize = w_size
    filename = gk_ruta
    filetype = 'BIN'
    tables
    data_tab = xml_tab
    exceptions
    others = 10.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    endform. "DESCARGA_XML
    FORM DESCARGA_XML *
    2. To convert XML to internal table.
    You can use these function modules
    TEXT_CONVERT_XML_TO_SAP or
    SDIXML_DOM_TO_XML Convert DOM (XML) into string of bytes that can be downloaded to PC or application server
    or
    SMUM_XML_PARSE (Parse XML docment into a table structure)
    You can also refer to these:
    SMUM_XML_CREATE (Create XML document from internal table)
    SMUM_XML_CREATE_X (Create XSTRING xml doc)
    Check this code, it converts an XML data into a string internal table.
    REPORT Z_XML_TO_TABLE.
    TYPE-POOLS: ixml.
    TYPES: BEGIN OF t_xml_line,
    data(256) TYPE x,
    END OF t_xml_line.
    DATA: l_ixml TYPE REF TO if_ixml,
    l_streamfactory TYPE REF TO if_ixml_stream_factory,
    l_parser TYPE REF TO if_ixml_parser,
    l_istream TYPE REF TO if_ixml_istream,
    l_document TYPE REF TO if_ixml_document,
    l_node TYPE REF TO if_ixml_node,
    l_xmldata TYPE string.
    DATA: l_elem TYPE REF TO if_ixml_element,
    l_root_node TYPE REF TO if_ixml_node,
    l_next_node TYPE REF TO if_ixml_node,
    l_name TYPE string,
    l_iterator TYPE REF TO if_ixml_node_iterator.
    DATA: l_xml_table TYPE TABLE OF t_xml_line,
    l_xml_line TYPE t_xml_line,
    l_xml_table_size TYPE i.
    DATA: l_filename TYPE string.
    PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:     emporders_dtd.xml'.
    Validation of XML file: Only DTD included in xml document is supported
    PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
    START-OF-SELECTION.
    Creating the main iXML factory
    l_ixml = cl_ixml=>create( ).
    Creating a stream factory
    l_streamfactory = l_ixml->create_stream_factory( ).
    PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
    wrap the table containing the file into a stream
    l_istream = l_streamfactory->create_istream_itable( table =
    l_xml_table
    size =
    l_xml_table_size ).
    Creating a document
    l_document = l_ixml->create_document( ).
    Create a Parser
    l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
    istream = l_istream
    document = l_document ).
    Validate a document
    IF pa_val EQ 'X'.
    l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    ENDIF.
    Parse the stream
    IF l_parser->parse( ) NE 0.
    IF l_parser->num_errors( ) NE 0.
    DATA: parseerror TYPE REF TO if_ixml_parse_error,
    str TYPE string,
    i TYPE i,
    count TYPE i,
    index TYPE i.
    count = l_parser->num_errors( ).
    WRITE: count, ' parse errors have occured:'.
    index = 0.
    WHILE index < count.
    parseerror = l_parser->get_error( index = index ).
    i = parseerror->get_line( ).
    WRITE: 'line: ', i.
    i = parseerror->get_column( ).
    WRITE: 'column: ', i.
    str = parseerror->get_reason( ).
    WRITE: str.
    index = index + 1.
    ENDWHILE.
    ENDIF.
    ENDIF.
    Process the document
    IF l_parser->is_dom_generating( ) EQ 'X'.
    PERFORM process_dom USING l_document.
    ENDIF.
    *& Form get_xml_table
    FORM get_xml_table CHANGING l_xml_table_size TYPE i
    l_xml_table TYPE STANDARD TABLE.
    Local variable declaration
    DATA: l_len TYPE i,
    l_len2 TYPE i,
    l_tab TYPE tsfixml,
    l_content TYPE string,
    l_str1 TYPE string,
    c_conv TYPE REF TO cl_abap_conv_in_ce,
    l_itab TYPE TABLE OF string.
    l_filename = pa_file.
    upload a file from the client's workstation
    CALL METHOD cl_gui_frontend_services=>gui_upload
    EXPORTING
    filename = l_filename
    filetype = 'BIN'
    IMPORTING
    filelength = l_xml_table_size
    CHANGING
    data_tab = l_xml_table
    EXCEPTIONS
    OTHERS = 19.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Writing the XML document to the screen
    CLEAR l_str1.
    LOOP AT l_xml_table INTO l_xml_line.
    c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
    replacement = space ).
    c_conv->read( IMPORTING data = l_content len = l_len ).
    CONCATENATE l_str1 l_content INTO l_str1.
    ENDLOOP.
    l_str1 = l_str1+0(l_xml_table_size).
    SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
    WRITE: /.
    WRITE: /' XML File'.
    WRITE: /.
    LOOP AT l_itab INTO l_str1.
    REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
    IN
    l_str1 WITH space.
    WRITE: / l_str1.
    ENDLOOP.
    WRITE: /.
    ENDFORM. "get_xml_table
    *& Form process_dom
    FORM process_dom USING document TYPE REF TO if_ixml_document.
    DATA: node TYPE REF TO if_ixml_node,
    iterator TYPE REF TO if_ixml_node_iterator,
    nodemap TYPE REF TO if_ixml_named_node_map,
    attr TYPE REF TO if_ixml_node,
    name TYPE string,
    prefix TYPE string,
    value TYPE string,
    indent TYPE i,
    count TYPE i,
    index TYPE i.
    node ?= document.
    CHECK NOT node IS INITIAL.
    ULINE.
    WRITE: /.
    WRITE: /' DOM-TREE'.
    WRITE: /.
    IF node IS INITIAL. EXIT. ENDIF.
    create a node iterator
    iterator = node->create_iterator( ).
    get current node
    node = iterator->get_next( ).
    loop over all nodes
    WHILE NOT node IS INITIAL.
    indent = node->get_height( ) * 2.
    indent = indent + 20.
    CASE node->get_type( ).
    WHEN if_ixml_node=>co_node_element.
    element node
    name = node->get_name( ).
    nodemap = node->get_attributes( ).
    WRITE: / 'ELEMENT :'.
    WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
    IF NOT nodemap IS INITIAL.
    attributes
    count = nodemap->get_length( ).
    DO count TIMES.
    index = sy-index - 1.
    attr = nodemap->get_item( index ).
    name = attr->get_name( ).
    prefix = attr->get_namespace_prefix( ).
    value = attr->get_value( ).
    WRITE: / 'ATTRIBUTE:'.
    WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
    value COLOR COL_TOTAL INVERSE.
    ENDDO.
    ENDIF.
    WHEN if_ixml_node=>co_node_text OR
    if_ixml_node=>co_node_cdata_section.
    text node
    value = node->get_value( ).
    WRITE: / 'VALUE :'.
    WRITE: AT indent value COLOR COL_GROUP INVERSE.
    ENDCASE.
    advance to next node
    node = iterator->get_next( ).
    ENDWHILE.
    ENDFORM. "process_dom
    Regards
    Naresh

  • Can anyone help regarding the Admin Login page and Normal User Page.

    Hi Friends,
    I have worked on normal login page it has been worked well. But now i have to create the Admin login page. That means, I have written the code in the following way.
    public String userLogin_action() {
            // TODO: Process the button click action. Return value is a navigation
            // case name where null will return to the same page.
            com.sun.sql.rowset.CachedRowSetXImpl crs = new com.sun.sql.rowset.CachedRowSetXImpl();
            String Name =  getUserName().getText().toString();
            String password =  getUserPwd().getText().toString();
             try {
                crs.setDataSourceName("java:comp/env/jdbc/Employee");
                crs.setCommand("SELECT * FROM srni.UserTable");
                crs.setTableName("UserTable");
                crs.execute();
                crs.beforeFirst();
                while(crs.next()){
                info("Cursor is been moving");   
                boolean ok = crs.getBoolean("Admin");
                info("Value of ok:" + ok);
                String Username = (String) crs.getObject("UserName");
                info("Usernames are:" + Username + Name);         
                if(Username.equals(Name)&&(ok)){
                info("Login Successfull");
                java.util.Date Date = new java.util.Date();
                info(" Admin Logged on :" + Date);
                return "toUserPage";
                info("Login Failed or Admin doesn't exist");
            catch (Exception e) {
                error("Login Failed : " + e.getMessage());
            } finally {
                crs.close();
            return null;
        }You can see there that i have used the boolean type of value for verifying wheter the user is admin or not. If the admin type of column in database is true then it must allow the admin to certain page. Otherwise it must not redirect. So i have used this logic. When i am checking it is showing everything true,but it is not redirecting and it is saying that login failed. Please try the above code with a sample database table and verify it. You can see the output like this.
    Cursor is been moving
    Value of ok:true
    Usernames are: srinu srinu //here it must not go to next cursor,because srinu has been identified, but it is not behaving like that.
    Cursor is been moving
    Value of ok:false
    Usernames are: Chandu srinu
    Cursor is been moving
    Value of ok:false
    Usernames are: kirank srinu
    Login Failed or Admin doesn't exist The above output describes that it is moving the cursor from first row to the last row and checking all the usernames i n each row with the given username, and it is also checking wheter it is admin or not. Currently i have three rows so it is moving three times. It is retreiving every value correctly but in comparing it is not comparing. What to do.
    Please help me out from this problem.
    Thanking You in Advance.

    The buttons are all created using the same library object (but MC), except for the code you have in the revised file does not call on that for the con button.
    You have it calling on something with a linkage name of "con", which a quick check tells me doesn't exist--so it is undefined in the code when you try to use it.  I found this by using trace(newConBut._x); after its _x value was assigned, as I mentioned you should try.   So the first thing you want to do is change the following line from...
    var newConBut = _root.attachMovie("con", "conbut", _root.getNextHighestDepth());
    To
    var newConBut = _root.attachMovie("but", "conbut", _root.getNextHighestDepth());
    so that it uses the but MC that serves that purpose in the library.  Then you want to correct the _x assignment of the buttons to what I think you had earlier...
    newConBut._x = 650-newConBut._width;
    newRecBut._x = newConBut._x-newRecBut._width;
    Here is a picture of what those changes do (note, without the XML file I had to finagle things just to work, so the biutton labels aren't what they will be)...

  • Confused, need help regarding a MPG audio file

    I have some video and the sound is not that good however I used my Marantz recorder using a CF card. The quality if very good on the card. The file is 1003.MPG around 250 MB. I have imported my video into Imovie and I thought I could just drag or import this MPG file into the audio and edit. It starts off like it will import and then nothing. I even imported the 1003.MPG file into Itunes hoping I could bring it in through Itunes. No luck. I am not sure what an MPG files but it doesn't appear to be an audio file that I need to import into I movie. When I double click on the file it opens in QT and I can play it there. What am I missing and what do I need to do in order to get it into Imovie so I can match up with video.
    Thanks
    Bob

    Hi SDillini. I looked at your link and saw all the options I should have had. For some reason I have not been able to figure out as of yet it only gave me the two which I listed above. If I would have had all the options which were listed I would have been on easy street. I finally got it converted over, thanks to my son but now I have even a bigger problem. Worked on some video for about 7 hours and Imovie started just shutting down every so often. I would continue to save every 5 minutes. Now the last time it quit I tried to open and the clips showed up but nothing in the timeline. It looks like it wants to start however I get the spinning ball and after about 3 or 4 minutes it just shuts down. I have tried to put all the folders linked with that movie into a new Imovie project and I also tried to to import everything in to FCP. All I get is the clips I was not going to use with nothing I have edited going into the timeline or clip file. This has been a very difficult project and due tomorrow. If I can't figure this out fast I will start all over today and make an all nighter out of it. I may try a new post to possibly get some help on new problem.
    Thanks for the info.
    Bob

  • Help regarding how to show total and grand total

    hi all
    please help me to show the total / grand total fund wise
    i m giving final output that i want
    which functions may i use .
    following is my query
    SELECT MUT_NAME , NATURE , BROK_TYPE ,sum(BROKERAGE) brokerage   FROM (
    SELECT MUT_NAME , NATURE , BROK_TYPE ,BROKERAGE  FROM (
      select mf.mut_name , si.nature ,'UPFRONT' BROK_TYPE ,  sum(up1.paid_brok)  BROKERAGE from upfront_paid up , upfront_paid_dtl upd , upfront_pr up1 , scheme_info si , mut_fund mf
      where up.slab_id = upd.slab_id
      and up.SLAB_ID = up1.paid_slab_id
      and up.sch_code = si.sch_code
      and si.mut_code = mf.mut_code
    -- and si.mut_code = 'MF004'
      group by   grouping sets (  (mf.mut_name , si.nature) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
      UNION ALL
      select mf.mut_name , si.nature ,'TRAIL' BROK_TYPE ,   sum(up1.paid_brok)    BROKERAGE  from TRAIL_paid up , TRAIL_paid_dtl upd , TRAIL_pr up1 , scheme_info si , mut_fund mf
      where up.slab_id = upd.slab_id
      and up.SLAB_ID = up1.paid_slab_id
      and up.sch_code = si.sch_code
      and si.mut_code = mf.mut_code
    -- and si.mut_code = 'MF004'
      group by  grouping sets (  (mf.mut_name , si.nature) ) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
    UNION ALL
    SELECT 'TOTAL ' MUT_NAME , ' ' NATURE , ' ' BROK_TYPE ,SUM(BROKERAGE)  FROM (
      select mf.mut_name , si.nature ,'UPFRONT' BROK_TYPE ,  sum(up1.paid_brok)  BROKERAGE
      from upfront_paid up , upfront_paid_dtl upd , upfront_pr up1 , scheme_info si , mut_fund mf
      where up.slab_id = upd.slab_id
      and up.SLAB_ID = up1.paid_slab_id
      and up.sch_code = si.sch_code
      and si.mut_code = mf.mut_code
      --and si.mut_code = 'MF004'
      group by  grouping sets (  (mf.mut_name , si.nature) ) ROLLUP(MF.MUT_NAME,SI.NATURE)
      UNION ALL
      select mf.mut_name , si.nature ,'TRAIL' BROK_TYPE ,   sum(up1.paid_brok)    BROKERAGE  from TRAIL_paid up , TRAIL_paid_dtl upd , TRAIL_pr up1 , scheme_info si , mut_fund mf
      where up.slab_id = upd.slab_id
      and up.SLAB_ID = up1.paid_slab_id
      and up.sch_code = si.sch_code
      and si.mut_code = mf.mut_code
    -- and si.mut_code = 'MF004'
      group by  grouping sets (  (mf.mut_name , si.nature) ) ) ROLLUP(MF.MUT_NAME,SI.NATURE)))
    GROUP BY grouping sets (MUT_NAME),( NATURE ),( BROK_TYPE)
    ORDER BY MUT_NAME , NATURE , BROK_TYPE 
    Sl. No.     Fund House     Fund Type     Brokerage Type     "Type-wise
    Commission "     Gross Commission
    (1)     Fidelity Mutual Fund     Equity     Upfront Commission     xxx     
                   Trail     xxx     
                   Others     xxx     
              Debt     Upfront Commission     xxx     
                   Trail     xxx     
                   Others     xxx     
    T O T A L :                         xxxxx
    (2)     Franklin Templeton Mutual Fund     Equity     Upfront Commission          
                   Trail          
                   Per Form          
                   AUM Linked          
                   SIP Advance Annual Brokerage          
                   Others          
              Debt     Upfront Commission          
                   Trail          
                   Others          
    T O T A L :                         xxxxx
    CONSOLIDATED TOTAL COMMISSION :                         xxxxxany help appriciated.

    how can i use compute in procedure
    actually i am giving the output from query to ref_cursor and from front end ( .NET) they are fetch rows and show the output.
    i want output as fallows
    fund name -- nature --- brok type --- brokerage
    1] fidelity     equity     upfront       2000
                 equity     trail         1000
                 debth      upfront       1500
                 debth      trail         500
      Fidelity                            5000
    2] abc       --                     
    so on hope this clears you
    Message was edited by:
    Pankaj M

  • Create and deploy simple JSP

    Hi,
    I need to create simple JSP pages and deploy it to SAP J2EE engine.. what is the procedure?...I may later add some businness logic but not needed for now.
    Please help
    Thanks,
    Jai

    Hi Jai Paul,
    You would need to have the Netweaver Developer Studio installed. It is the IDE based on eclipse where you can develop applications and deploy onto the server.
    Chk out the following links. It has some tutorials and also explains the entire process of developing & deploying applications onto the portal.
    http://help.sap.com/saphelp_nw70/helpdata/en/83/4baa42cdccda11e10000000a155106/content.htm
    http://help.sap.com/saphelp_nw70/helpdata/en/0d/1e3d41536ff323e10000000a155106/content.htm
    Regards,
    Abhishek

Maybe you are looking for