Diff. bet. JSP String ( %! String) and Java String.

Hi all,
Think this is one of the basic Questions.
I want to know the basic diff. between <%!String a=10; %> and <%String a=10; %> programmatically,
with an example.
Bye
Sreedhar

<%! ... %> are called jsp declarations, and are inserted into the generated servlet class.
<% ... %> are called jsp scriptlets, and are inserted into the _jspService method.
For example, the following jsp :
<%! String a = "10"; %>
<%!
  public void helloWorld() {
     System.out.println("Hello world");
%>
<% String b = "10"; %>Might be translated to the following servlet code :
String a = "10";
public void helloWorld() {
   System.out.println("Hello world");
public void _jspService(...) ... {
  String b = "10";
}

Similar Messages

  • I would like to do a program that have one string control and one string indicator, any character that I type in the string control in the same time it will be appear in another string (indicator). How can help me?

    I would like to do a program that have one string control and one string indicator, any character that I type in the string control in the same time it will be appear in another string (indicator). How can help me?

    Why not use an event
    Add a While Loop, inside the loop add the Event Sructure.
    Now in the event structure selecd the String Controls.value change event to
    react
    and the new value inside the event that you get,( connect to the String
    indicator box.
    On Sun, 10 Aug 2003 15:58:47 -0500 (CDT), WiltonFilho wrote:
    > I would like to do a program that have one string control and one
    > string indicator, any character that I type in the string control in
    > the same time it will be appear in another string (indicator). How can
    > help me?
    >
    > I would like to do a program that have one string control and one
    > string indicator, any character that I type in the string control in
    > the same time it will be appear in another string (indicator). How can
    > help me?
    >
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

  • Unable to read big files into string object  and java.lang.OutOfMemory Prob

    Hi All,
    I have an application that uses applet and servlet communication. On the client side I am reading an large xml file of 12MB size (using JFileChooser) and converting the file to an string object using below code. But I am getting java.lang.OutOfMemory on the client side . But the same below code works fine for small xml files which are less than 4MB sizes:
    BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF8"), 1024*12);
    String s, s2 = new String();
    while((s = in.readLine())!= null)
         s2 += s + "\n";
    I even tried below code but still java.lang.OutOfMemory is coming:
    while (true)
         int i = in.read();
         if (i == -1)
              break;
         sb.append(i);
    Please let me know what am I doing wrong here ...
    Thanks & Regards,
    Sony.

    Using a String is bad for the following reason:
    When you initially create the String, it has a certain memory size (allocated length if you will). As you keep appending to this String, then memory reallocation will occur over and over, slowing your program down dramatically (ive seen with a 16k x 8 Char file taking 30 secs to read into memory using Strings in this way)
    A Better way would be if you knew the number of characters in the XML file (Using some File size method for example) Then you can use a StringBuffer, which will pre allocate enough space (or try to, it may just be that you cannot create a string as large as you need). You can use toString() method to get the resultant in a String Object (the extra allocated space at the end of the Buffer will be removed)
    StringBuffer strBuf = new StringBuffer(xxxx);
    Where xx is the length (int). Assuming that you are only allowed to enter an int to the constructor then (platform depedant) an int is 2^31 at maximum (or whatever) which allows 2.14e9 characters, therefore an xml file being totally filed would allow a size of ~2048 MB to be read in.
    Try it and see.

  • How to apply JSP expression %= var % in Java String

    I have an unique problem. I am just trying to describe it with a simple example as follow:
    A servlet passes the following string to a JSP page:
    String sFromServlet = "hello my name is <%= strName %>";
    The JSP code has the definition of the variable strName as:
    String strName = "John Smith";
    Now, in the JSP code, we want to replace strName in the variable sFromServlet so that it looks like the following:
    "hello my name is John Smith".
    I know this can be done with string pattern search and replacement. But did anyone know any smarter way to do it?
    Thanks,
    SQ

    Do you mean
    <%
    String strName = "John Smith";
    String sFromServlet = "hello my name is "+strName";
    %>

  • Can formula node take string input and output string?

    I am wondering if the formula node can take string input variable and output string variable after calculation. otherwise I have to output integers and then use case structure to select different output strings, that is kind of redundant in coding.
    ping

    If you are just trying to read lines that have mixed formatting, you don't need any script nodes.
    Can you attach a tpyical flne and a description of the desired read operation so we have a better idea what you are trying to do? Do all lines have the same overall format?
    LabVIEW Champion . Do more with less code and in less time .

  • What is the difference between String Constant and Empty String Constant

    What is the difference between string constant which does not contain any value and the Empty string constant?
    While testing a VI which contain a normal string constant in VI analyzer, it gives error to change string constant with the empty string constant?
    Please Reply
    prabhakant
    Regards
    Prabhakant Patil

    Readability.
    Functionally, they are the same. From a coding standpoint, the Empty String Constant is unambiguous.
    It is empty and will always be; good for initialization. Also, because you can not type a value into and Empty String Constant, someone would need to conciously replace it to set a 'default' value that is something other than NULL.
    Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
    If you don't hate time zones, you're not a real programmer.
    "You are what you don't automate"
    Inplaceness is synonymous with insidiousness

  • Diff  in  web dynpro  abap  and  Java

    Hi  Friends,
       I  am new  to  web dynpro  ABAP and  Java.
         1) Please  give  me idea  about  about  these  two
          2) In  which  Scenarios  these  are  helpfull
         3)  From  which  version   onwards  these are  existing
    Thanks for  your  help.
    Thanks,
    Asha

    Hi Ravi,
    The following are basic differences between ABAP and JAVA WD.
    1. ABAP WD can be developed in ABAP Workbench thru transaction SE80 whereas Java WD needs SAP NetWeaver Developer Studio.
    2. Since ABAP WD is a part of the ABAP Workbench, it has direct access to ABAP dictionary. Hence access is faster.
    3. In order to develop on ABAP WD, you will need basic knowledge of ABAP objects, whereas in Java WD, dev is using Java

  • Diff bet tables TBE31,TBE11 and T052u

    Hi friends
    Diff between tables TBE31,TBE11 and T052u
    regards
    Vinny

    Hi,
    Please find the differences.
    TBE31 is FI related table for enhancements.
    TBE11 it contains application components
    T052u is terms of payment table///
    Thanks
    Ravi

  • Wht's the Diff bet AT-USER command and AT-PF STATUS

    Can Anybody explain me the diffarence between At user command and At-pf status.
    Thanks,
    Srik

    Hi Srikanth,
    AT USER-COMMAND - Event in interactive reporting
    This event is executed whenever the user presses a function key in the list or makes an entry in the command field .
    Some functions are executed directly by the system and thus cannot be processed by programs. These include:
    PICK See variant AT LINE-SELECTION PFn See variant AT PFn /... System command %... System command PRI Print BACK Back RW Cancel P... Scroll function (e.g.: P+ , P- , PP+3 , PS-- etc.)
    Instead of this functions, you can use the SCROLL statement in programs.
    Since many of these system functions begin with "P", you should avoid using this letter to start your own function codes.
    Otherwise, the effect is as for AT LINE-SELECTION ; also, the current function code is stored in the system field SY-UCOMM .
    Example
    DATA: NUMBER1 TYPE I VALUE 20,
          NUMBER2 TYPE I VALUE  5,
          RESULT  TYPE I.
    START-OF-SELECTION.
      WRITE: / NUMBER1, '?', NUMBER2.
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'ADD'.
          RESULT = NUMBER1 + NUMBER2.
        WHEN 'SUBT'.
          RESULT = NUMBER1 - NUMBER2.
        WHEN 'MULT'.
          RESULT = NUMBER1 * NUMBER2.
        WHEN 'DIVI'.
          RESULT = NUMBER1 / NUMBER2.
        WHEN OTHERS.
          WRITE 'Unknown function code'.
          EXIT.
      ENDCASE.
      WRITE: / 'Result:', RESULT.
    After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.
    AT PFn - Event in interactive reporting
    Here, n stands for a numeric value between 0 and 99.
    This event is executed whenever the user presses a function key that contains the function code PFn in the interface definition. The default status for lists contains some of these functions.
    Otherwise, the effect is as for the variant AT LINE-SELECTION . The cursor can be on any line.
    To ensure that the chosen function is executed only for valid lines, you can check the current HIDE information. This variant should be used only for test or prototyping purposes, since the default status is not normally used. Instead, you should set a program-specific status with SET PF-STATUS . This should not contain any function codes beginning with " PF ".
    Example
    DATA NUMBER LIKE SY-INDEX.
    START-OF-SELECTION.
      DO 9 TIMES.
        WRITE: / 'Row', (2) SY-INDEX.
        NUMBER = SY-INDEX.
        HIDE NUMBER.
      ENDDO.
    AT PF8.
      CHECK NOT NUMBER IS INITIAL.
      WRITE: / 'Cursor was in row', (2) NUMBER.
      CLEAR NUMBER.

  • What is difference between Null String and Empty String ?

    Hi
    Just i have little confusion that the difference bet'n NULL String and Empty String ..
    Please clear my doubte.
    Thankx

    For the same reason I think it's okay to say "null
    String" and "empty String "as long as you know they
    really mean "null String reference" and "empty String
    object" respectively. Crap. It's only okay to say that as long as *the one you're talking to" knows what it really means. Whether you know it or not is absolutely irrelevant. And there is hardly any ambiguity about the effects that a statement like "assign an object to a reference" brings. "Null String" differs in that way.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Runtime.getRuntime().exec and quoted strings?

    Attempting to execute a command containing a quoted string. Being very new to Java I'm guessing I'm not doing it right. Below are two code bits the first one works the second doesn't. So the question is "How do I use quoted strings in a command with .exec?"
    // this one works
    try {               
    p = Runtime.getRuntime().exec("ls -l tst.java");
    p.waitFor();
    System.out.println("Done!");
    catch(Throwable e) {                                  
    system.out.println("Errors!");
    // this one fails
    try {               
    p = Runtime.getRuntime().exec("ls -l \"tst.java\"");
    p.waitFor();
    System.out.println("Done!");
    catch(Throwable e) {                                  
    system.out.println("Errors!");

    I don't know if it is too late for the answer, but I think I know what the problem is.
    You are using exec(String) method, and passed String parameter is parsed using StringTokenizer class. This means that when you use quotes as in "file1 file2", StringTokenizer parses this as "file1 and then file2" so it is not understandable command.
    To solve the problem, do not use exec(String) method, use exec(String[])
    Using this you can send separate command and separate parameters as in following example:
    If you want to send (in Unix)
    grep "SHOW lotid" text.txt
    (using exec("grep \"SHOW lotid\" text.txt") would not work)
    Do the following
    exec(new String[]{"grep", "SHOW lotid", "text.txt"});
    This avoids parsing problem when quotes are used.
    Mehmed

  • JSP, Servlet, and Java Classes location in Tomcat

    In tomcat, I want to know JSP files, Servlets, and Java classes
    should put in different locations:
    I put web.xml in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF
    I put all JSP files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1
    I put all servlet files in the following:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes
    I put all Java classes in the following with package proj1:
    C:\jakarta-tomcat-4.1.30\webapps\proj1\WEB-INF\classes\proj1
    When I execute JSP files, it has HTTP error 404, file not found.
    The content of web.xml is:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>proj1</display-name>
    <description>
         proj1
    </description>
    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>
    Please advise. thanks!!!

    <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>
    </web-app>Where's the servlet definition that maps to "invoker"?

  • Diff bet diff versions

    Hi
    Pls give me details of Diff. bet SAP 4.6 and ECC6.0
    Aryan

    Hi
    /thread/170347
    The only difference between ECC5 and ECC6 is that additional components like mySAPCRM, mySAPPLM, mySAPSCM, mySAPSRM are added in ECC6.0. HR was already a part of ECC5.0.
    http://abdurohman.wordpress.com/2007/06/29/whats-new-in-ecc5-and-ecc6-ecc7/
    Whats new in ECC5 and ECC6? ECC7?
    Posted by abdurohman on June 29th, 2007
    Other cross category docs: Miracleous Image and Quran’s Mathematics | I want to visit Indonesian Computer Show
    ECC stands for ERP Central Component / Enterprise Central Component, new version level of SAP R/3 ERP, the latest one as of June 2007 is ECC 6.0. They are also dubbed as SAP V5 and V6 or just SAP 5.0 or SAP 6.0. I think version transition time from ECC5 to ECC6 was too short, It seems like they just consolidated many component versioning in ECC6 with additional patches/support packages. I am sure it will be longer for (probably) ECC7 to come. I found at least 3 differences related to previous non-ECC version.
    ·     new in ECC5, BW (business warehouse or named BI / business intelligence in ECC6) is integrated with ERP. So probably you may have BW and ERP in one box if using ECC5 or ECC6. You can still have BW server without ERP component by installing Netweaver ABAP engine and additional BW components (as add-on and SP).
    ·     new in ECC5: double accounting, with double accounting you can have 2 or more ledgers in your ERP application, however in my experience in double accounting accounting using ECC5 (in one distribution company) there should be more effort and customer development if ERP going live time is different with double accounting going live time
    ·     Java kernel was introduced in addition to ABAP kernel. ABAP kernel still the main kernel for ERP function, however for other Netweaver package component like enterprise portal (EP), java kernel is main kernel. There is a configuration called “double stack” for a system that uses both ABAP+Java.
    Additional notes for upgrade to new ECC:
    ·     might need new level of database version such as Oracle 10.1 or 10.2, there would be additional upgrade step for database
    ·     ECC needs more SAPS power and need re-sizing of our production SAP hardware
    ·     end of support maintenance for ECC 6.0 is 20013 (standard) and 2016 (extended), while 4.6C is 2006 and 2009, 4.7 is 2009 and 2012 (first quarter???)
    ·     there are table changes e.g. from enterprise 4.7 to ECC 5.0, there will be a lot of effort of customer program upgrade (Z* and Y* program which use the tables), however reimplementation is not suggested except there are a lot of issue son business process design on previous version and new business design is required
    Short Difference between R/3 4.7, ECC5 & ECC6 !!!!!
    1. SAP NetWeaver is SAP's technology platform. It has all of SAP's
    technology in it. It is used to build and run SAP Applications and customer
    applications (Application server, data warehouse, portal, coding, messaging,
    etc). You can find more information on the SAP NetWeaver page on the SAP
    Service Marketplace (http://service.sap.com/netweaver). Of course they is
    also in on the SAP NetWeaver page in SDN.
    2. ABAP is part of SAP NetWeaver. BW is part of SAP NetWeaver (as of
    the 3.5release).
    3. Prior to SAP NetWeaver, BW was a seperate product. It is shipped as part
    of SAP NetWeaver since the SAP NetWeaver '04 release (SAP NetWeaver BI 3.5).
    4. SAP ECC is part of the SAP ERP application (actually it is the minimal
    installation of SAP ERP). SAP ERP runs on SAP NetWeaver. So when you get SAP
    ERP you get SAP NetWeaver.
    - SAP ECC 5.0 is part of SAP ERP 2004
    - SAP ECC 6.0 is part of SAP ERP 6.0 (2005) [which runs on SAP
    NetWeaver 7.0(2004s)]
    5. SAP NetWeaver is delivered with SAP ERP so ABAP and the functional
    modules are include in SAP ERP.
    6. With SAP ERP (SAP ECC) you have a choice of activating BI within the SAP
    ERP system or deploying in a seperate system. This is information is in the
    SAP ERP master guides which can be found at
    http://service.sap.com/instguides.
    For SAP ERP 6.0 (ECC 6.0) it will the SAP NetWeaver 7.0 version of BI.
    Vishal...

  • Whats the diff bet Automatic Req Grouping & Grouping of SC for followondocs

    Hi Friends
    What is the diff bet Automatic Requirement Grouping and Grouping of SC for follow on documents
    Regards
    Vinny

    Yes you are right, but the complete process is as below:
    -> First Sourcing Should be activated in the SRM
    -> Then when users creates SC with source of supply (or depending on sourcing config) the SC is moved to Sourcing Cockpit.
    -> Then in the sourcing cockpit, the requirements are completed and submitted for grouping.
    -> And then if the program BBP_SC_TRANSFER_GROUPED is executed, then the grouping happens for the follow on document.
    Note: The technical scenario is also to be considered.
    Hope this answers your question.
    Regards
    Kathirvel

  • How is the length of a string calculated in Java?  and JavaScript?

    Hi all,
    Do any of you know how the length of a string is being calculated in Java and JavaScript? For example, a regular char is just counted as 1 char, but sometimes other chars such as CR, LF, and CR LF are counted as two. I know there are differences in the way Java and JavaScript calculate the length of a string, but I can't find any sort of "rules" on those anywhere online.
    Thanks,
    Yim

    What's Unicode 4 got to do with it? 1 characteris 1
    character is 1 character.
    strings now contain (and Java chars also) is
    UTF-16 code units rather than Unicode characters
    or
    code points. Unicode characters outside the BMPare
    encoded in Java as two or more code units. So it would seem that in some cases, a single
    "character" on the screen, will require two charsto
    represent it.So... you're saying that String.length() doesn't
    account for that? That sux. I don't know. I'm just making infrerences (==WAGs) based on what DrClap said.
    I assume it would return the number of chars in the array, rather than the number of symbols (glyphs?) this translates into. But I might have it bass ackwards.

Maybe you are looking for

  • While creating a new row in table,the total data present in table is coming

    Hi, From search page,i click add button,it goes to next transaction page.In transaction page i drag and drop one VO in table and in form also.But in that transaction page,The table is coming with data and a new row is also able to insert.But i don't

  • The session getattributes lost one row of data in the html input table

    Deal all, I have input three rows of data in a html table. But I found the last row will disappear and lost when it return the data to backend. I think that maybe caused there is an error checking which prompts an error and after that , I change the

  • CC Desktop - The infamous error code 50 is back again

    Hi, I initially posted this in the wrong forum. Sorry. Year after year, each time a new version of CC Desktop is released, the same mess has to be sorted out : the update refuses to install with error code 50. Uninstalling and re-installing doesn't h

  • Instead of CODEPAGE

    Please see this link http://help.sap.com/saphelp_46c/helpdata/en/fc/eb3d83358411d1829f0000e829fbfe/content.htm If we do not  want to UPLOAD/DOWNLOAD  data under DOS, what other parameter instead of CODEPAGE   should we use? Say we want to UPLOAD /DOW

  • Opening file larger than 4 GB

    Have a large panorama tiff that would not open in PS CC. Error was file larger than 4GB.. What options do I have to open large file as this one in PS CC.