GeeCON Prague 2014*
The moose likes IDEs, Version Control and other tools and the fly likes eclipse jsp page parameter values trimmed by first space Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "eclipse jsp page parameter values trimmed by first space" Watch "eclipse jsp page parameter values trimmed by first space" New topic
Author

eclipse jsp page parameter values trimmed by first space

mani solai
Greenhorn

Joined: Feb 13, 2013
Posts: 2

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

Joined: Jan 10, 2002
Posts: 61315
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Jan 10, 2002
Posts: 61315
    
  66

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

Joined: Feb 13, 2013
Posts: 2
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
 
GeeCON Prague 2014
 
subject: eclipse jsp page parameter values trimmed by first space