• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Redirect in Struts

 
Harish Vembu
Ranch Hand
Posts: 33
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

Since I am quite new to Struts playing field. I am asking the below query

I tried to use a simple a simple redirect Strut HTML tag in my jsp page as given Struts Survival Guide book

<html:link page="CustomerDetails.jsp">Customer Form</a>

but its having error stating that there is no opening <a> tag,which appears obvious.

Can someone advise quickly where I am going wrong with the above.

I also came to know about <logic:redirect> tag. Are there alternative ways to achieve it.

Many Thanks in Anticipation

Harish
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom tags must follow the rules of XML. When you have a beginning tag, you must have an ending tag that is the same as the beginning tab except that it starts with "/". The ending tag for your <html:link> must not be </a> but rather </html:link>.
[ July 31, 2007: Message edited by: Merrill Higginson ]
 
Harish Vembu
Ranch Hand
Posts: 33
Java MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Merill for the speedy response. Yes there should be closing </html:link> tag . It was my typo error :-).

But what I need is automatic redirection to an external web application/site from my web jsp page/application instead of just a link.

For Example

<html:link page="http://www.yahoo.com">YAHOO</a></html:link>

What tag should I use in that case?

Regards,

Harish
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The logic:redirect tag will do this. Be careful, though, as it must be executed before any portion of the JSP is rendered. Othewise, you'll get an error. For more details on this tag, see the heading "redirect" in this link.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic