In my application I display several learning objects as hyperlinks that when clicked will call out resources (some websites)
I need to do some actions when a learning object is selected before browsing the website. To be more clear a learning object will be considered consumed when clicked. So what is the way to combine these two actions?
Can I call a servlet that will call the java method then go to the website without any more clicks. In this case I will pass the address of the website to the server through the href.
"(some websites) " are external websites?
Asume that your consumedLO object works with keys (a key matches an url), you can pass that key via your servlet, to your consumedLO instance.
You do your stuf you want to do.
Then, do a response-redirect to the url that matches the key.
Nada Bajnaid wrote:Can I call a servlet that will call the java method then go to the website without any more clicks. In this case I will pass the address of the website to the server through the href.
Is this the right way?
or, indeed, you can pass the address of the website to the server through the href.
Yes it external website. Can I call another servlet passing the address of the link through the href. then in the new servlet I call the java method passing to it this address. After that I use go to go to the link.
Is it right way?
Nada Bajnaid wrote:Yes it external website. Can I call another servlet passing the address of the link through the href. then in the new servlet I call the java method passing to it this address. After that I use go to go to the link.
Is it right way?
its a solution.
But why 2 servlets?
1 servlet will do.
from your browser, after click, request with the url as parameter comes in the servlet.
you do your stuff with you java methods
and then you do a response sendredirect (from within your servlet of course) to the url that was send as parameter.
all these items are in the doPost method of the servlet this is why I think I will need another servlet. Or you mean that I can creat a new method in the servlet that will do my consumedLO stuff and sendredirect to the passed link after that it will return control back to the calling point at the servlet? do I misunderstand something?
inside your dopost method you do first your consumedLO stuff
right after that , still in the same dopost,
you do a response.sendredirect(the_url_that_was_given);