Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

eclipse jsp page parameter values trimmed by first space

 
mani solai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i am new to jsp eclipse programming. i am using eclipse to build the jsp page where it use tomcat 5.5 as application server to run the page. now i have 2 jsp pages. page one display the link of filename from SAP BO when user click this filename then it should display the values which is generated in the file. now problem is suppose the file name is : sales revenue. when i click the link the parameter value is trimmed to "sales". space is eliminated. my coding

out.println("<a href=New.jsp?sDocName="+res+" target=_blank > click to view SQL and Export to Repository : "+res+" </a>");

where res is the variable. please help to me solve this. i have searched the forum found some notes but not helping. thanks
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why on earth are you using println() in a JSP?

The whole point of a JSP is to be able to enter the HTML in template text rather than inside Java strings.

Also be aware that Java code in a JSP has been obsolete for 12 years. You should be learning the JSTL and EL.
 
Paul Clapham
Sheriff
Posts: 21319
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think if you looked at the HTML which was generated by that code -- which you should have done right away -- you would find that it was bad HTML. In particular I think you would find that the attribute values were missing the quotes around them.

However, having said that, you shouldn't have Java code in a JSP anyway. And using Java code to call out.println and write HTML is particularly wrong, because it's completely unnecessary. You could achieve the same result by just putting that HTML directly into the JSP (remember, the purpose of the JSP is to generate HTML) without any scriptlet junk.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S> Your problem is likely that the resulting HTML is malformed. Do a View Source at the browser to see the generated HTML.
 
mani solai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks all for the reply
can i get the correct code in this scenerio.
if possible please post the rewritten code for this to work.
as i mentioned i don`t know any of this coding just used to get the results which i wanted, most of them from internet. almost 95% done, if i can do this then task completed.
thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic