Struts servlet debug log entries - go to where??

2001-11-18 Thread Greg Callaghan

Hi,

[A repost as I didn't get a reply as far as I'm aware]

Can anyone help our in terms of use of the struts debug logging please.  I 
have a few questions -:

[1] Where do the servlet debug log messages go to in terms of file and path?
  I can't seem to find them!  For example the struts example

if (servlet.getDebug() >= 1)
   servlet.log("LogonAction: User '" + user.getUsername() +
   "' logged on in session " + session.getId());

[2] Is there something beyond setting the servlet debug parameter in the
web.xml file for the app that is required to get debug happening.  That is
-:


  debug
  3


[3] Any thoughts on whether there is benefit in going to Log4j above and
beyond the struts servlet debug functionality?


Thanks in advance
Greg


_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
To unsubscribe, e-mail:   

For additional commands, e-mail: 




_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Setting up a form in an action

2001-11-18 Thread Scriven, Marcos

I am trying to do this sequence of events:

1) setupProductForm.do?isin=abcd

2) This creates a productForm instance, and initialises the product, based
on the given ISIN

3) persistProduct - This should save the product

What happens at the moment is my form is my setupProductForm action
correctly loads the product, and sets it on the form:

productForm.setTradeProduct(tradeProduct);

On success, I forward to 'success', which maps to productForm.jsp

 
The action in productForm is persistProduct

When I submit this form, in the validate() method I output the tradeProduct
to the console - this confirms that a new form has been created, and the
attributes persisted from the values in the form.

This wouldn't be a problem, but I have a productID, which is not in the
form, and I don't think it should be. For that reason, it's just the default
'-1' I set it to in the static intialiser.

Do I have to have unseen attributes as hidden fields in the JSP, and why? 

My struts-config entry for these two actions is:



  




  
 

Any ideas why this is happening, or how I should get around it?

Thanks

Marcos

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Using tiles and expresso

2001-11-18 Thread Peter Georgiou

Hi

My question regards using struts with tiles and expresso.   For tiles I need
to define in web.xml:

org.apache.struts.tiles.ActionComponentServlet   and for expresso I need
to define in web.xml:

com.jcorporate.expresso.core.controller.ExpressoActionServlet.

If I want to use both Tiles and Expresso what can I do to include both of
the required Action classes.  The only way I can think of is to include the
implementation of one within the other.  I'm ion.assuming that I can only
use one Action servlet within an applicat

Thanks

Peter









--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




reusing form for readonly

2001-11-18 Thread Scriven, Marcos

Hi

I have a form which can be in several different modes: VIEW, ADD, EDIT, and
DELETE

If I am in view mode (which I have enumerated as 0 in an interface called
WebConstants.VIEW), I want the values in my  fields to be
readonly.

I can do this on a field by field basis, as such:








However, is there a shorter/more succinct way? I have many fields within my
form, and adding all these equal/notEqual tags adds a lot of lines to my JSP


Thanks

Marcos

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: getting username of logged in user

2001-11-18 Thread Bradley M. Handy

To my knowledge getRemoteUser() only works if you use Tomcat's Security
Realms (Memory, LDAP, or JDBC).

The use of these realms is covered in the Tomcat documentation.

Brad

> -Original Message-
> From: Sean Owen [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 18, 2001 7:00 AM
> To: Struts Users Mailing List
> Cc: [EMAIL PROTECTED]
> Subject: Re: getting username of logged in user
>
>
> The "request" variable in the JSP has two methods that might help you,
> getRemoteUser() and getUserPrincipal().
>
> Sean
>
> - Original Message -
> From: <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, November 18, 2001 10:27 AM
> Subject: getting username of logged in user
>
>
> > Hi all,
> >
> > couldn't find this one in the archives:
> >
> > how do I get the username of the user that is logged in, from within a
> > JSP-file?
> >
> > Thanks,
> > Michel
> >
> >
> > --
> > To unsubscribe, e-mail:
> 
> > For additional commands, e-mail:
> 
>
>
>
> _
>
> Do You Yahoo!?
>
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
>
>
> --
> To unsubscribe, e-mail:
> 
> For additional commands, e-mail:
> 
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Application scope vs. Singletons

2001-11-18 Thread Robert Taylor

Thanks Sean,

> For example, in a project I worked on we had a lot of HTML form "select"
> drop-down lists whose values were stored in the database. We
> subclassed the
> ActionServlet and added code to the init() method that created Lists of
> "Option" objects (simple name-value pair objects) and put these into the
> servlet context under keys like "select_user_role", "select_contact_type",
> etc.
This is basically what I would like to do except I want to able to "refresh"
those
lists in case the data changes. That is why I had thought about using a
central
point for managing these caches. I guess I could access the individual lists
in
the same manner as the tags (grab them from the appropriate scope
[request, session, or application] using the attribute name) when I perform
the
update and refresh them at that point.


> Also, just note that the Singleton pattern would give one instance per
> classloader... so if you used the Singleton outside the web application it
> would create a second instance.
Good point. I forgot that web apps use a separate classloader.


This helps, thanks again.

robert

> -Original Message-
> From: Sean Owen [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 18, 2001 6:57 AM
> To: Struts Users Mailing List
> Cc: [EMAIL PROTECTED]
> Subject: Re: Application scope vs. Singletons
>
>
> I think you are right, though I would add that in some cases, application
> scope can be more convenient because Struts provides support for accessing
> things in the servlet context.
>
> For example, in a project I worked on we had a lot of HTML form "select"
> drop-down lists whose values were stored in the database. We
> subclassed the
> ActionServlet and added code to the init() method that created Lists of
> "Option" objects (simple name-value pair objects) and put these into the
> servlet context under keys like "select_user_role", "select_contact_type",
> etc.
>
> Done this way, the Struts html:options tag can automatically build the
> drop-down from these lists:
> 
> So in this case it was preferable to use the servlet context for
> this data.
>
>
> Also, just note that the Singleton pattern would give one instance per
> classloader... so if you used the Singleton outside the web application it
> would create a second instance.
>
>
> Sean
>
>
> - Original Message -
> From: "Robert Taylor" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, November 18, 2001 10:49 AM
> Subject: Application scope vs. Singletons
>
>
> > Greetings, I'm developing a web application where I will need to cache
> some
> > data (retrieved from the data store) which does not change often. I wish
> to
> > make the cache available to all classes in my web app. I have read a
> couple
> > threads that recommend placing this information within the application
> scope
> > and I was wondering if there is a disadvantage to using a singleton
> > instead.
> >
> > For example, I could have an object called CacheManager with a static
> method
> > getInstance(), which always returned the same instance
> (singleton pattern)
> > and therefore I could call CacheManager.getInstance() etc... instead of
> have
> > to make the
> > servlet.getServletConfig().getServletContext().getAttribute("cacheMan").
> It
> > also allows any classes that live outside of the web layer to
> gain access
> to
> > the cache if necessary. I guess I don't see the motivation
> behind placing
> > something like a CacheManager in application scope.
> >
> > Any feedback is welcome.
> >
> > robert
> >
> >
> > --
> > To unsubscribe, e-mail:
> 
> > For additional commands, e-mail:
> 
>
>
> _
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> To unsubscribe, e-mail:

For additional commands, e-mail:





--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: getting username of logged in user

2001-11-18 Thread Sean Owen

The "request" variable in the JSP has two methods that might help you,
getRemoteUser() and getUserPrincipal().

Sean

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 18, 2001 10:27 AM
Subject: getting username of logged in user


> Hi all,
>
> couldn't find this one in the archives:
>
> how do I get the username of the user that is logged in, from within a
> JSP-file?
>
> Thanks,
> Michel
>
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: getting username of logged in user

2001-11-18 Thread struts

Hi,

isn't there a 'nicer' option? Tomcat has to know the username anyway
throughout the application, so isn't it possible to retrieve it directly?

Thanks,
Michel

On Sun, 18 Nov 2001, Jens [ISO-8859-2] Kühnberger wrote:

> Just save the username in the session, then you can get the username on 
> a jsp page the following way:
> <%=  pageContext.getSession().getAttribute("username") %>
> 
> Jens
> 
> [EMAIL PROTECTED] wrote:
> 
> >Hi all,
> >
> >couldn't find this one in the archives:
> >
> >how do I get the username of the user that is logged in, from within a
> >JSP-file?
> >
> >Thanks,
> >Michel
> >
> >
> >--
> >To unsubscribe, e-mail:   
> >For additional commands, e-mail: 
> >
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Application scope vs. Singletons

2001-11-18 Thread Sean Owen

I think you are right, though I would add that in some cases, application
scope can be more convenient because Struts provides support for accessing
things in the servlet context.

For example, in a project I worked on we had a lot of HTML form "select"
drop-down lists whose values were stored in the database. We subclassed the
ActionServlet and added code to the init() method that created Lists of
"Option" objects (simple name-value pair objects) and put these into the
servlet context under keys like "select_user_role", "select_contact_type",
etc.

Done this way, the Struts html:options tag can automatically build the
drop-down from these lists:

So in this case it was preferable to use the servlet context for this data.


Also, just note that the Singleton pattern would give one instance per
classloader... so if you used the Singleton outside the web application it
would create a second instance.


Sean


- Original Message -
From: "Robert Taylor" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, November 18, 2001 10:49 AM
Subject: Application scope vs. Singletons


> Greetings, I'm developing a web application where I will need to cache
some
> data (retrieved from the data store) which does not change often. I wish
to
> make the cache available to all classes in my web app. I have read a
couple
> threads that recommend placing this information within the application
scope
> and I was wondering if there is a disadvantage to using a singleton
> instead.
>
> For example, I could have an object called CacheManager with a static
method
> getInstance(), which always returned the same instance (singleton pattern)
> and therefore I could call CacheManager.getInstance() etc... instead of
have
> to make the
> servlet.getServletConfig().getServletContext().getAttribute("cacheMan").
It
> also allows any classes that live outside of the web layer to gain access
to
> the cache if necessary. I guess I don't see the motivation behind placing
> something like a CacheManager in application scope.
>
> Any feedback is welcome.
>
> robert
>
>
> --
> To unsubscribe, e-mail:

> For additional commands, e-mail:



_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Application scope vs. Singletons

2001-11-18 Thread Robert Taylor

Greetings, I'm developing a web application where I will need to cache some
data (retrieved from the data store) which does not change often. I wish to
make the cache available to all classes in my web app. I have read a couple
threads that recommend placing this information within the application scope
and I was wondering if there is a disadvantage to using a singleton
instead.

For example, I could have an object called CacheManager with a static method
getInstance(), which always returned the same instance (singleton pattern)
and therefore I could call CacheManager.getInstance() etc... instead of have
to make the
servlet.getServletConfig().getServletContext().getAttribute("cacheMan"). It
also allows any classes that live outside of the web layer to gain access to
the cache if necessary. I guess I don't see the motivation behind placing
something like a CacheManager in application scope.

Any feedback is welcome.

robert


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: getting username of logged in user

2001-11-18 Thread Jens Kühnberger

Just save the username in the session, then you can get the username on 
a jsp page the following way:
<%=  pageContext.getSession().getAttribute("username") %>

Jens

[EMAIL PROTECTED] wrote:

>Hi all,
>
>couldn't find this one in the archives:
>
>how do I get the username of the user that is logged in, from within a
>JSP-file?
>
>Thanks,
>Michel
>
>
>--
>To unsubscribe, e-mail:   
>For additional commands, e-mail: 
>
>



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




getting username of logged in user

2001-11-18 Thread struts

Hi all,

couldn't find this one in the archives:

how do I get the username of the user that is logged in, from within a
JSP-file?

Thanks,
Michel


--
To unsubscribe, e-mail:   
For additional commands, e-mail: