This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes .do vs .page question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark ".do vs .page question" Watch ".do vs .page question" New topic
Author

.do vs .page question

Tina Long
Ranch Hand

Joined: Mar 04, 2005
Posts: 36
I'm trying to learn struts...and I have some confusion that I'm hoping someone can shed some light on...

We have a web applicatoin and in the struts config file - there are different forwards depending on if the operation was sucessful or not. There are two different types of paths that we have in the file...

<forward name="success" path="/folder/success.do" /><forward name="view" path="/folder/view.page" />

When there is a path = *.page then it appears that the application then looks in the tiles-def file and finds what JSP page to view. But with there is a *.do then I'm not sure what happens. How does the application know where it is supposed to look for the next operation?

Does my question make sense and does anyone know?
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

If it's *.do it is a Struts request. You will find another ActionMapping in the struts-config for each of those.


A good workman is known by his tools.
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
But with there is a *.do then I'm not sure what happens. How does the application know where it is supposed to look for the next operation?

web.xml ... servlet-mapping maps the the url-pattern to a servlet-name which in turn maps to the 'ActionServlet'... a .do request then go through ActionServlet which looks at your struts-config.xml to figure out where to go...either that or voodoo.


-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Tina Long
Ranch Hand

Joined: Mar 04, 2005
Posts: 36
so if it goes to the struts-config file - should there be an entry for the success.do?
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
it depends...if your forward is defined to point to 'success.do' then absolutely! then again, why would you? just forward it to a tile, unless you want to forward it to something that does more (set values from backend call) after forwarding.
Tina Long
Ranch Hand

Joined: Mar 04, 2005
Posts: 36
Thank you - I think I get it now
 
wood burning stoves
 
subject: .do vs .page question
 
Similar Threads
Struts urgent help ?
How is the HTML form action created from servlet-mapping url-pattern?
Help in struts
Interesting forward path
want help in iframe