wood burning stoves
The moose likes Struts and the fly likes Struts html:link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts html:link" Watch "Struts html:link" New topic

Struts html:link

A Tata

Joined: Mar 18, 2005
Posts: 2
I have some html links in my jsp page which when clicked should send me to another section on the same page.

1. When i use html anchors directly <a></a> (I am using Struts along with tiles) it always tries to reload the page based on the definition in tiles.

The problem is I dont want it to reload the page as I need to supply all the request parameters that have been passed earlier to the page. Rather i would want it to just take to me the corresponding section on the same page (just how a normal anchor works when no struts or tiles are used)

Things work fine when no tiles are used.

Is there any way I can do this. Is there a struts tag which just takes me to a different section of the same page without reloading.

Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Are you using a full URL or a relative one? I would think a relative URL would prevent a trip to the server.

relative URL:

<a href="#section2">Section 2</a>

vs. full URL:

<a href="MyPage.do#section2">Section 2</a>

Junilu - [How to Ask Questions] [How to Answer Questions]
A Tata

Joined: Mar 18, 2005
Posts: 2
I have tried both relative and absolute URL but doesnt help.

I think the problem is with the usage of tiles where i define my header and footer and the body in a Layout.jsp

When i use relative URL(<a href="#output></a> in a given file it is going to the Layout.jsp as opposed to the file itself. This is causing a problem.

Absolute URL ofcourse is doing what it is supposed to do. - reload the page.

Tried struts html:link page and other attributes - All of them reload the page.

I want to know if there is any struts tag or anything else that prevents this reloading but just takes me to a different section in the same page when using struts and Tiles.

I agree. Here's the link: http://aspose.com/file-tools
subject: Struts html:link
It's not a secret anymore!