You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Alex Colic <al...@pop-ware.com> on 2001/09/24 21:51:02 UTC
struts architecture question.
Hi,
I am trying to figure out if I have properly designed my classes.
I have a class that extends ActionServlet. The only reason it does that is
because all my web apps need a couple of generic objects in the application
session before anyone can use the applications.
So I overrode the doGet and doPost and init() methods. Examples are below:
public void init() throws javax.servlet.ServletException
{
super.init();
//do Some Configuration;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, javax.servlet.ServletException
{
HttpSession session= request.getSession(true);
*/
if(session.getAttribute(Constants.SERVLET_CONFIG)==null)
{
session.setAttribute(Constants.SERVLET_CONFIG, configSettings);
}
/**
* place the rdserver object in the session
*/
if((session.getAttribute(Constants.RDSERVER))==null)
{
rdServer server=new rdServer(strHost, strPort);
session.setAttribute(Constants.RDSERVER,server);
}
super.doGet( request, response);
}
I don't know what is wrong with the above it just looks wrong. And, when I
start this app in tomcat I can see that the web app is being parsed and
loaded twice.
Any design tips, comments on the above are appreciated.
Alex