aspose file tools*
The moose likes Struts and the fly likes Redirect  in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Redirect  in Struts" Watch "Redirect  in Struts" New topic
Author

Redirect in Struts

Harish Vembu
Ranch Hand

Joined: Jul 19, 2004
Posts: 33

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


Harish
SCJP ,SCDJWS
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
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 ]

Merrill
Consultant, Sima Solutions
Harish Vembu
Ranch Hand

Joined: Jul 19, 2004
Posts: 33

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

Joined: Feb 15, 2005
Posts: 4864
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Redirect in Struts