Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

Form <Input ...> display problem

Hi

I have problem with a jsp program which display
a form's input field.

See below :-

out.print("<td><input type=text size=60 name=description disabled value=" + desc + ">" + "</td>");          

The String field <desc> contains value "Question 3 header".
But when the web page displayed, it shown as "Question" instead of "Question 3 header".

Pls advice what is wrong ?

Thanks & Rgds
Heng03

                                   

0
heng03
Asked:
heng03
1 Solution
 
msterjevCommented:
Increase the size of text field and specify the width of the column:
<td width=200><input type=text size=120 .....
0
 
heng03Author Commented:
Hi  msterjev

Your answer did not work.

I debug the jsp program & found the error is due to jsp handling String variable.
The solution is to embed the variable with "'".

eg
before solution :-
out.print("<td><input type=text size=60 name=description disabled value=" + desc + ">" + "</td>");  
       

After solution :-
out.print("<td>" + "<input type=text size=60 name=description disabled value=" + "'" + desc + "'" + ">" + "</td>");  
       
Anyway thanks for your help.

Rgds
Heng03





0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now