This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jsp:getProperty name shows only first word in string.

 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The lastName property is "Smith Jones", but only "Smith" is displayed.

When I view the browser source I see

so in html the quotes are missing as in value="Smith Jones"

When I save the html and change it to

"Smith Jones" is displayed properly.

Lines 26 and 27 contain is where the issue is.

I have also tried using
value='<jsp:getProperty name="employee" property="lastName" />'
that I found when googling jsp:getproperty truncates bean data at first blank.

How do I get the quotes into the property?

Thanks,

Lou


 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The highest level observation is that using scriptlets and antiques like <jsp:getProperty> is about 10 years out of date.

But the easy answer is: value="<jsp:getProperty name="employee" property="lastName"/>">

The quotes should be in the template text, not in the value of the property.
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose it would help too if I change the correct source file.

Doh!

No Emoticons for slapping myself in the forhead.

The highest level observation is that using scriptlets and antiques like <jsp:getProperty> is about 10 years out of date.


So Bear, what is the 2011 way?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the inception of JSP 2 in 2002, the JSTL and EL should be used in place of scriptlets and the old property actions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic