Author | Message |
---|---|
jkiyomu
Posts: 27
|
Posted 16:20 Apr 16, 2013 |
Hi i am having problems being able to load all the games. I am able to add a game and then i will see all the games. I can select a specific genre and see all the games with that specific genre but when i select all again it doesnt show any games. Any help?
|
dthomas5
Posts: 38
|
Posted 18:47 Apr 16, 2013 |
when you are processing the value for the drop down box, have the default action (When the variable is not set, or is empty) be to list all games Example:
Last edited by dthomas5 at
18:52 Apr 16, 2013.
|
jkiyomu
Posts: 27
|
Posted 19:04 Apr 16, 2013 |
When i do that i get a nullpointerexception.
for my <select> i have all the options including all and value of All is "All" when the person clicks the select button it sends ?genre=All back to the page. I then have if(request.getParameter("genre") == "All"){ //show all games // this part doesnt run when selecting All }else{ // show games with specific genre // this part works!!! } |
jkerby
Posts: 12
|
Posted 20:33 Apr 16, 2013 |
I am having the same issue. Though in Eclipse my project works perfect. I uploaded my project to CS3 and I started having this issue. On initial load of the page everything loads fine. But when you select a genre from the drop down list and click submit, no games show up. I can see in the URL bar I am getter url/Games?genre=null 1. In my form I have the name parameter of the select object set to genre. 2. In do post I do the following:
String genre = request.getParameter("genre"); response.sendRedirect("Games?genre=" + genre); Shouldn't this be all I need to do? As I stated, this works in Eclipse, and I am having trouble even seeing why this wouldn't work in the browser when it works in Eclipse. |
jkerby
Posts: 12
|
Posted 20:51 Apr 16, 2013 |
I'm starting to think even though I am uploading my files successfully thru FileZilla they are simply not being changed on the server. I quickly checked the source on my file and even though it on shows the html of the file, it is showing parameters for the form that are no longer actually there in Eclipse. Maybe there is an error when I try to upload the same file multiple times say with in an hour, something isnot getting refreshed somewhere. --- What I stated above is in fact what is going on. I added some extra values to my Genre array that is used for the drop down menu and nothing new is showing in the browser. What does someone have to do to get the latest code to show thru CS3? I have tried to re-upload my web.xml file and that has not helped anything. Last edited by jkerby at
20:56 Apr 16, 2013.
|
dthomas5
Posts: 38
|
Posted 21:11 Apr 16, 2013 |
Make sure your select option looks similar to this
You want to make sure that response.getParameter(<value>) is the same for <select name'<value>'> AND CASE DOES MATTER |
dthomas5
Posts: 38
|
Posted 21:11 Apr 16, 2013 |
Also, I can help you guys debug your program after class tomorrow |
hensan
Posts: 23
|
Posted 22:55 Apr 16, 2013 |
I had the same issue with the genre, then I started trying a few things around util I found a solution. Try this: String genre = request.getParameter("genre"); if(genre.matches("All")){ //display all games } else{ //display games by genre }
Hope that helps.
|
jkiyomu
Posts: 27
|
Posted 23:18 Apr 16, 2013 |
Thanks for all the help guys but still nothing is working. I am going to take a break from it tonight and see if i can get help from one of you tomorrow. |
dthomas5
Posts: 38
|
Posted 14:56 Apr 17, 2013 |
I am in the classroom right now if you guys need help
|