Sunday, September 28, 2014

How to Append a String to Another String in Struts 2 in JSP

Instructions

    1

    Right-click the JSP file you want to edit and select "Open With." Select your preferred JSP editor.

    2

    Create the two strings you want to use. The following code creates two strings you can concatenate:

    String str1 = "First String";
    String str2 = "Second String";

    3

    Append the second string to the first string using the "+" character. The following code appends "str2" to "str1":

    String appended = str1+str2;

    4

    Print the results to the user's screen. The following code displays the new string to the user:

    System.out.println(appended);



No comments:

Post a Comment