reset password
Author Message
fyang15
Posts: 35
Posted 21:48 Mar 12, 2020 |

I can't figure out how to make the index work even though I managed to change the index through:

<a href="DrivingTestBrowser?index=<%= newindex%>">

(newindex is a variable with index + 1)

but when i click Next, the page doesn't seem to read the new index and the content stays the same. I have set request's attribute "index" to the new index, no luck. Any idea?

smallch
Posts: 10
Posted 22:05 Mar 12, 2020 |

There was a hint in the assignment.

"You can embed the index for the next question in the Next link like "?index=${index+1}"."

fyang15
Posts: 35
Posted 22:08 Mar 12, 2020 |
smallch wrote:

There was a hint in the assignment.

"You can embed the index for the next question in the Next link like "?index=${index+1}"."

Tried that too, didn't work. How do I make the JSP load the new index? the code is correct if the right index is passed to it. Right now it's not.

smallch
Posts: 10
Posted 22:37 Mar 12, 2020 |

Your servlet is likely not passing along the new index then.

Check your forward/redirect code to make sure its not sending the exact same thing all the time.

fyang15
Posts: 35
Posted 22:37 Mar 12, 2020 |

Any help, please? this is the last step i need before I finish the whole lab.

fyang15
Posts: 35
Posted 22:38 Mar 12, 2020 |
smallch wrote:

Your servlet is likely not passing along the new index then.

Check your forward/redirect code to make sure its not sending the exact same thing all the time.

Will do

fyang15
Posts: 35
Posted 22:38 Mar 12, 2020 |
smallch wrote:

Your servlet is likely not passing along the new index then.

Check your forward/redirect code to make sure its not sending the exact same thing all the time.

The URL changes to http://localhost:8080/Lab/DrivingTestBrowser?index=1

but the content stays the same.

smallch
Posts: 10
Posted 22:41 Mar 12, 2020 |

I will admit that in my application I didn't change the index in jsp, I did that in the servlet.

semerdjianm
Posts: 11
Posted 22:54 Mar 12, 2020 |
fyang15 wrote:

I can't figure out how to make the index work even though I managed to change the index through:

<a href="DrivingTestBrowser?index=<%= newindex%>">

(newindex is a variable with index + 1)

but when i click Next, the page doesn't seem to read the new index and the content stays the same. I have set request's attribute "index" to the new index, no luck. Any idea?

Some code like.......

<p><a href="DrivingTestBrowser?index=${index}">Next</a></p>

fyang15
Posts: 35
Posted 22:58 Mar 12, 2020 |
semerdjianm wrote:
fyang15 wrote:

I can't figure out how to make the index work even though I managed to change the index through:

<a href="DrivingTestBrowser?index=<%= newindex%>">

(newindex is a variable with index + 1)

but when i click Next, the page doesn't seem to read the new index and the content stays the same. I have set request's attribute "index" to the new index, no luck. Any idea?

Some code like.......

<p><a href="DrivingTestBrowser?index=${index}">Next</a></p>

I have already done that, the content of the page doesn't change.

smallch
Posts: 10
Posted 23:27 Mar 12, 2020 |

You might be able to have the link go to the jsp and not the servlet since it already made everything you need from it.

fyang15
Posts: 35
Posted 23:34 Mar 12, 2020 |
smallch wrote:

You might be able to have the link go to the jsp and not the servlet since it already made everything you need from it.

Still no luck. I guess I can't get full credit this time :(

semerdjianm
Posts: 11
Posted 23:41 Mar 12, 2020 |
fyang15 wrote:
smallch wrote:

You might be able to have the link go to the jsp and not the servlet since it already made everything you need from it.

Still no luck. I guess I can't get full credit this time :(

 

maybe your missing an add and readline

 

semerdjianm
Posts: 11
Posted 23:44 Mar 12, 2020 |
semerdjianm wrote:
fyang15 wrote:
smallch wrote:

You might be able to have the link go to the jsp and not the servlet since it already made everything you need from it.

Still no luck. I guess I can't get full credit this time :(

 

maybe your missing an add and readline

something wrong in init and doGet