How to Access methods in the MainAppServletBase class from a view bean

I would like to initialize the host url string once per the

applcation. So I decided to initialize the

url in MainAppServletBase. I have added two methods

getURL and setURL methods.

Is it possible to call the getURL() method

in in the viewbean class ? If yes how ?

Thanks

[356 byte] By [Guest] at [2007-11-25 9:26:01]
# 1

I would assume it is a static method, so just do:

MainAppServletBase.getURL()

right?

If not static, it probably should be. If you feel it should not be

static, let us know why/what your requirements are.

c

purvashada wrote:

>

> I would like to initialize the host url string once per the

> applcation. So I decided to initialize the

> url in MainAppServletBase. I have added two methods

>

> getURL and setURL methods.

>

> Is it possible to call the getURL() method

> in in the viewbean class ? If yes how ?

>

> Thanks

>

>

>

>

>

>

>

> To download the latest version of S1AF (JATO), please visit one of the

> following locations:

>

> Framework + IDE plugin for Sun ONE Studio 4 Update 1, Community Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

>

> Framework + IDE pluign for Sun ONE Studio 4 Update 1, Enterprise Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

>

> Previous versions of JATO:

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

>

>

Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...
# 2

I had added this code in the

initializeRequestContext(..)

Hoping it would be called once.

It looks like it is called for every

request.

HttpServletRequest req = requestContext.getRequest();

setActionURL(req);

If I add the code in the init() method

how can I get the HttpServletRequest getRequest() ?

Thanks

"Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>> wrote:

> cool.

> Be careful about how you update this URL when you

> use setURL method.

> The servlets in JATO are the only shared

> (Application scope rather than

> Request scope like ViewBeans and Models), and that

> you could potentially

> have sync/multithread issues. You said you were only

> updating once at

> the start of the App, so you should be fine. I

> assume you are doing this

> from an init method or init event in the servlet

> class? If so, no worries.

>

> Also, just to be sure everyone follows, I am not

> suggesting that you

> write syncronize code in the servlets as this will

> be a potential bottle

> neck in your app's scalibility. This is not a JATO

> shortcoming as there

> are alternatives to do this sort of coding.

>

> craig

>

>

> Purvashada wrote:

>

> >

> > I made the method static and is accessible..

> >

> >

> > "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>>

> wrote:

> > > I would assume it is a static method, so just

> do:

> > >

> > > MainAppServletBase.getURL()

> > > right?

> > >

> > > If not static, it probably should be. If you

> feel it

> > > should not be

> > > static, let us know why/what your requirements

> are.

> > >

> > > c

> > >

> > >

> > > purvashada wrote:

> > >

> > > >

> > > > I would like to initialize the host url string

> > > once per the

> > > > applcation. So I decided to initialize the

> > > > url in MainAppServletBase. I have added two

> > > methods

> > > >

> > > > getURL and setURL methods.

> > > >

> > > > Is it possible to call the getURL() method

> > > > in in the viewbean class ? If yes how ?

> > > >

> > > > Thanks

> > > >

> > > >

> > > >

> > > >

> > > >

> > > >

> > > >

> > > > To download the latest version of S1AF (JATO),

> > > please visit one of the

> > > > following locations:

> > > >

> > > > Framework + IDE plugin for Sun ONE Studio 4

> Update

> > > 1, Community Edition:

> > > >

> > >

> >

>

<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> > > >

> > > > Framework + IDE pluign for Sun ONE Studio 4

> Update

> > > 1, Enterprise Edition:

> > > >

> > >

> >

>

<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> > > >

> > > > Previous versions of JATO:

> > > >

> > >

> >

>

<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> > > >

> to:

> > > >

> > >

> > >

> > >

> > >

> >

> >

> > __

> >

> > To download the latest version of S1AF (JATO),

> please visit one of the

> > following locations:

> >

> > Framework + IDE plugin for Sun ONE Studio 4 Update

> 1, Community Edition:

> >

>

<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> >

> > Framework + IDE pluign for Sun ONE Studio 4 Update

> 1, Enterprise Edition:

> >

>

<a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> >

> > Previous versions of JATO:

> >

>

<a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> >

> >

> Terms of Service

>

>

>

>

__

Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...
# 3

Correct, that is a per request event.

Sounds like we need to figure out a new approach.

Please elaborate on your requirements for doing whatever it is you require.

Maybe we can suggest an alternative, or perhaps reveal that it may not

be necessary after all.

craig

Purvashada wrote:

>

> I had added this code in the

> initializeRequestContext(..)

> Hoping it would be called once.

> It looks like it is called for every

> request.

>

> HttpServletRequest req = requestContext.getRequest();

> setActionURL(req);

>

> If I add the code in the init() method

> how can I get the HttpServletRequest getRequest() ?

>

> Thanks

>

>

>

>

> "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>> wrote:

> > cool.

> > Be careful about how you update this URL when you

> > use setURL method.

> > The servlets in JATO are the only shared

> > (Application scope rather than

> > Request scope like ViewBeans and Models), and that

> > you could potentially

> > have sync/multithread issues. You said you were only

> > updating once at

> > the start of the App, so you should be fine. I

> > assume you are doing this

> > from an init method or init event in the servlet

> > class? If so, no worries.

> >

> > Also, just to be sure everyone follows, I am not

> > suggesting that you

> > write syncronize code in the servlets as this will

> > be a potential bottle

> > neck in your app's scalibility. This is not a JATO

> > shortcoming as there

> > are alternatives to do this sort of coding.

> >

> > craig

> >

> >

> > Purvashada wrote:

> >

> > >

> > > I made the method static and is accessible..

> > >

> > >

> > > "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>>

> > wrote:

> > > > I would assume it is a static method, so just

> > do:

> > > >

> > > > MainAppServletBase.getURL()

> > > > right?

> > > >

> > > > If not static, it probably should be. If you

> > feel it

> > > > should not be

> > > > static, let us know why/what your requirements

> > are.

> > > >

> > > > c

> > > >

> > > >

> > > > purvashada wrote:

> > > >

> > > > >

> > > > > I would like to initialize the host url string

> > > > once per the

> > > > > applcation. So I decided to initialize the

> > > > > url in MainAppServletBase. I have added two

> > > > methods

> > > > >

> > > > > getURL and setURL methods.

> > > > >

> > > > > Is it possible to call the getURL() method

> > > > > in in the viewbean class ? If yes how ?

> > > > >

> > > > > Thanks

> > > > >

> > > > >

> > > > >

> > > > >

> > > > >

> > > > >

> > > > >

> > > > > To download the latest version of S1AF (JATO),

> > > > please visit one of the

> > > > > following locations:

> > > > >

> > > > > Framework + IDE plugin for Sun ONE Studio 4

> > Update

> > > > 1, Community Edition:

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> > > > >

> > > > > Framework + IDE pluign for Sun ONE Studio 4

> > Update

> > > > 1, Enterprise Edition:

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> > > > >

> > > > > Previous versions of JATO:

> > > > >

> > > >

> > >

> >

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> > > > >

> > to:

> > > > >

> > > >

> > > >

> > > >

> > > >

> > >

> > >

> > > __

> > >

> > > To download the latest version of S1AF (JATO),

> > please visit one of the

> > > following locations:

> > >

> > > Framework + IDE plugin for Sun ONE Studio 4 Update

> > 1, Community Edition:

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> > >

> > > Framework + IDE pluign for Sun ONE Studio 4 Update

> > 1, Enterprise Edition:

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> > >

> > > Previous versions of JATO:

> > >

> >

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> > >

> > >

> > Terms of Service

> >

> >

> >

> >

>

>

> __

>

> To download the latest version of S1AF (JATO), please visit one of the

> following locations:

>

> Framework + IDE plugin for Sun ONE Studio 4 Update 1, Community Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

>

> Framework + IDE pluign for Sun ONE Studio 4 Update 1, Enterprise Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

>

> Previous versions of JATO:

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

>

>

Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...
# 4

OK, so how does doing this only once help you. Wouldn't you need to do

this for each individual end user?

I'm not suggesting that this is request scoped, but maybe session scoped.

If so, then do this in the module servlet's onNewSession event.

If this is per user, then storing it statically is problematic because

all users will be using the same data which I don't think you want.

Let me know if my assumptions are correct.

craig

Purvashada wrote:

>

> Basically, I need to pass the host url/request url to

> another server which then posts the results

> back to this server.

>

> I need to get the host url dynamically.

> This is what I am doing in my code to

> get the host url..

>

> URL =req.getScheme() + "://" + req.getServerName() +

> ":" + req.getServerPort();

>

> Thanks

>

>

> "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>> wrote:

> > Correct, that is a per request event.

> >

> > Sounds like we need to figure out a new approach.

> > Please elaborate on your requirements for doing

> > whatever it is you require.

> > Maybe we can suggest an alternative, or perhaps

> > reveal that it may not

> > be necessary after all.

> > craig

> >

> >

> > Purvashada wrote:

> >

> > >

> > > I had added this code in the

> > > initializeRequestContext(..)

> > > Hoping it would be called once.

> > > It looks like it is called for every

> > > request.

> > >

> > > HttpServletRequest req =

> > requestContext.getRequest();

> > > setActionURL(req);

> > >

> > > If I add the code in the init() method

> > > how can I get the HttpServletRequest getRequest()

> > ?

> > >

> > > Thanks

> > >

> > >

> > >

> > >

> > > "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>>

> > wrote:

> > > > cool.

> > > > Be careful about how you update this URL when

> > you

> > > > use setURL method.

> > > > The servlets in JATO are the only shared

> > > > (Application scope rather than

> > > > Request scope like ViewBeans and Models), and

> > that

> > > > you could potentially

> > > > have sync/multithread issues. You said you were

> > only

> > > > updating once at

> > > > the start of the App, so you should be fine. I

> > > > assume you are doing this

> > > > from an init method or init event in the servlet

> > > > class? If so, no worries.

> > > >

> > > > Also, just to be sure everyone follows, I am not

> > > > suggesting that you

> > > > write syncronize code in the servlets as this

> > will

> > > > be a potential bottle

> > > > neck in your app's scalibility. This is not a

> > JATO

> > > > shortcoming as there

> > > > are alternatives to do this sort of coding.

> > > >

> > > > craig

> > > >

> > > >

> > > > Purvashada wrote:

> > > >

> > > > >

> > > > > I made the method static and is accessible..

> > > > >

> > > > >

> > > > > "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031198039130252055210">craig.conover@s...</a>>

> > > > wrote:

> > > > > > I would assume it is a static method, so

> > just

> > > > do:

> > > > > >

> > > > > > MainAppServletBase.getURL()

> > > > > > right?

> > > > > >

> > > > > > If not static, it probably should be. If you

> > > > feel it

> > > > > > should not be

> > > > > > static, let us know why/what your

> > requirements

> > > > are.

> > > > > >

> > > > > > c

> > > > > >

> > > > > >

> > > > > > purvashada wrote:

> > > > > >

> > > > > > >

> > > > > > > I would like to initialize the host url

> > string

> > > > > > once per the

> > > > > > > applcation. So I decided to initialize

> > the

> > > > > > > url in MainAppServletBase. I have added

> > two

> > > > > > methods

> > > > > > >

> > > > > > > getURL and setURL methods.

> > > > > > >

> > > > > > > Is it possible to call the getURL() method

> > > > > > > in in the viewbean class ? If yes how ?

> > > > > > >

> > > > > > > Thanks

> > > > > > >

> > > > > > >

> > > > > > >

> > > > > > >

> > > > > > >

> > > > > > >

> > > > > > >

> > > > > > > To download the latest version of S1AF

> > (JATO),

> > > > > > please visit one of the

> > > > > > > following locations:

> > > > > > >

> > > > > > > Framework + IDE plugin for Sun ONE Studio

> > 4

> > > > Update

> > > > > > 1, Community Edition:

> > > > > > >

> > > > > >

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> > > > > > >

> > > > > > > Framework + IDE pluign for Sun ONE Studio

> > 4

> > > > Update

> > > > > > 1, Enterprise Edition:

> > > > > > >

> > > > > >

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> > > > > > >

> > > > > > > Previous versions of JATO:

> > > > > > >

> > > > > >

> > > > >

> > > >

> > >

> >

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> > > > > > >

> > email

> > > > to:

> > > > > > >

> > the

> > > > > >

> > > > > >

> > > > > >

> > > > > >

> > > > >

> > > > >

> > > > >

> > __

> > > > >

> > > > > To download the latest version of S1AF (JATO),

> > > > please visit one of the

> > > > > following locations:

> > > > >

> > > > > Framework + IDE plugin for Sun ONE Studio 4

> > Update

> > > > 1, Community Edition:

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

> > > > >

> > > > > Framework + IDE pluign for Sun ONE Studio 4

> > Update

> > > > 1, Enterprise Edition:

> > > > >

> > > >

> > >

> >

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

> > > > >

> > > > > Previous versions of JATO:

> > > > >

> > > >

> > >

> >

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

> > > > >

> > to:

> >

> === message truncated ===

>

>

> __

>

> To download the latest version of S1AF (JATO), please visit one of the

> following locations:

>

> Framework + IDE plugin for Sun ONE Studio 4 Update 1, Community Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_CE.html</a>

>

> Framework + IDE pluign for Sun ONE Studio 4 Update 1, Enterprise Edition:

> <a href="http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html"> ;http://wwws.sun.com/software/download/products/Appl_Frmwk_2.0_EE.html</a>

>

> Previous versions of JATO:

> <a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>

>

>

Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...
# 5
I am new to JATO can u pls tell me the usage of this file...ModelTypeMapImpl.javaand can u tell me which method to call to populate alistbox with some data recieved from the database. __
Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...
# 6
I am new to JATO can u pls tell me the usage of this file...ModelTypeMapImpl.javaand can u tell me which method to call to populate alistbox with some data recieved from the database. __
Guest at 2007-7-1 16:30:07 > top of Java-index,Development Tools,Java Tools...