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

Difference in <html:link> and <html:submit>

Shahnawaz Shakil
Ranch Hand

Joined: Aug 04, 2008
Posts: 57
I am having 4 jsp pages named login.jsp, redirecting.jsp, resultIE.jsp and resultSafari.jsp Also i have an Action method processLogin(). In the login page, user should enter username and password and press the submit button <html:submit>. On submitting the button the processLogin() method is executed and if user name and password is correct then it is going to redirecting.jsp. The redirecting.jsp is having javascript to detect the browser from which the request is comming. If the request is comming from Internet Explorer, it should redirect it to resultIE.jsp and if it is coming from Safari browser it should redirect it to resultSafari.jsp. This is working fine when i am using <html:submit> but when i am using <html:link> tag then it is not working. Please help me why html:link is not working in this situation?
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Shahnawaz,
html:link is altogether different from html:submit, former is for referencing other links/resources from page and later is for submitting a html:form. html:link is get parsed or converted as <a href="".. />, ultimately..

Look what Struts says about html:link !

Now, though you can call an action using html:link, but this is not the true use of it, Why do you want a login page submitted by html:submit, really not a good practice.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Shahnawaz Shakil
Ranch Hand

Joined: Aug 04, 2008
Posts: 57
Hi Sagar,
Thanks for the reply.
I want to use <html:link> because the button is not looking good on my present page. As i said earlier my redirecting.jsp page is having javascript to detect the browser. Strangely when i am removing the javasript from that page and make it a simple hello world page, then i am able to get that page using <html:link>. Please advice.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

I'm not sure how anybody could help much without seeing the code.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Shahnawaz Shakil wrote:I want to use <html:link> because the button is not looking good on my present page.

Then use CSS, that's decorate your button the way you want, googling provides you the plenty of hits regarding how to do that. And about rest of your doubt I don't get it, Follow what David suggested.
Shahnawaz Shakil
Ranch Hand

Joined: Aug 04, 2008
Posts: 57
Thanks Sagar and David for your help. I am using <html:submit> now instead of <html:link>. Can't give the code here as its very long. But thanks you all for your help.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Shahnawaz Shakil wrote:Can't give the code here as its very long.

Then, IsolateTheProblem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference in <html:link> and <html:submit>