Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to forward to jsp page and then jump to anchor of the page

 
Usera User
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to forward to jsp page and then jump to anchor of the page. I have defined the anchor <a name='insert'> in the destination page and using the forward defination in action element in struts-config.xml

<forward name="Success" path="view_data.jsp#insert">

But it doesn't work, the error is page not found.

Has any idea ?
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following...

<forward name="Success" path="/view_data.jsp#insert">
 
Usera User
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does not work. It seems that the server want to find the file "view_data.jsp#insert". The "#insert" is part of the filename.
 
sarvesh khatri
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Instead of putting the anchor in struts-config.xml, append it at calling time
Following example might help

<action name="BaseForm" path="/viewdata" scope="request" type="BaseAction">
<forward name="Success" path="view_data.jsp">
</action>

When calling above action
/viewdata.do#insert
 
Srilakshmi Vara
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My situation is same, any ideas
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
don't know if it's the best solution, but if you executed



based on a condition which you evaluated in the jsp, it will make IE (not FF...) jump to the anchor.

the hard way, i know, but it works...

jan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic