aspose file tools*
The moose likes Struts and the fly likes how do i find the referring page in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how do i find the referring page in struts" Watch "how do i find the referring page in struts" New topic
Author

how do i find the referring page in struts

George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
I hope someone who knows struts better than me can help.
I have a jsp and it is doing various jsp includes. one of the included jsps is a form in its own right. The form is included on various different jsp's.
What I wanted to find out is whether I can find out from either the ActionForm object or from the Action servlet what the originating page was.
Does anyone know where I can find this out from?
All replies are much appreciated.
George
Reda Mokrane
Ranch Hand

Joined: Jul 25, 2001
Posts: 237
Try this

or with the javaScript
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5287
    
  10

I'm not sure if that approach will work so here's my $0.02. If you get stuck approaching a problem one way, I find it's often useful to try the opposite direction. In your case, instead of the included JSP trying to find out what included it, I would turn the tables around and have every JSP that used the common one identify itself. E.g.
<jsp:include page="common.jsp">
<jsp:param name="caller" value="this.jsp" />
</jsp:include>
It all depends on whether you're actually using dynamic or static includes though, or if you are using something like Tiles.
[ April 01, 2003: Message edited by: Junilu Lacar ]

Junilu - [How to Ask Questions] [How to Answer Questions]
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
Thanks Junilu,
that was one of the approaches that I had already tried, but the use of <jsp:include> tags rather than <%@include> messed up the presentation of the page, so I abandoned it.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5287
    
  10

Originally posted by George Brown:
the use of <jsp:include> tags rather than <%@include> messed up the presentation of the page, so I abandoned it.

Not sure how this could be. What was happening? maybe there's something that can be done about it.
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
I think it may have worked if I was using frames, but as it is I am using tables (no frames) and in that context, with the struts tags, there is an essential difference between the way the include directive processes included files and the way the jsp:include processes included pages.
That jsp:include difference messes up the tables by not compiling the logic tags correctly (I don't know why)...
Here is an example...
(if you substitute jsp:include where you see login.jsp included you will see the difference)
alhome.jsp

--
login.jsp
George Brown
Ranch Hand

Joined: Sep 26, 2000
Posts: 919
by the way, you may need to remove the header and footer includes to see what i mean (i've not included those files, or the .css, so the page might look a bit odd, but you should see what i mean).
You will probably also need to hardcode some of the bean tags...
[ April 03, 2003: Message edited by: George Brown ]
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 5287
    
  10

Not sure if what you posted for login.jsp is elided or not but if it isn't then you need to declare the taglib tlds again for them to work with the dynamic jsp:include
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how do i find the referring page in struts