Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to join two or three String together?

 
whongwei
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, All:
Can any tell me how to do this in JSP? Thanks for the help.
I have three string:
String A="Happy";
String B="Birthday";
String C="To";
String D="You!";
How do I get the String Message="Happy Birthday To You!", I know it is very simple when you know it, right?
Thank you.
Hongwei
 
Somas kanthan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<% out.println(A + " " + B + " " + C + " " + D) %>
 
whongwei
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi kanthan:
Thanks for the reply. Yes, this way
<% out.println(A + " " + B + " " + C + " " + D) %>
can get the Happy Bithday To You!
But want I want is <%=Message%> will the the same result.
Because I need to pass this String Message to my servlet.
How to do that? Thanks.
Hongwei
 
Somas kanthan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<body>
<%!
String A="Happy";
String B="Birthday";
String C="To";
String D="You!";
%>
<%! String Message = (A + " " + B + " " + C + " " + D); %>
<cnter> Hi, <br>
<%= Message %>
</center>
</body>

Hope this will do for you.
Thanks
 
whongwei
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi kanthan:
Thanks, thanks, thanks, It works. Thanks again.
Hongwei
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic