• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

understanding Struts 1 with JSPs: How is the control flow when directly requesting a JSP?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am quite new to J2EE and need to understand and debug an application based on Struts 1. It is running on JBoss. Can anybody point me in the right direction for this question:

When a JSP is directly accessed in the browser, how is the control flow; where is the entry point? I know that Struts is a front controller and there is an ActionServlet.

When setting a breakpoint (Eclipse) in the init() method of the servlet (it is derived from ActionServlet) and launching the debugger, it does not stop there. I don't understand why. Also I have a breakpoint in a custom tag which is called in the JSP. The debugger DOES stop there.

So, my question is: When directly accessing a JSP, why isn't the request routed through the ActionServlet? Is there another central entry point for ALL requests, not only to actions but to the JSPs directly?
 
Ranch Hand
Posts: 122
Mac IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The request wont be routed to the ActionServlet if you dont have a rule that says to direct it to the action servlet. If you access the JSP directly its going to try to render that JSP which means that it will also evaluate all your tags in the JSP. Its the same thing if you access an html file, any images etc ... it wont go through any ActionServlet. You need to check your web.xml to see what your servlet mappings are.

In order to go through the action you need to find which action to use that is configured with your ActionServlet via the struts-config.xml file. Access that action and your ActionServlet should execute and if the jsp your accessing is the success jsp configured then it will render that jsp.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic