aspose file tools*
The moose likes JSP and the fly likes jsp:getProperty name shows only first word in string. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp:getProperty name shows only first word in string." Watch "jsp:getProperty name shows only first word in string." New topic
Author

jsp:getProperty name shows only first word in string.

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
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

Joined: Jan 10, 2002
Posts: 61770
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
    
    1
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

Joined: Jan 10, 2002
Posts: 61770
    
  67

Since the inception of JSP 2 in 2002, the JSTL and EL should be used in place of scriptlets and the old property actions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp:getProperty name shows only first word in string.