• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts html:link

 
A Tata
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks
 
Junilu Lacar
Bartender
Posts: 7598
53
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
A Tata
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic