Nick Price

Greenhorn
+ Follow
since Jan 03, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Price

Ok, so pretty much the same as before, and i guess that it printing out this
{JSESSIONID=javax.servlet.http.Cookie@3a9bba, counter=javax.servlet.http.Cookie@1c5ddc9, CyberUser=javax.servlet.http.Cookie@163f7a1} Name: Value:
Is due to it needing to be looped, as i guess that is the memory location.
15 years ago
And thats it? I dont have to assign it too a variable or anything? (p.s. I'm not judging your knowledge, because we all know its huge, i just want to get everything done to the way it should be done, as there is nothing worst than getting into bad habits early on)
15 years ago
ok, like my other servlets then. So i have changed the login part too


So now in my jsp, the only way i know to retrieve the request is in a loop e.g.
<c:forEach var="cookie" items="${x}">

How can i do it out of a loop so i can just print it out once. Can i just do it like
var="cookie" items="${x}"
15 years ago
It compiles ok, but i am forwarding to a jsp, so this bit dont work


Would it be possible to instantiate the cookie in the jsp, and do print out the amount of visits in the html part?
15 years ago
I wanted now to try and add some cookies to my application. I have looked at examples and a lot of them do it through putting the code in their jsp. As i know the purist hate scriplets in jsp, i was looking at adding a cookie into my servlet. So for the time being, i have done this


I am not sure if this is done correctly, but i am hoping the cookie will go too whatever address is forwarded. Is this along the right lines of achieving this?
cheers
15 years ago
Sorry about not saying my last topic was sorted, i am only going to ever post one question on one forum now so i dont make this mistake again.
With some much greatful help, i have gotten data return to my jsp and displaying in my browser. Now i am looking to neaten it up. So i know that doing this



It gets put in its own table. Buts say if i create my own table, rather than looping like the above, is it possible to do like (i know the onctentEditable is not correct, just using as example):


So pointing to an index for the returned variable.

Thats the main point i am after, but on a different note, just to get a better understanding, is JSP and servlets a universal framework, because the forEach loop looks like it comes from C or C++, and not java. And also i was reading in another post that a bean requires an non arg constructor. I have also noticed that everyone writes this constructor even if its their only constructor. If you didnt create this constructor (presuming it was the only one in your class), would a default one be created as usual?
cheers
15 years ago
JSP
Sorry, not quite understanding, printResult shouldnt be a String object, it should be a list of my own object Type. So how can i get rid of this error?
15 years ago
JSP
Somthing has happened since last time, i looked at your further exercises part which helped a lot. I am pretty sure that my list is getting to my servlet, cos i can display it if i add a main to my servlet class. I founf there was a problem when i called it up in my jsp. I was using the wrong name. So i changed it and now i get an error, which seems more hopeful than before. It displays


Then some stacktrace. An then it gives me the root cause


Not understanding as to why it needs to be converted to an integer, or if its trying to convert to an integer. Any clues about this error?
cheers
15 years ago
JSP
thank you very much for the help.
15 years ago
JSP
Where abouts would i find your DAO tutorial? I cant seem to find it anywhere on this site.
15 years ago
JSP
thats what i am trying to understand better so i can get rid of the scriplet. I thought that scriplet was getting the forwarded list i forward in my servlet. What i am trying to find out is how i can disply my list in my jsp. I have forwarded the list from my servlet to my jsp, so how do i retrieve this?

Sorry, i seem to struggle when it comes to jsp and servlets. Does that mean to get my list, i just place
request.getAttribute("searchResults");
in my jsp?

Or would you have any simple examples or tutorials that can show me the correct way to do this.
15 years ago
JSP
Sorry, meant a hardcoded event, i was previously trying to pass it a String incase my "combo box" was not working. so i have forwarder the list to my jsp. If i dont need a scriplet, how would i display the list in my jsp?
15 years ago
JSP
Ok, get you, so here is my major problem. So my selecting of events is in a form which is linked to my PrintResults servlet. In my servlet, i do thi


Now that should (or so i think) get the event, send it of to my database through a method, get returned a list and then forward this list back to my PrintResults.jsp. I know i have a successful list getting to my servlet, because at the bottom, i put a main method to test


And this returns me back the three fastest competitors for the 100M Run.
So now back to the jsp. I try to get the request and display it in a table. SO this is what i have done (problably tottally wrong but i have tried so many things)


As far as what happens, i am being returned an empty white page. Can you see where i might be going wrong?
thanks
15 years ago
JSP
Sorry, not quite sure as to what you mean by casting the result. Could you elaborate please?
15 years ago
JSP
I have been working through some of the previous errors i had, and now i want to try and validate that everything is working on the jsp side. I have create a combobox within a form like so


Now when the user selects a value from the above combo box, does it get saved into Events? Because my next step in my PrintResultsServlet, i am doing this


And i just wanted to check that this would work, because i am not getting the desired output yet, so i want to rule this out if i can.
thanks
15 years ago
JSP