Hey rockdale,
I don’t know if I understood your question correctly.
But I try anyways.
The java Servlets handle incoming requests.
Back in the day you had to write your own servlet for each url/request type/etc.
Depending on what you wanted to do.
Later a framework called Spring MVC was introduced, which were supposed to make
things easier.
In OpenNMS we use the old custom servlet pattern and also use Spring MVC.
Sometimes we use the “Hack the JSP” “pattern" and sometimes we use the “Spring
MVC” pattern or a mix of both.
In order to find who is responsible for generating the output html, you have to
know where to look.
First go to the web.xml in “opennms-webapp/src/main/webapp/WEB-INF”.
There are all custom servlets defined. There is also the line
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
which indicates that all url’s ending with “*.htm” are handled by a servlet
named “dispatcher”.
The Servlet itself is defined as
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
If you read the Spring MVC documentation (which I spare you the details) you
know that there is a file “dispatcher-servlet.xml” in
opennms-webapp/src/main/webapp/WEB-INF which defines even more mappings.
But now for a Controller instead of a servlet *yay*
In that file you should be able to find the answers you are looking for:
<bean name="/admin/notification/noticeWizard/eventNotices.htm"
class="org.opennms.web.controller.admin.notifications.EventNoticesController">
<property name="eventConfDao" ref="eventConfDao"/>
<property name="notificationFactory" ref="notificationFactory"/>
</bean>
And
<bean name="/admin/thresholds/index.htm"
class="org.opennms.web.controller.admin.thresholds.ThresholdController">
<property name="resourceDao" ref="resourceDao"/>
<property name="eventConfDao" ref="eventConfDao"/>
</bean>
This means that the “EventNoticesController” and the “ThresholdController” will
deal with incoming requests for the url pattern (bean name) and will also
define which jsp is used for rendering.
The methods to handle the requests usually return a ModelAndView which must
contain the jsp file location (probably without .jsp extension), e.g.
private ModelAndView gotoGroupEdit(String groupName) {
ThresholdingConfigFactory configFactory =
ThresholdingConfigFactory.getInstance();
ModelAndView modelAndView = new ModelAndView("admin/thresholds/editGroup");
modelAndView.addObject("group", configFactory.getGroup(groupName));
return modelAndView;
}
Which results in the page
“opennms-webapp/src/main/webapp/WEB-INF/jsp/admin/thresholds/editGroup.jsp”
beeing rendered with a property “group” available in the jsp rendering.
For more details about Spring MVC see
https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html
<https://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html>.
If you need more hands-on help, feel free to join the “OpenNMS Develiopment”
channel at https://chat.opennms.org <https://chat.opennms.org/>
Kind regards
- Markus
> On 6 Feb 2017, at 15:39, Rockdale Green <rockdale.gr...@gmail.com> wrote:
>
> Hi, all:
>
>
> I am pretty new to OpenNMS (and jsp/java servlet in general, but have
> background in other web dev platform - Asp.net, PHP and AngularJS). I have
> read developer guide at
> https://docs.opennms.org/opennms/releases/latest/guide-development/guide-development.html
>
> <https://docs.opennms.org/opennms/releases/latest/guide-development/guide-development.html>
> but still have some questions. Specifically, these two pages, I can see they
> are dynamically generated since there is no static htm files exist under that
> directory. But I just could not find who (a servlet?) and where these pages
> get generated and where their data come from. Can you point me to the right
> direction (any documentations links also very helpful, I need to read up more
> regarding "rendering htm" on server side in java servlet, is this the
> technology used here) ?
>
>
> Admin > Configuration > Configure Notification > Configure Event Notification
> opennms/admin/notification/noticeWizard/eventNotices.htm
> <http://10.100.249.31:8083/opennms/admin/notification/noticeWizard/eventNotices.htm>
>
> <image.png>
>
> Admin > Configuration > Configure Threshold
>
>
> <image.png>
>
> in the index.jsp, it includes
> <jsp:include page="/admin/thresholds/index.htm" flush="false"/>
> opennms/admin/thresholds/index.htm
> <http://10.100.249.31:8083/opennms/admin/thresholds/index.htm>
>
>
> Thanks in advance
> -rockdale
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org!
> http://sdm.link/slashdot_______________________________________________
> Please read the OpenNMS Mailing List FAQ:
> http://www.opennms.org/index.php/Mailing_List_FAQ
>
> opennms-devel mailing list
>
> To *unsubscribe* or change your subscription options, see the bottom of this
> page:
> https://lists.sourceforge.net/lists/listinfo/opennms-devel
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ
opennms-devel mailing list
To *unsubscribe* or change your subscription options, see the bottom of this
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel