struts: forward based on input

D

dennis

I am newbee in struts so pls bear with me.

Say you have a page that maybe embedded in other pages/frames etc.
User can submit the page. This always ends up in the same action which
does some processing and fowards on to different location depending
where the page was embedded. Is there anything in request that would
tell me where the page came from... if not I'd think to pass a source
variable in the form which would tell me this. Can anyone offer a
better solution?
thx -D
 
M

Murray

dennis said:
I am newbee in struts so pls bear with me.

Say you have a page that maybe embedded in other pages/frames etc.
User can submit the page. This always ends up in the same action which
does some processing and fowards on to different location depending
where the page was embedded. Is there anything in request that would
tell me where the page came from... if not I'd think to pass a source
variable in the form which would tell me this. Can anyone offer a
better solution?
thx -D

You can get the referring URL from the request header, but this is pretty
unreliable. Some browsers and/or firewalls remove this value depending on
security settings.

String referringUrl = request.getHeader("Referer"); // yes, only one 'r'

I'd go with passing a source page value.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top