You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Neil Pitman <np...@interlink.net> on 2002/04/01 22:57:37 UTC

Re: Is this ok architecture for struts?

Rick,

I am a newbie.  What is the motivation to having two business objects? 
Is BO-II just a wrapper for use cae specific behavior? or does it have 
all the business logic and leave BO-I as a just the physical DB work?

Could this be expressed in EJB terminology?

Rick Reumann wrote:

> I'm wondering if this a decent design architecture for a non-EJB web
> application using Struts. I'd appreciate any comments or advice. (Does
> it break any J2EE principles or not follow any, etc.) For this small
> example, this architecture is just for wanting to display a list of
> employees in a JSP page:
> 
> BusinessDB Object I
>     - database query returns ArrayList of EmployeeBean objects (these
>       EmployeeBean objects have different datatype members other than
>       String).
> 
> Business Object II
>     - makes call to above Buisness1 Object to get the ArrayList of
>       EmployeeBeans. Now iterates through this List and makes
>       a new ArrayList of EmployeeForm objects that have proper String
>       representations of the EmployeeBean datatypes (ie- birthDate
>       in 08/11/1969 format, double salary in currency format, etc).
> 
> EmployeeAction Object (using EmployeeForm object )
>     - typical struts action. Makes call to above Business object to get 
>       ArrayList of EmployeeForm objects and puts them into the request or 
>       session
>       
> JSP
>     use iterate tag and bean tag to display the EmployeeForm properties
> 
>     
> --
> 
> Rick
> 
> mailto:maillist@reumann.net
> 
> "Any man, in the right situation, is capable of murder. But not any
> man is capable of being a good camper. So, murder and camping are not
> as similar as you might think."
>   -Jack Handey
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 


-- 
Neil Pitman
npitman@interlink.net
+1.514.863.5465


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re[2]: Is this ok architecture for struts?

Posted by Rick Reumann <ma...@reumann.net>.
On Monday, April 1, 2002, 3:57:37 PM, Neil wrote:

NP> I am a newbie.  What is the motivation to having two business objects? 
NP> Is BO-II just a wrapper for use cae specific behavior? or does it have 
NP> all the business logic and leave BO-I as a just the physical DB work?

    Sorry Neil, I guess this long thread lost bits and pieces along
    the way of the original 'problem'. The reason why I'm thinking of
    the business Object II below is because with struts you have these
    great FormBean objects that you create with String parameters so
    when the JSP forms submit the Form bean is automatically
    populated. The problem I'm dealing with is how to handle the
    non-String datatypes, especially when pulling back your collection
    of beans that you populated form a ResultSet. Normally I like to
    have bean member variables represent the appropriate datatype (ie-
    Date, double, whatever ). However, if you just deal with a normal
    bean in this way you then can't use this bean 'as is' using the
    bean tag in the JSP pages since it deals with String members.
    Anyway, I don't repost all the details, but I can comment more
    about it if you aren't sure of the situation I'm trying to best
    resolve.
    
NP> Could this be expressed in EJB terminology?

NP> Rick Reumann wrote:

>> I'm wondering if this a decent design architecture for a non-EJB web
>> application using Struts. I'd appreciate any comments or advice. (Does
>> it break any J2EE principles or not follow any, etc.) For this small
>> example, this architecture is just for wanting to display a list of
>> employees in a JSP page:
>> 
>> BusinessDB Object I
>>     - database query returns ArrayList of EmployeeBean objects (these
>>       EmployeeBean objects have different datatype members other than
>>       String).
>> 
>> Business Object II
>>     - makes call to above Buisness1 Object to get the ArrayList of
>>       EmployeeBeans. Now iterates through this List and makes
>>       a new ArrayList of EmployeeForm objects that have proper String
>>       representations of the EmployeeBean datatypes (ie- birthDate
>>       in 08/11/1969 format, double salary in currency format, etc).
>> 
>> EmployeeAction Object (using EmployeeForm object )
>>     - typical struts action. Makes call to above Business object to get 
>>       ArrayList of EmployeeForm objects and puts them into the request or 
>>       session
>>       
>> JSP
>>     use iterate tag and bean tag to display the EmployeeForm properties
>> 
>>     
>> --
>> 
>> Rick
>> 
>> mailto:maillist@reumann.net
>> 
>> "Any man, in the right situation, is capable of murder. But not any
>> man is capable of being a good camper. So, murder and camping are not
>> as similar as you might think."
>>   -Jack Handey
>> 
>> 
>> --
>> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>> For additional commands, e-mail: <ma...@jakarta.apache.org>
>> 
>> 




