Forums Register Login

extracting information about the previous page from where a current jsp page came

+Pie Number of slices to send: Send
I have to implement a system where I have to do almost same processing on a jsp page. The slight differences on the present page is based on whether the current page came from page 1 or page 2. So how can I do this?
+Pie Number of slices to send: Send
What does "came from" mean? I ask because I can imagine at least two different meanings for that term, so could you explain what that means to you? Perhaps an example would help.
+Pie Number of slices to send: Send
That's not a good way to approach the problem. Knowing "where it came from" would be an example of strong binding and is a poor practice.

Think about it this way for a minute: if you had a Java method that needed to perform slightly different processing in various situations, would you try to find out who called it in order to accomplish that? Of course not. So how would you do it? You'd pass parameters to the method, right? Well, the same approach can be used for a JSP.

From this, though, I predict that you are calling JSPs directly without controllers?
+Pie Number of slices to send: Send
I would use the HttpSession to store a "state" parameter when writing a page. That is always under your control. Easily expanded to store an entire "state" history if you like.

If you can't because the user has cookies turned off, use a hidden variable in a FORM.

Bill
Everybody! Do the Funky Monkey! Like this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 931 times.
Similar Threads
Bugs with parameters escape
REST vs SOAP - stateful/stateless
JSP Bean,not able to work my first bean
Secure and unsecure info on same page
Java Web Developer interview experience
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:47:48.