| Author |
JSP Display problem
|
Deepak Chawla
Ranch Hand
Joined: Nov 19, 2003
Posts: 50
|
|
I Have this JPS code, i am trying to disply filesnames with link on it but i am getting these 2 complier error 1. illegal start of expression 2. ')' expected for(int i =0;i<filesdisplay;i++) { out.write(<a href="/docs/projectname/eventtype/book1.xls"> Book1.xls </a> ; } plz help
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
Next time you post code click the button that says disable smiles. It will make it easir to figure out your code. I know nothing about JSP but shouldn't it be Eric
|
 |
Deepak Chawla
Ranch Hand
Joined: Nov 19, 2003
Posts: 50
|
|
I have a project which has some docs and i am trying to display docs on JSP Page, for displaying docs i am using this code for(int i =0;i<filesdisplay;i++) { out.write(<a href="/docs/projectname/eventtype/filenames[i]"> filenames[i] </a> ; } I get 2 errors 1.illegal start of expression 2. ')' expected But if try to write the out statement like this below out.write("<a href='/docs/projectname/eventtype/filenames[i]'> filenames[i] </a>"); i get output as filenames[i], instead of a filename eg a.doc, b.ppt.
|
 |
Tim Baker
Ranch Hand
Joined: Oct 04, 2003
Posts: 541
|
|
i think you need to reexamine your understanding of java syntax and grammar. what you want is this: if you want to put a variable in a string you end that string ", use a concat operator + and then put the variable, then another concat + and you start a new string "
|
Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
|
 |
dee kal
Greenhorn
Joined: Oct 08, 2003
Posts: 10
|
|
Hi, I am not sure how far this will work...just give it a try... out.write("<a href='/docs/projectname/eventtype/filenames[i]'>" + filenames[i] + "</a>"); Bye.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15362
|
|
|
dees code is not going to work.... since it does not take the array into account for the url string.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56554
|
|
Why are you using out.write to emit HTML? That's inside out. You should be using JSP to include Java in your HTML, not HTML in your Java. bear
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: JSP Display problem
|
|
|