Assigning javascript varibel value to java variable

Hi all
I want to find screen resolution in one jsp page.That can be done in javascript.
(though 'screen.width and screen.height')
But is there any way to assign that value to java variable.
Any body has the idea?
Help me.

No, why ? becuase jsp is SERVER side
There are workarounds, You can store your javascript values in hidden fields and submit your page with them to your JSP and then use them like that

Similar Messages

  • Assigning javascript varible value to java variable

    Hi all
    I want to find screen resolution in one jsp page.That can be done in javascript.
    (though 'screen.width and screen.height')
    But is there any way to assign that value to java variable.
    Any body has the idea?
    Help me.

    No, why ? becuase jsp is SERVER side
    There are workarounds, You can store your javascript values in hidden fields and submit your page with them to your JSP and then use them like that

  • How to Assign a Field value to a Variable??

    Dear All,
    Kindly let me know, if <b>"HOW TO ASSIGN A FIELD VALUE TO A VARIABLE????"</b>
    Situation is, we have a Field (OBJK-TASER) in which 2 tables (SER01 & SER03) are stored. And we want to access names of the Tables which are there in the field(TASER) in  (OBJK) table  to a variable and then passing that variable to the sql query as a table name to get data accessed dynamicaly.

    try this
    select TASER from OBJK into table it_table.
    loop at it_table.
    select field1 field2 from (it_table-table) into table it_fields.
    endloop

  • Assigning stored procedure output value to java variable

    I have one stored procedure which is having ref cursor as the output parameter.
    How to assign refcursor value to my java variable?

    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    cstmt.execute()
    ResultSet rs = (ResultSet)cstmt.getObject(1);
    ==
    Ashok

  • Passving javascript variable Values to java variable

    I need help from anywone please.
    I created a SELECT object on a jsp. I want to retrive the highlighted element in the list and put this value in a java variable so that I can send the value to another page. How can I achieve this please?

    Alaafiatayo wrote:
    I created a SELECT object on a jsp. I want to retrive the highlighted element in the list and put this value in a java variable so that I can send the value to another page. How can I achieve this please?Your terminology is fairly confusing. Please align the right terminology for yourself.
    As far I understand you want to get the currently selected value of a HTML dropdown element in the server side? Just submit the form to the server and use request.getParameter("nameOfInputElement") where "nameOfInputElement" is the same as <select name="thisName">.
    This is covered by every decent JSP/Servlet tutorial. I recommend you to go through it first before asking this kind of basic questions.

  • Assigning a hex value to a variable and getting binary value of a variable.

    I try to develop java programs and I need to do a conversion unicode to EBCDIC and vice versa.
    How can I assign hex values to variables to build UTF-EBCDIC and EBCDIC-UTF table and get hex or binary value of data to compare it to value of in the table?
    I did a conversion like this with PL/1 before. I do not know how can I do it with Java. Because I am new to Java.
    Thank you in advance.

    I will run java code in mainframe and java uses
    unicode for data in default and mainframe environment
    is EBCDIC. So I have to translate the data from
    unicode to ebcdic.I said I think String supports EBCDIC encoding...
    String ebcdic = new String(ebcdicBytes, "Cp500");
    http://java.sun.com/j2se/1.4.2/docs/guide/intl/encoding.doc.html

  • Assigning long text values to ODI variable

    Hi all,
    I want to store the error message of the previous step in a variable: _<%=odiRef.getPrevStepLog("MESSAGE")%>_ (using ODI 10.1.3.5 on Oracle 9i).
    If I refresh the variable using a statement like Select '<%=odiRef.getPrevStepLog("MESSAGE")%>' From dual , it errors out if the message has more than 4K characters.
    I tried to use _<%=odiRef.getPrevStepLog("MESSAGE").substring(0,3999)%>_ , but this creates an indexoutofbounds exception if the message has less than 4K characters.
    I tried to use assign instead of refresh, but it only prints the jython code instead of retrieving the variable. How can I assign the message to a variable?
    Thanks,
    Matt

    Cezar,
    Here's the operator information. Oracle DB version is 10g EE, Rel. 10.2.0.4.0 - 64bit
    Operator - Description
    select substr('org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 23, in ?
    com.hyperion.odi.essbase.ODIEssbaseException: Cannot build dimension. Analytic Server Error(1090004): Unable To Open File [hypxx/product/essbase/AnalyticServices/app/xxx_PL/xxx_PL/ActCalce.rul]
         at com.hyperion.odi.essbase.ODIEssbaseMetaWriter.loadData(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
         at org.python.core.PyMethod.__call__(PyMethod.java)
         at org.python.core.PyObject.__call__(PyObject.java)
         at org.python.core.PyInstance.invoke(PyInstance.java)
         at org.python.pycode._pyx9.f$0(<string>:23)
         at org.python.pycode._pyx9.call_function(<string>)
         at org.python.core.PyTableCode.call(PyTableCode.java)
         at org.python.core.PyCode.call(PyCode.java)
         at org.python.core.Py.runCode(Py.java)
         at org.python.core.Py.exec(Py.java)
         at org.python.util.PythonInterpreter.exec(PythonInterpreter.java)
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:144)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: com.essbase.api.base.EssException: Cannot build dimension. Analytic Server Error(1090004): Unable To Open File [hypxx/product/essbase/AnalyticServices/app/xxx_PL/xxx_PL/ActCalce.rul]
         at com.essbase.server.framework.EssOrbPluginDirect.ex_olap(Unknown Source)
         at com.essbase.server.framework.EssOrbPluginDirect.essMainBuildDimension(Unknown Source)
         at com.essbase.api.session.EssOrbPlugin._invokeMainMethod(Unknown Source)
         at com.essbase.api.session.EssOrbPlugin._invokeMethod2(Unknown Source)
         at com.essbase.api.session.EssOrbPlugin._invokeMethod(Unknown Source)
         at com.essbase.server.framework.EssOrbPluginDirect._invokeProtected(Unknown Source)
         at com.essbase.api.session.EssOrbPluginEmbedded.invokeMethod(Unknown Source)
         at com.essbase.api.session.EssOrbPluginEmbedded.invokeMethod(Unknown Source)
         at com.essbase.api.session.EssOrbPlugin.essMainBuildDimension(Unknown Source)
         at com.essbase.api.datasource.EssCube.buildDimension(Unknown Source)
         at com.hyperion.odi.essbase.wrapper.EssbaseApplication.buildDimension(Unknown Source)
         ... 32 more
    com.hyperion.odi.essbase.ODIEssbaseException: com.hyperion.odi.essbase.ODIEssbaseException: Cannot build dimension. Analytic Server Error(1090004): Unable To Open File [hypxx/product/essbase/AnalyticServices/app/xxx_PL/xxx_PL/ActCalce.rul]
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:595)
    ', 1, 4000) from dual
    Operator - Execution:
    1704 : 42000 : java.sql.SQLException: ORA-01704: string literal too long
    java.sql.SQLException: ORA-01704: string literal too long
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:503)
         at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:965)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:535)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1051)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2984)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3026)
         at com.sunopsis.sql.SnpsQuery.executeQuery(SnpsQuery.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.execStdOrders(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTaskTrt(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTask(SnpSessTaskSqlV.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.g.y(g.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Thread.java:595)

  • Can one assign a numerical value to a variable?

    Hi All,
    Good afternoon,
    I am currently working on a form that has strings as values in 2 different listboxes, and depending on what is selected a message pops up. Here is the script I wrote, but it does not seem to work right
    var a=aKlaclistbox.raWvalue=="SSK";
    var b=bZlaslistbox.raWvalue=="SGT";
    a.value=1;
    b.value=2;
    if(a > b){
        xfa.host.messagebox("You cannot select a lower officer as the rating officer");
    It does not work, and I am just wondering if there is any way I can get around it so that I can compare the values. I need help from anyone on this forum.
    Thanks
    v/r
    Tammy

    There's probably a better way of doing this, as, depending on how many ranks you have, it could get cumbersome. Like using an array or something like that but not sure how to accomplish that.
    If there are a lot of ranks to compare I think I'd suggest reworking things so that you can use the numeric value of the list box, it will be much easier in the long run.
    As I mentioned above, I don't think the following is valid code:
    var a=aKlaclistbox.raWvalue=="SSK";
    Nor is (unless dealing with global variables):
    a.value=1;
    I think you need to do something like the following (hopefully someone else around here might have a better idea!):
    var a;
    var b;
    if (aKlaclistbox.rawValue == "SSK") {
         a = 1;
    if (bZlaslistbox.rawValue == "SGT") {
         b = 2;
    //You would need a series of else/if with the above to map the different rank values.
    if (a > b) {
       xfa.host.messagebox("You cannot select a lower officer as the rating officer");

  • Assigning cursor select values to local variables

    Hello,
    I am stuck...I need to figure out how to assign the values I"m pulling from my SELECT statement (IN A CURSOR) . Seems easy, and it probably is, but I"m stuck.
    Here's the code. Any help woudl be great!
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total), sum(quantity),to_char(dtordered, 'mon'), to_char(dtordered, 'yyyy'), idproduct
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
    lv_qty bb_basket.quantity%type;
    lv_total bb_basket.total%type;
    lv_month bb_prod_sales.month%type;
    lv_year bb_prod_sales.year%type;
    lv_prodid bb_basketitem.idproduct%type;
    lv_sumqty bb_prod_sales.qty%type;
    lv_sumtotal bb_prod_sales.total%type;
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=lv_prodid,
        month=lv_month,
        year=lv_year,
        qty=lv_sumqty,
        total=lv_sumtotal
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /

    Gah!
    Here's what I have:
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total) total, sum(quantity) quantity,to_char(dtordered, 'mon') month, to_char(dtordered, 'yyyy') year, idproduct product
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=product,
        month=month,
        year=year,
        qty=quantity,
        total=total
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /I've tried in teh UDPATE doing:
    qty=rec_cursor.quantity;
    But that gives the error that rec_cursor.quantity is an invalid identifier.
    Do I need to assign aliases in the INNER SELECT statement as well? I dont' see why...but I'm not seeing this either. :)
    How about this:
    CREATE OR REPLACE PROCEDURE prod_sales_sum_sp
    IS
    CURSOR cur_order
    IS
      SELECT sum(total) total, sum(quantity) quantity,to_char(dtordered, 'mon') month, to_char(dtordered, 'yyyy') year, idproduct product
        FROM (
          SELECT bb_basketitem.quantity, total, dtordered, idproduct
          FROM bb_basket, bb_basketitem
           WHERE bb_Basket.idbasket=bb_Basketitem.idbasket
      GROUP BY idproduct);
      quantity=rec_cursor.quantity;
    BEGIN
    FOR rec_order IN cur_order LOOP
      UPDATE bb_prod_sales
      SET
        idproduct=product,
        month=month,
        year=year,
        qty=quantity,
        total=total
       WHERE lv_prodid=idproduct;
    END LOOP;
    END;
    /Message was edited by:
    horax

  • Error  while assigning resultset value to Querytable variable in Coldfusion 10

    We are upgrading from coldfusion 8 to 10. Internally we were using java function to to get the data.
    In java function we have a resultset object, if we assign this resultset value to Querytable variable, we are getting below error. This code was working fine in coldfusion 8.
    Detail    This exception is usually caused by service startup failure. Check your server configuration.
    Message    The Runtime service is not available.
    StackTrace    coldfusion.server.ServiceFactory$ServiceNotAvailableException: The Runtime service is not available. at coldfusion.server.ServiceFactory.getRuntimeService(ServiceFactory.java:117) at coldfusion.runtime.RequestMonitor.<clinit>(RequestMonitor.java:14) at coldfusion.sql.QueryTable.populate(QueryTable.java:358) at coldfusion.sql.QueryTable.populate(QueryTable.java:283) at coldfusion.sql.QueryTable.<init>(QueryTable.java:96) at com.myCompany.myClass.myFunct(myClass.java:627) at
    Here is the function which is causing error.
    static private QueryTable myFunct(String userId, SessionFactory sf) {
            PreparedStatement pStmt = null;
            ResultSet rs = null;
            QueryTable ret = null;
             try{
                Query q = sf.getCurrentSession().getNamedQuery("ListUsers");
                pStmt = sf.getCurrentSession().connection().prepareStatement(q.getQueryString());
                rs = pStmt.executeQuery();// works fine till here
                ret = new QueryTable(rs);  // error line         
                rs.close();
            }catch(Exception e){
                e.printStackTrace();
                throw new RuntimeException(e.getLocalizedMessage());
            return ret;
    Can you provide some help on this. Please let me know if you need any other details.

    We have found this error is logs
    coldfusion.runtime.Encryptor$InvalidParamsForEncryptionException: An error occurred while trying to encrypt or decrypt your input string: The input and output encodings are not same..
        at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:303)
        at coldfusion.runtime.Encryptor.decrypt(Encryptor.java:284)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5353)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5326)
        at coldfusion.runtime.CFPage.Decrypt(CFPage.java:5458)
        at com.vmware.vcp.service.impl.EncryptColdFusionImpl.decrypt(EncryptColdFusionImpl.java:65)
        at com.vmware.vcp.web.servlet.ApplicationConfigServlet.initEmailService(ApplicationConfigSer vlet.java:119)
        at com.vmware.vcp.web.servlet.ApplicationConfigServlet.init(ApplicationConfigServlet.java:51 )
        at javax.servlet.GenericServlet.init(GenericServlet.java:160)
        at coldfusion.bootstrap.ClassloaderHelper.initServletClass(ClassloaderHelper.java:121)
        at coldfusion.bootstrap.BootstrapServlet.init(BootstrapServlet.java:59)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1266)
        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1185)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1080)
        at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5001)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5278)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)

  • Assigning a value to two variables

    I need to assign the same value to two variables is there a way to do this like in some other languages.
    e.g. I have the following currently:
    l_test := 'valval'
    l_counter := 'valval'
    I want to condense this down into something simpler such as:
    l_test := l_counter := 'valval'
    Is anything like this possible?
    Many thanks in advance.

    Because I need to build up two queries gradually since they depend on situations at runtime i.e. I cannot just write the query in one statement and run it since it is built up gradually based on the application.
    One is to obtain the results of the query and the other is purely to count up the results. The reason I am doing this is because it is more efficient than running two CURSORs which is the current situation.
    This will result in a cursor containg the results to loop through and a value which equals the number of results. Where the variables will have the same added to them is with the WHERE clause, since the conditions don't change just how they are stored changes. i.e. One is CURSOR to loop through and one is a straight value.

  • Assigning strings a value?

    I had another problem with nested if structure, i have tried ever way i could think of possibly to assign the value to a string. hard to explain, example below
    //classCode is input from user
    // classYear is the current year in highschool, i keep on getting errors no matter which way i assign the string!
    i'm trying to figure out how to do this correctly
    If(ClassCode = ("FR") // i know it's not correct, but i have no idea classyear= "Freshman"; // what is? same for this assignmeny!
    If(grdP = 100)
    grade = "A"; // results in a error, i'm real confused

    Try using a switch statement to solve your problem. It'll be cleaner code and easier to read and understand.
    //declare a variable
    int usrInput;
    if( ( usrInput >= 10 ) || ( usrInput <= 1 2) )
    switch(classYear)
    case 10:
    classyear = "Freshman";
    case 11:
    classyear = "Sofmore"; etc.
    Not sure if this will help but here's a project that I worked on for a class and it was assigning a string value to a variable. I used a switch statement (do you know what those are?) to determine which value was selected.
    I know this is a bit long but I think it's easy enough to understand. You will have to determine what value you want to put in your if statement. Switch does not use Strings so you'll have to use an integer to determine what is selected.
    import java.text.NumberFormat;                              // Java core packages
    import java.util.Locale;
    import javax.swing.JOptionPane;                              // Java extension packages
    public class A4_512                                             // begin class definition
                                                                     // main method begins execution
                                                                     // of Java application
         public static void main( String args[] )
              int     counter,                                        // counter variable
                   itmSold,                                        // holds usrInput for product sold as int data type
                   qtySold = 0;                                   // holds usrInput for quantity sold as int data type
         double     itmValue = 0.00,                              // value of item sold
                   totSales = 0.00;                              // total value of items sold
         String     usrInputItm = "",                              // holds usrInput for product sold as int String type
                   usrInputQty = "",                              // holds usrInput for product sold as int String type
                   currDay = "",                                   // String value for current day
                   results = "";                                   // holds output results
                                                                     // Begin counter controlled loop
              for( counter = 0; counter <= 6; counter++ )
                   switch ( counter )                              // Begin switch statement to determine day of the week
                        case 0:
                             currDay = "Sunday";
                             break;
                        case 1:
                             currDay = "Monday";
                             break;
                        case 2:
                             currDay = "Tuesday";
                             break;
                        case 3:
                             currDay = "Wednesday";
                             break;
                        case 4:
                             currDay = "Thursday";
                             break;
                        case 5:
                             currDay = "Friday";
                             break;
                        case 6:
                             currDay = "Saturday";
                             break;
                                                                     // prompt for input and read
                                                                     // product number then convert
                                                                     // data type to integer data type
                   usrInputItm = JOptionPane.showInputDialog(
                        "Please enter a product number purchased on " + currDay + "\n\n Enter 0 to enter data for next day." );
                   itmSold = Integer.parseInt( usrInputItm );
                   while( itmSold != 0 )                         // Begin sentinel control while loop
                                                                     // if statement to determine correct product number entered
                        if( ( itmSold > 5 ) || ( itmSold < 0 ) )
                                                                     // display error message
                             JOptionPane.showMessageDialog ( null, "You must enter product number from 1 through 5.\nPlease try again.",
                                  "Wrong Product Number Error", JOptionPane.ERROR_MESSAGE );
                                                                     // prompt for input and read
                                                                     // product number then convert
                                                                     // data type to integer data type
                             usrInputItm = JOptionPane.showInputDialog(
                                  "Please enter a product number purchased on " + currDay + "\n\n Enter 0 to enter data for next day." );
                             itmSold = Integer.parseInt( usrInputItm );
                        else
                             switch ( itmSold )               // begin switch statement to determine value of itmSold
                                  case 1:
                                       itmValue = 2.98;
                                       break;
                                  case 2:
                                       itmValue = 4.50;
                                       break;
                                  case 3:
                                       itmValue = 9.98;
                                       break;
                                  case 4:
                                       itmValue = 4.49;
                                       break;
                                  case 5:
                                       itmValue = 6.87;
                                       break;
                             }                                        // end switch statement
                                                                     // prompt for input and read
                                                                     // quantity sold then convert
                                                                     // data type to integer data type
                             usrInputQty = JOptionPane.showInputDialog(
                                  "Please enter quantity sold on " + currDay );
                             qtySold = Integer.parseInt( usrInputQty );
                             totSales += itmValue * qtySold;
                                                                     // prompt for input and read
                                                                     // product number then convert
                                                                     // data type to integer data type
                             usrInputItm = JOptionPane.showInputDialog(
                                  "Please enter a product number purchased on " + currDay + "\n\n Enter 0 to enter data for next day." );
                             itmSold = Integer.parseInt( usrInputItm );
                        }                                             // end if statement to determine correct product number entered
                   }                                                  // end while statement
              }                                                       // end for loop
                                                                     // set currency format for output
              NumberFormat moneyFormat =
                   NumberFormat.getCurrencyInstance( Locale.US );
                                                                     // add total to results
              results = "Total Sales for the week: " + moneyFormat.format( totSales );
                                                                     // show output
              JOptionPane.showMessageDialog ( null, results,
                   "Results", JOptionPane.PLAIN_MESSAGE );
              System.exit( 0 );                                   // terminate application
         }                                                            // end main method
    }          // end class definition

  • Is it possible to define default value of a variable in sql scripts

    Hi,
    I was thinking of a way to assign a default value to a variable without any prompt by the script as we do in shell script.
    To make my query more clear, consider the example.
    suppose we have a sql script like test.sql with contents
    ===========================================
    define x=&1
    declare
    x1 number;
    begine
    x1:=nvl(&x,10);
    dbms_output.put_line(x1);
    end;
    ===========================================
    even though I am using nvl it will prompt for value of 1 which needs user interference. for example if I run test.sql output is as below:
    =============
    SQL> @test
    Enter value for 1:
    10
    =============
    Is there any way to avoid sql from prompting for values of variables for which we want it to take a default value (if not specified as input argument)
    Thanks
    now if i run this as
    sql>@test 10
    it executes

    I wan't to accept the value as command line argument. say the whole statement is written into an sql file say test.sql so that &1 will hold any value specified as input.
    So the issue is although sql will execute the procedure if no value is specified but it will still prompt once for any variable (&x or &1). if you don't specify anything and just press enter than only the default value is taken.
    I wan't the script to be executed on cron without user interference. So, was looking if there's a way to specify default value for cron script.

  • Assigning javascript variables to java variables in JSP

    Does anyone know if it possible to assign a javascript value to a java variable in a javascript function? I want to be able to use the javascript value in a PreparedStatement call, but I can't assign the value of the javascript variable to a java variable. I know the opposite can be done using hidden variables in the form, but I need:
    javascript -> java variable in a JSP scriptlet.
    Any help would be much appreciated,
    Thanks,
    -Dave

    Can't do that.
    html/javascript is in the client side.
    jsp is in the server side.
    In order to put html/javascript values (client side) into jsp (server side) it must be submitted.
    Try remoting. Using an iframe with a jsp as the source of it and the html target pointing at it.
    -------------

  • Assigning Javascript value to ABAP variables

    Hi Experts,
    I have written the HTML code mixed with Javascripts to create a table in the 'View' of a BSP Component.
    I was able to set the value of assign the value of ABAP parameters into HTML fields.
    This table has some input fields. I need to fetch the value of input parameters which has been entered by screen on an event which is present in Overview Page.
    I can calulate the value mentioned in input field but i am not able to assign the same value to ABAP parameter for further processing.
    I have already referred the following link but it did not work.
    Assign Javascript variable to Abap variable
    Please help me how i should i acheive it.
    Thanks In Advance,
    Rajeev Singh

    Hi,
    I am not understanding your problem and what you want due to description, but it seems to be very similar to a post which I answered very recently [here|How to return values from a BSP page to Javascript;.

Maybe you are looking for

  • Installation problem on Windows 2003

    Hi All, I have installed the saprfc extension on my laptop for testing purposes. Definitions of my laptop: Windows XP, IIS 6, PHP 4.4.2, SAP GUI 640 Everything works fine and I can access the SAP through the web server on my laptop without any proble

  • Customize transaction type group

    Hi, Are we able to customized transaction type group? For post capitalisation, I do not want to post accum depre. The g/l posting should be Dr : Asset, Credit : Offset Account. Please advise. Thank you YL

  • FI doc relationship to HR

    Hi, I need to link FI doc to HR data (specifically, to get some third-party remittance data). I'm on 4.6C; R3 and HR are separate system. To what HR doc the BKPF-AWKEY correspond? BKPF-AWKEY = xxx (what is this doc???) BKPF-AWSYS = yyy (HR Logical sy

  • When i open firefox i can only see the left side of the website but the left hand side of the website is on the right side of the screen

    it was working fine before and then 1 day i loaded firefox and now i can only see 1 side unless i i use full screen mode, please can any1 help me it looks like the left hand margin is way to big but i hav already looked at this and it is not the prob

  • 23" ACD Power Button Issue / Display Options Missing

    One time my dual 2ghz power mac froze upon coming out of sleep mode so i held the power button to power down the computer, but before i did that, i touched the power button on the side of the monitor, hoping to somehow bring up the password prompt ou