Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do i find the referring page in struts

 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this

or with the javaScript
 
Junilu Lacar
Bartender
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
George Brown
Ranch Hand
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 919
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 7465
50
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic