This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In one of my application I have to use <a>tag of html to call an action.In the href if i call my .do it is not working .Usually we call in the form action , but if i have to call through image or link like this.
I don't know whether my concept is right or wrong, but through a common html link <a href .....> you cannot activate an action. To activate a struts action through a link, struts provides its own link tag and I hope you must know about it. Its <html:link>. try to read a little bit detail about it in struts-documentation. I am providing a small example about activating an action through <html:link> tag.
Suppose your struts-config.xml file has entries like below.
Now suppose in your page1.jsp has an entry like...
<html:link forward="home">Click Here For Homepage</html:link>
Now what it tells, when in your page1.jsp page you will click on that link, it'll search your struts-config.xml file for a forward with name home. And in your struts-config file you have actually activated once action index.do for this forward name. Right ?? Now ultimately you'll be forwarded to homepage.jsp page. If you'll view the source of that page1.jsp then, you'll find that above link statement is converted to <a href="/homepage.jsp">Click Here For Homepage</a>.