-- 

Rick
mailto:maillist@reumann.net

"As we were driving, we saw a sign that said 'Watch for Rocks.' Marta
said it should read 'Watch for Pretty Rocks.' I told her she should
write in her suggestion to the highway department, but she started
saying it was a joke - just to get out of writing a simple letter! And
I thought I was lazy!" 
  -Jack Handey


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ApplicationResources.properties

Posted by srinivas <sv...@intensit.de>.
Its part of 1.0

this is what the ActionServlet does on start up. Snippet from
org.apache.struts.action.ActionServlet class.

    protected void initApplication() throws ServletException {

	String value = getServletConfig().getInitParameter("application");
	if (value == null)
	    return;
        String factory =
            getServletConfig().getInitParameter("factory");
	if (debug >= 1)
	    log(internal.getMessage("applicationLoading", value));
	try {
            String oldFactory =
                MessageResourcesFactory.getFactoryClass();
            if (factory != null)
                MessageResourcesFactory.setFactoryClass(factory);
            MessageResourcesFactory factoryObject =
                MessageResourcesFactory.createFactory();
            application = factoryObject.createResources(value);
            MessageResourcesFactory.setFactoryClass(oldFactory);
	    value = getServletConfig().getInitParameter("null");
	    if (value == null)
		value = "true";
	    if (value.equalsIgnoreCase("true") ||
		value.equalsIgnoreCase("yes"))
		application.setReturnNull(true);
	    else
		application.setReturnNull(false);
	} catch (Throwable e) {
	    log(internal.getMessage("applicationResources", value), e);
	    throw new UnavailableException
		(internal.getMessage("applicationResources", value));
	}
	getServletContext().setAttribute(Action.MESSAGES_KEY, application);

    }

-----Original Message-----
From: Wellie W. Chao [mailto:wchao@caraveltech.com]
Sent: Tuesday, April 02, 2002 11:01 PM
To: Struts Users Mailing List
Subject: RE: ApplicationResources.properties


Is the "application" parameter a relic from 1.0 or is it required in 1.1? I
have an entry in struts-config.xml that seems to serve the same purpose:

<message-resources
parameter="com.mycompany.myproject.ApplicationResources"/>

The reason I ask is that I recently began having problems accessing entries
in ApplicationResources. I'll try adding it to web.xml.

-----Original Message-----
From: srinivas [mailto:sv@intensit.de]
Sent: Tuesday, April 02, 2002 2:35 PM
To: Struts Users Mailing List
Subject: RE: ApplicationResources.properties


hello,
u need to have it in your classpath and  hence under /webapp only
In fact u can place in any directory u want under classes and configure ur
web server, in case of tomcat its like this.
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>com.test.properties.ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

regards,
srinivas
-----Original Message-----
From: K J [mailto:tony_dinapoli@yahoo.com]
Sent: Tuesday, April 02, 2002 10:14 PM
To: Struts Users Mailing List
Subject: ApplicationResources.properties


In the struts example application, this properties
file is under both /source and /webApp. does it need
to be under both directories?

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ApplicationResources.properties

Posted by "Wellie W. Chao" <wc...@caraveltech.com>.
Is the "application" parameter a relic from 1.0 or is it required in 1.1? I
have an entry in struts-config.xml that seems to serve the same purpose:

<message-resources
parameter="com.mycompany.myproject.ApplicationResources"/>

The reason I ask is that I recently began having problems accessing entries
in ApplicationResources. I'll try adding it to web.xml.

-----Original Message-----
From: srinivas [mailto:sv@intensit.de]
Sent: Tuesday, April 02, 2002 2:35 PM
To: Struts Users Mailing List
Subject: RE: ApplicationResources.properties


hello,
u need to have it in your classpath and  hence under /webapp only
In fact u can place in any directory u want under classes and configure ur
web server, in case of tomcat its like this.
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>com.test.properties.ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

