permaculture playing cards*
The moose likes Struts and the fly likes html:link tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:link tag" Watch "html:link tag" New topic
Author

html:link tag

Nag Bussa
Greenhorn

Joined: Nov 14, 2007
Posts: 6
Hi All,
I have a link in my JSP. If I click on that link, it should take me to named section(named with XYZ i.e <a name="XYZ"> in another JSP page.

Code in JSP:


This code is basically generating anchor tag like this:


This way, I am going to target jsp but not to the XYZ section in the target JSP.

Is there any other parameter I should use in <html:link> tag to go the appropriate section in target JSP?

Thanks.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Because you are going through an intermediary action before getting to the JSP, using the anchor attribute isn't going to work.

I'd suggest passing an anchor parameter along with the URL. Then in your action class, you can set the anchor before forwarding to the JSP. Example:


Merrill
Consultant, Sima Solutions
Nag Bussa
Greenhorn

Joined: Nov 14, 2007
Posts: 6
Thanks Merill.
I am using Tiles in my application. The code below gives me tiles name but doesn't resolve to actual jsp.



How do I take the control to actual JSP? Thanks for your inputs.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The fact that you're using tiles makes the problem much worse. I have no idea how to accomplish this with tiles, and I'm not even sure it's possible. Any tiles experts out there want to tackle this one?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: html:link tag