• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic string in jsp

 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can we create a dynamic string by combining string with scriplet or EL ?
I mean for eg:

eg1:
===
getJspContext().getOut().println("Hi "+<% request.getAttribute("firstname");+" !" %>

eg2:
===
<c:set var="name" value="Hi "+><% request.getAttribute("firstName");+" !" />

Thanks in advance.

 
Kiran Joshi
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
<c:set var="name" value="Hi ${firstName}" />
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And please, do not mix both the JSTL and scriptlets in the same page. Pick one or the other. Combing them is the messiest possible combination.
 
Parthiban Malayandi
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kiran Joshi and Bear Bibeault ,

Thanks for your replies by the way sorry for the delayed response from my side .
Kiran Joshi - Thanks for your solution you provided.
Bear Bibeault -Thanks for your reply which guided me for best practise


 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!