dcsimg
Struts
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sonal_Srivastava
Posted On:   Thursday, April 22, 2004 12:08 AM

I am using struts to migrate our existing application to MVC architecture. Ours is a Identity management product, and we need to start some servers to get the functionalities of the product. At present while generating our login page we have java code in the jsp to check for the handles of those servers, and accordingly generate the login page or some error page. My requirement is that i want a java class to be executed to get and check those server handles to make sure they are running and then accordingly generate either the login page or the error page.This all should haapen when the user writes the url to access the login page and before the view page is generated. One way that i figured out was to have a welcome page, which on being submitt   More>>

I am using struts to migrate our existing application to MVC architecture. Ours is a Identity management product, and we need to start some servers to get the functionalities of the product. At present while generating our login page we have java code in the jsp to check for the handles of those servers, and accordingly generate the login page or some error page.



My requirement is that i want a java class to be executed to get and check those server handles to make sure they are running and then accordingly generate either the login page or the error page.This all should haapen when the user writes the url to access the login page and before the view page is generated.



One way that i figured out was to have a welcome page, which on being submitted executes an action class to implement these functionalities, and then generate an action forward. Is there some other way to implement this thing?

   <<Less

Re: Struts

Posted By:   Jerome_Iffrig  
Posted On:   Saturday, April 24, 2004 07:22 PM

That is a kind of strange requirement lol ... You should starting by assuming that everything is OK on the server side and act upon the problem if and when they raise rather than the other way around (that is assuming something might go wrong in the first place :-)


You have different ways to do this ...


What is usually done, and I think everybody here would agree with me, is to start off positive and ... simply rely on java exceptions in the event of a problem.


It is very easy with Struts to redirect to a predefined JSP in the case of an exception: you just have to define a global-exception in your struts-config.xml (read its DTD file for more info). You can define one for each exception (tragedy) that may happen, and also one for the class 'Exception' so you are sure to get your error page for any and all sort of exceptions (since the all inherite from Exception).


If you really feel insecure (and want to eat your server resources), you indeed can overload the Struts Dispatcher so you could check the connectivity with other servers, the tamperature of your CPU, the speed of your fan, and the number of running processes before each request :o)


Good luck with your migration, it sounds like a tough job to guess the ingredients of a cake just by looking at its picture!


Feel free to ask more questions if you need to (assuming that you have already seached for answers on this forum).


Good luck.


Jerome

About | Sitemap | Contact