Scripts: JSP :: string functions :: Library Article #1

Developer's Section

Using string buffer in JSP
By: Erobo Team Member

Hire a Developer for Related Work / Installation | $55 hr
Rating: 
Average Votes: (2052)
Rate It:   
Favorites:

Learn how to use a string buffer in JSP

The best way to concatenate strings in JSP is by using a String Buffer object. In JSP you can declare and use a String Buffer the following way:

 Code Snippet 1

<%@ page import = "java.io.*, java.util.*" %>
<%
//Create a new string buffer
//Note empty parameter
StringBuffer thisBuffer = new StringBuffer("");

//Append a few characters
thisBuffer.append("I");
thisBuffer.append(" like");
thisBuffer.append(" to");
thisBuffer.append(" eat");
thisBuffer.append(" chocolate");

//print result of concatenation
//output should be: I like to eat chocolate
System.out.println(thisBuffer.toString());
%>


See other Scripts in string functions

 

Submit Your Scripts:

If you would like to have your JSP scripts published in this section please fill out
the form below:
*Your Name or
Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]
  

 


© 2018 Erobo Software, Inc. All Rights Reserved. | Read Privacy Notice | RSS