reset password
Author Message
lvaldova
Posts: 12
Posted 20:01 Mar 12, 2020 |

Nothing is displayed in the browser when I use ${questions[index].description}. Also, when I click Next, the url shows that index=1 now, but I get a 404 Not Found error that says "server did not find a current representation for the target resource or is not willing to disclose that one exists". What am I doing wrong? 

Last edited by lvaldova at 20:11 Mar 12, 2020.
Mrxethan
Posts: 17
Posted 20:05 Mar 12, 2020 |

Try ${questions[param.index].description}

dgonz271
Posts: 8
Posted 20:07 Mar 12, 2020 |

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

lvaldova
Posts: 12
Posted 20:11 Mar 12, 2020 |
Mrxethan wrote:

Try ${questions[param.index].description}

Thanks, but it's not working for me.

lvaldova
Posts: 12
Posted 20:13 Mar 12, 2020 |
dgonz271 wrote:

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

The extra . was a typo. Without it it still wont work.

dgonz271
Posts: 8
Posted 20:20 Mar 12, 2020 |
lvaldova wrote:
dgonz271 wrote:

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

The extra . was a typo. Without it it still wont work.

Try double checking that you stored the questions in the application scope properly and then that index was set in the doGet 

lvaldova
Posts: 12
Posted 20:28 Mar 12, 2020 |
dgonz271 wrote:
lvaldova wrote:
dgonz271 wrote:

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

The extra . was a typo. Without it it still wont work.

Try double checking that you stored the questions in the application scope properly and then that index was set in the doGet 

I don't exactly understand where the application scope is. I know that something stored there can be accessed by all parts of the program. If you don't mind would you clarify for me?

dgonz271
Posts: 8
Posted 20:50 Mar 12, 2020 |
lvaldova wrote:
dgonz271 wrote:
lvaldova wrote:
dgonz271 wrote:

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

The extra . was a typo. Without it it still wont work.

Try double checking that you stored the questions in the application scope properly and then that index was set in the doGet 

I don't exactly understand where the application scope is. I know that something stored there can be accessed by all parts of the program. If you don't mind would you clarify for me?

This is essentially any attribute that you set in the init function of the servlet. There's another topic on this forum where someone was having issues with the init so that's just in case you run into an issue there. 
But the idea is that if you have an attribute that you set in the init, it can be retrieved in the doGet to then be used there. You can see more about what I mean in the GuestBook example

lvaldova
Posts: 12
Posted 21:32 Mar 12, 2020 |
dgonz271 wrote:
lvaldova wrote:
dgonz271 wrote:
lvaldova wrote:
dgonz271 wrote:

I see you have "questions.[index].description"
I think it won't display due to a '.' between questions and [index]

The extra . was a typo. Without it it still wont work.

Try double checking that you stored the questions in the application scope properly and then that index was set in the doGet 

I don't exactly understand where the application scope is. I know that something stored there can be accessed by all parts of the program. If you don't mind would you clarify for me?

This is essentially any attribute that you set in the init function of the servlet. There's another topic on this forum where someone was having issues with the init so that's just in case you run into an issue there. 
But the idea is that if you have an attribute that you set in the init, it can be retrieved in the doGet to then be used there. You can see more about what I mean in the GuestBook example

Thank you for explaining application scope! That's much more clear. However, I have already done that. I guess I'll just need to keep debugging. Thanks for the help.

cesqued
Posts: 1
Posted 21:35 Mar 12, 2020 |

Does anyone know how to skip the empty lines when reading the file into the object list?

fyang15
Posts: 35
Posted 21:45 Mar 12, 2020 |
cesqued wrote:

Does anyone know how to skip the empty lines when reading the file into the object list?

just use nextLine() to skip

lvaldova
Posts: 12
Posted 22:28 Mar 12, 2020 |

Which folder should the jsp file be in, WEB-INF or just WebContent?