• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

jsp:getProperty name shows only first word in string.

 
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic