You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jim Reynolds <ji...@gmail.com> on 2006/10/18 23:09:45 UTC

MailReader Example Struts2

I am trying to figure out how Struts2 works, so I am going through the
docs at <http://planetstruts.org/struts2-mailreader/Tour.do#Welcome>
and walking the code.

Problem: I cannot figure out how the Welcome.java which subclasses
MailreaderSupport gets the data to and from the xml? I see the
database.xml file getting written to ... but sadly, I cannot figure
how how the file gets loaded?

I do not see any IOC going on unless I am missing it. If anyone
understands how this code works and could give me any pointers, I
would appreciate.

Thanks,

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: MailReader Example Struts2

Posted by Ted Husted <hu...@apache.org>.
The MailReader database is loaded through a listerner in the web.xml,
which "injects" it into application scope. The data is not coming from
the XML. The listerner parses the XML and creates a database object.
The MailReader then addresses the database object, oblivious as to how
it is loaded or where it is saved.

Of course, that part has nothing to do with Struts 2 per se :) Struts
1 and Shale use the same MailReader DAO bits as Strus 2.

The nifty Struts 2 part is that MailReader support class doesn't need
to import the HTTP API. The framework injects a Map into the Action
that proxies application scope, but all the Action sees is a plain old
Map.

-Ted.

On 10/18/06, Jim Reynolds <ji...@gmail.com> wrote:
> I am trying to figure out how Struts2 works, so I am going through the
> docs at <http://planetstruts.org/struts2-mailreader/Tour.do#Welcome>
> and walking the code.
>
> Problem: I cannot figure out how the Welcome.java which subclasses
> MailreaderSupport gets the data to and from the xml? I see the
> database.xml file getting written to ... but sadly, I cannot figure
> how how the file gets loaded?
>
> I do not see any IOC going on unless I am missing it. If anyone
> understands how this code works and could give me any pointers, I
> would appreciate.
>
> Thanks,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
HTH, Ted.
* http://www.husted.com/struts/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org