regards,
srinivas
-----Original Message-----
From: K J [mailto:tony_dinapoli@yahoo.com]
Sent: Tuesday, April 02, 2002 10:14 PM
To: Struts Users Mailing List
Subject: ApplicationResources.properties


In the struts example application, this properties
file is under both /source and /webApp. does it need
to be under both directories?

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: ApplicationResources.properties

Posted by srinivas <sv...@intensit.de>.
hello,
u need to have it in your classpath and  hence under /webapp only
In fact u can place in any directory u want under classes and configure ur
web server, in case of tomcat its like this.
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>com.test.properties.ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>

regards,
srinivas
-----Original Message-----
From: K J [mailto:tony_dinapoli@yahoo.com]
Sent: Tuesday, April 02, 2002 10:14 PM
To: Struts Users Mailing List
Subject: ApplicationResources.properties


In the struts example application, this properties
file is under both /source and /webApp. does it need
to be under both directories?

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


ApplicationResources.properties

Posted by K J <to...@yahoo.com>.
In the struts example application, this properties
file is under both /source and /webApp. does it need
to be under both directories?

thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re:

Posted by Jefferson Rodrigues de Oliveira e Silva <je...@edb.ericsson.se>.
it comes from the Resources file.
Take a look in your <file>.properties, mainMenu.registration should
be there.


K J wrote:

> in:
> <bean:message key="mainMenu.registration"/>
>
> where does the value of
> registration(mainMenue.registration) come from? can
> someone explain to me how this works?
>
> also, does anyone know of any good on-line tutorials
> on using tag libraries, other than the ones on Strut'
> site?
>
> many thanks!
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://http://taxes.yahoo.com/
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Posted by K J <to...@yahoo.com>.
in:
<bean:message key="mainMenu.registration"/>

where does the value of
registration(mainMenue.registration) come from? can
someone explain to me how this works?

also, does anyone know of any good on-line tutorials
on using tag libraries, other than the ones on Strut'
site?

many thanks!

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Is this ok architecture for struts?

Posted by Phase Web and Multimedia <ma...@phase.ws>.
This sounds good to me. It is the type of structure I have been using.

Brandon Goodin
Phase Web and Multimedia
P (406) 862-2245
F (406) 862-0354
mail@phase.ws
http://www.phase.ws


-----Original Message-----
From: Neil Pitman [mailto:npitman@interlink.net]
Sent: Monday, April 01, 2002 1:58 PM
To: Struts Users Mailing List
Subject: Re: Is this ok architecture for struts?


Rick,

I am a newbie.  What is the motivation to having two business objects?
Is BO-II just a wrapper for use cae specific behavior? or does it have
all the business logic and leave BO-I as a just the physical DB work?

Could this be expressed in EJB terminology?

Rick Reumann wrote:

> I'm wondering if this a decent design architecture for a non-EJB web
> application using Struts. I'd appreciate any comments or advice. (Does
> it break any J2EE principles or not follow any, etc.) For this small
> example, this architecture is just for wanting to display a list of
> employees in a JSP page:
>
> BusinessDB Object I
>     - database query returns ArrayList of EmployeeBean objects (these
>       EmployeeBean objects have different datatype members other than
>       String).
>
> Business Object II
>     - makes call to above Buisness1 Object to get the ArrayList of
>       EmployeeBeans. Now iterates through this List and makes
>       a new ArrayList of EmployeeForm objects that have proper String
>       representations of the EmployeeBean datatypes (ie- birthDate
>       in 08/11/1969 format, double salary in currency format, etc).
>
> EmployeeAction Object (using EmployeeForm object )
>     - typical struts action. Makes call to above Business object to get
>       ArrayList of EmployeeForm objects and puts them into the request or
>       session
>
> JSP
>     use iterate tag and bean tag to display the EmployeeForm properties
>
>
> --
>
> Rick
>
> mailto:maillist@reumann.net
>
> "Any man, in the right situation, is capable of murder. But not any
> man is capable of being a good camper. So, murder and camping are not
> as similar as you might think."
>   -Jack Handey
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
Neil Pitman
npitman@interlink.net
+1.514.863.5465


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>