This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dynamic string in jsp  RSS feed

 
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: 65826
134
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


 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!