The moose likes JSP and the fly likes Text box value is not being completely filled with request attribute Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Text box value is not being completely filled with request attribute" Watch "Text box value is not being completely filled with request attribute" New topic
Author

Text box value is not being completely filled with request attribute

Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Hi,

In a jsp,I am trying to fill the text box value from a request attribute i.e

Seller user = (Seller)request.getAttribute("seller");

<INPUT type="text" name="firstname" <% if (user != null) { %> value = <%= user.getCountry() %> <% } %>size="50" />

whats happening is it is displaying value only before the space ,for example if country is United States,its displaying only United,same thing is happening with other fields too.

Am I missing something ?Please advice.

Thanks.
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3851

try this,



SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
Thanks for the reply.This logic is not applicable as it is displaying text box with value only if user is not null,whereas I need to display the text box in any case.Also even if i use this logic,its still not displaying the complete value.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

Look at the resulting HTML using View Source in your browser. What's missing? You should see it easily.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I checked the source,it has complete value i.e

<INPUT type="text" name="location" value = united states size="70" />

if I am displaying the value without text box,using only
<%= user.getCountry() %>, its displaying complete value but in text box its displaying incomplete value.
[ December 15, 2008: Message edited by: Mishaal Khan ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

You don't notice anything missing from that line? Really? Look closer!
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I am embarrassed for being so harrassed that couldn't notice the " " marks around value

Thanks, its working now!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

But I suspect that you'll never make that same mistake again!
Mishaal Khan
Ranch Hand

Joined: Aug 21, 2008
Posts: 61
I will not !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Text box value is not being completely filled with request attribute