Re: [OT] Application Config Mgmt

2003-09-25 Thread Troy Hart
Ant is the key to solving this problem. Unfortunately I don't have the 
gift of being able to elegantly summarize the solution for you, but I 
will tell you that I rely on Ant to solve this problem for me, and it 
works! The key is to have multiple property file sets, and work out a 
way to specify which set is sourced at build time. Then, let the 
properties do the work for you. Hopefully this will make sense and be 
helpful.

Troy

Kevin Tung wrote:

How does everyone manage different deployment configurations?

Let's say your webapp needs to run in various environments.. for example
dev, staging and production.  Each environment has its own database
connection info and third party SOAP endpoints.. etc.
What is a good way to automate (at least partly) the management of these
configurations so that..
* The process of promoting code from dev to staging/production will trigger
a correct change of configuration info.
* The configuration info can be stored in a code repository for history
logging and accountability.
I've been doing this mostly manually, but there has to be a better way..  I
would love to hear about your approaches.
Kevin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Plug-in API

2003-09-08 Thread Troy Hart
Struts Plug-In is useful any time you have a resource that needs to be 
initialized with the web application. In the past you would have needed 
to extend the ActionServlet and override init(), now you declare a 
plug-in in your struts-config.xml

Troy

Mohan Radhakrishnan wrote:

Hi
   I am just trying to learn about the Plug-in API.
   When exactly is this useful ? How would it be helpful if I want to
plug-in a custom-user authentication facility instead of using the
vendorspecific XML file ( JDBC realm in tomcat for example ).
Mohan

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Telling Users to Wait

2003-08-28 Thread Troy Hart
Mark,

Still another approach is to use JMS and process the command 
asynchronously. This approach would not preclude you from using any of 
the tricks others have mentioned that keep the user "occupied" while the 
work is being done, but at the same time it would give you other 
options. Asside from that, the JMS approach allows you to build-in 
reliability, which is a good thing!

My advice to you (and take it for what its worth) would be to not use a 
push mode, but instead give the user some other interface to allow 
him/her to pull for the job status...

I hope this was helpful.

Take care,

Troy

Mark Silva wrote:

Hello Struts Gurus,

I am facing an issue in my application where I need to run a database
creation script, and a database import script through the web (running
bat files on the server).  I can run these files fine, but they take a
few minutes to run...  

How can I tell the user when they have finished running?  This seems to
be a sort of push technology I am in need of, but maybe there is another
way?.  I can definitely tell them to wait for a few minutes, but how do
I actually tell them when the process is done (since there is not
another page request at this time.)
Has anyone done something similar to this?

Thanks,
Mark
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: forwarding to Actions expecting ActionForm

2002-11-26 Thread Troy Hart
On Tue, 2002-11-26 at 02:28, Affan Qureshi wrote:
> I want to forward the request from my Action to another action which expects an 
>ActionForm instance for processing. But my current Action does not have access to 
>that Form. Can I instantiate an ActionForm and store it in the request/session scope 
>on the fly? 
> 

When you forward to another action the ActionServlet will look up the
action mapping and automagically instantiate and populate the ActionForm
for you... you don't need to do anything except manage the mapping in
your struts-config.xml.

> I have a search page which displays results from where I can view details of the 
>results. On the details page if I click "Cancel" I want the user to come back on the 
>Search Results page but with the same results opened. 
> 
> Also if the user clicks on Search Tab from anywhere in the app I want the specific 
>(last) search results displayed.
> 

Use the "Bookmark" concept for this prupose. For more information refer
to: http://www.husted.com/about/scaffolding/catalog.htm

> Any ideas? Thanks a lot.

Good Luck


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




Re: Security Best-Practices?

2002-10-22 Thread Troy Hart
You can use the same database for CMA and user profile storage, if your
container supports JAAS authentication. All you need to do is write a
LoginModule (see JAAS docs on sun's site) that accesses the user profile
database. When your LoginModule is accessed to login a user it will need
to create a Subject that contains a single "user" Principal who's name
is the id/name of the user in the database. The type of the "user"
Principal must be consistent with what your container expects in order
to implement the HttpServletRequest method:

getUserPrincipal()

Your Subject can also contain multiple "group" principals and other
arbitrary principals. You need to understand the requirements of your
container in this regard, and understand JAAS authorization in general.

My current project is targeted at weblogic 7, so I had to implement one
of their security service provider apis in addition to the LoginModule,
but it works great. When I need to access a user profile object in order
to get an address, or a credit card number, or whatever...I lookup a
user profile for the id returned by:

request.getUserPrincipal().getName()

You obviously need to fill in the gaps here. I have only provided a high
level view of the solution. For example, I haven't mentioned anything
about what you would use to "lookup a user profile". You would NOT use
your LoginModule for this purpose. In my solution my LoginModule uses a
UserProfileStore object that abstracts access to a store of user profile
information. I use this same UserProfileStore from a struts action when
I need to associate a UserProfile object with an HttpSession.

I think this is a pretty clean solution. Hopefully I will have given you
some helpful information.

Good Luck,

Troy



On Tue, 2002-10-22 at 12:14, Adam Sherman wrote:
> Taylor, Jason wrote:
> > Search the mail archive for container-managed authentication (CMA).  There
> > was a lot of discussion on the subject a week or two ago.  Craig McClanahan
> > has posted some good rants on the subject...
> 
> Good reading, thanks.
> 
> I'm thinking that I will have to implement an application-specific user 
> database, and create a new entry in it for every new authenticated user 
> that comes down from the container. Kinda hackish, but I don't see 
> another way.
> 
> That, or use SecurityFilter (http://securityfilter.sourceforge.net/), 
> then move to CMA if I have to.
> 
> Thanks,
> 
> A.
> 
> 
> -- 
> Adam Sherman
> Software Developer
> Teach and Travel Inc.
> +1.613.241.3103
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




RE: DAO or ... ?

2002-10-14 Thread Troy Hart

They teach patterns at the University of Utah. In our advanced software
engineering course we touched on patterns and anti-patterns.


On Mon, 2002-10-14 at 13:33, Chappell, Simon P wrote:
> I have no idea whether they teach patterns in University. I graduated in 1990 and we 
>didn't even have the Internet back then let alone Patterns!
> 
> Jacob: How about it my friend? Do they teach patterns in the UW?
> 
> Simon
> 
> >-Original Message-
> >From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
> >Sent: Monday, October 14, 2002 2:29 PM
> >To: 'Struts Users Mailing List'
> >Subject: RE: DAO or ... ?
> >
> >
> >> It's called experience  it's why they pay us old guys 
> >more than you
> >young bucks! ;-)
> >
> >LOL!  It's also called being absolutely CERTAIN that someone 
> >has solved this
> >problem before, and not going off reinventing the wheel.  As 
> >an aside, are
> >patterns being taught in computer science?  I'm working on a 
> >degree and the
> >senior-level course I'm taking this semester has been the 
> >first time I've
> >seen a lecture about them.  And then he only covered three (Factory,
> >Abstract Factory and Singleton) and not very in depth at that.
> >
> >I like Applied Java Patterns by Stephen Stelting & Olav 
> >Maassen.  While the
> >GoF book is surely timeless, I'm guessing the examples are not 
> >written in
> >Java.  With Applied Java Patterns (and Core J2EE Patterns) I 
> >can cut and
> >paste and have a head start on the implementation.
> >
> >-- 
> >Wendy Smoak
> >Applications Systems Analyst, Sr.
> >Arizona State University PA Information Resources Management
> >
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




Re: Struts advantages, Struts alternatives

2002-09-04 Thread Troy Hart

I don't know about KSpread and KOffice, but AbiWord (v0.99.5) and
Gnumeric (v1.0.5) do work well. :)

Troy


On Wed, 2002-09-04 at 15:16, Eddie Bush wrote:
> Kspread just choked and punk on the spreadsheet.  I don't know that you 
> could count on KOffice to eat M$-type format files.  OpenOffice did a 
> *beautiful* job of rendering it though!
> 
> Regards,
> 
> Eddie
> 
> Troy Hart wrote:
> 
> >I recognize this doesn't solve your problem with html conversions, but I
> >thought I would throw this out there for those that may not know. There
> >are no shortage of products available on both linux and windows that
> >offer compatibility with standard ms documents like xsl files. 
> >
> >For M$ Win-blows: OpenOffice, and probably others but I don't use M$
> >OSes so I don't know for sure.
> >
> >For Linux: OpenOffice, KDE (AbiWord, GNUMeric, ...), and probably others
> >that I'm not familiar with.
> >
> >Troy
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




RE: Struts advantages, Struts alternatives

2002-09-04 Thread Troy Hart

I recognize this doesn't solve your problem with html conversions, but I
thought I would throw this out there for those that may not know. There
are no shortage of products available on both linux and windows that
offer compatibility with standard ms documents like xsl files. 

For M$ Win-blows: OpenOffice, and probably others but I don't use M$
OSes so I don't know for sure.

For Linux: OpenOffice, KDE (AbiWord, GNUMeric, ...), and probably others
that I'm not familiar with.

Troy


On Wed, 2002-09-04 at 14:00, James Mitchell wrote:
> Nope, same.
> 
> James Mitchell
> Software Engineer\Struts Evangelist
> Struts-Atlanta, the "Open Minded Developer Network"
> http://www.open-tools.org/struts-atlanta
> 
> 
> 
> 
> > -Original Message-
> > From: Dan Cancro [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 04, 2002 4:02 PM
> > To: 'Struts Users Mailing List'
> > Subject: RE: Struts advantages, Struts alternatives
> >
> >
> > No problem.  Did yours come out any better than mine?
> > http://members.telocity.com/dcancro/docs/web_dev_products.htm
> >
> > It's a little hard to convert it to html since it uses a lot of
> > post-its and
> > has some sideways writing.  Anybody know where I can find a good web
> > development product for doing this? ;)
> >
> > Dan
> >
> >
> > > -Original Message-
> > > From: James Mitchell [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, September 04, 2002 12:36 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: Struts advantages, Struts alternatives
> > >
> > >
> > > (I hope you don't mind Dan???)
> > >
> > > I made an HTML version if anyone would like it.
> > >
> > > Size: 985 kb
> > >
> > >
> > > James Mitchell
> > > Software Engineer\Struts Evangelist
> > > Struts-Atlanta, the "Open Minded Developer Network"
> > > http://www.open-tools.org/struts-atlanta
> > >
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: Eddie Bush [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, September 04, 2002 3:24 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Struts advantages, Struts alternatives
> > > >
> > > >
> > > > Unfortunately, for those of us on non-windows platforms, it's
> > > > unreadable.  Could you export it as a CVS please?
> > > >
> > > > Thanks!
> > > >
> > > > Eddie
> > > >
> > > > Joe Barefoot wrote:
> > > >
> > > > >um..Dan, did you have to produce the mother of all technical
> > > > reports recently? :)
> > > > >That's a great compilation you've got there.
> > > > >
> > > > >peace,
> > > > >Joe
> > > > >
> > > > >>-Original Message-
> > > > >>From: Dan Cancro [mailto:[EMAIL PROTECTED]]
> > > > >>Sent: Wednesday, September 04, 2002 11:20 AM
> > > > >>To: 'Struts Users Mailing List'
> > > > >>Subject: RE: Struts advantages, Struts alternatives
> > > > >>
> > > > >>
> > > > >>I maintain a collection of notes from the mailing lists on various
> > > > >>frameworks too.  You can download the zipped Excel file from here:
> > > > >>
> > > > >>http://members.telocity.com/dcancro/docs/web_dev_products.zip
> > > > >>
> > > > >>Dan
> > > > >>
> > > >
> > > >
> > > >
> > > > --
> > > > 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:
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




RE: Question about App Name and url-pattern servlet-mapping

2002-09-03 Thread Troy Hart

Have you looked at the HttpServletRequest api? There a bunch of methods
that parse out and return different parts of the request URL (like
getServletPath()...). I'm not sure (I've never tried, and unfortunately
I'm not in a position to give it a test right now) but I think what you
are looking for is probably there (?). Otherwise, I would suggest
looking through the struts source (probably starting in the
ActionServlet) to see if you can determine how the framework deals with
it.

Good Luck!

Troy

On Tue, 2002-09-03 at 17:42, Andreas wrote:
> Thanks for the reply Troy.  
> 
> That takes care of the "appname" but does not give me the
> "servletmappingurlpattern".  
> 
> The "servletmappingurlpattern" information is configured in the web.xml
> file and is specified within the  tag that follows the
>  tag which defines the struts control servlet.  In my case the
>  tag appears as follows
> 
> 
> action
> /servletmappingurlpattern/*
>   
> 
> If I recall correctly this is only one of two options for how to
> determine which url-patterns can be mapped to the struts action servlet.
> The other would be
> 
> 
> action
> /*.do
>   
> 
> I am not dealing with the latter case only the former.  Does anyone know
> how the information in the  tag can be retrieved from
> within an Action class using standard api's.  I am starting to believe
> that this would not be a struts api, but rather a servlet configuration
> api of some sort.
> 
> Any help appreciated.
> Andreas
> 
> 
> > -Original Message-
> > From: Troy Hart [mailto:[EMAIL PROTECTED]] 
> > Sent: Tuesday, September 03, 2002 15:53
> > To: Struts Users Mailing List
> > Subject: Re: Question about App Name and url-pattern servlet-mapping
> > 
> > 
> > You can look at , but you will probably have the same
> > nested tag problem (?). Alternatively, you can use the following
> > scriptlet:
> > 
> > <% String url = request.getContextPath() + relativeURL %>
> > 
> > Then pass your url String around as needed. NOTE: you may need to do
> > something additional to capture the 'module name' if you are using the
> > module (sub-app) features of struts-1.1.
> > 
> > Hope this helps,
> > 
> > Troy
> > 
> > 
> > 
> > On Tue, 2002-09-03 at 15:55, Andreas wrote:
> > > I need to pass a url as a parameter to a JSP page.  I can't 
> > rely on just
> > > using the relative path.
> > >  
> > > Currently the urls that map to struts actions look like this
> > >  
> > > 
> > http://localhost/appname/servletmappingurlpattern/path/that/re
> solves/to/
> > struts/action
> >  
> > When using the struts tag html:link  all that I have to specify is
> > /path/that/resolves/to/struts/action.  
> >  
> > I need to programatically retrieve or construct
> > /appname/servletmappingurlpattern part of the url.  One way to do this
> > is to just parse the url, but I would rather use the proper api if
> there
> > is one.
> >  
> > I can't use the html:link tag as the page attribute won't accept
> nested
> > tags.
> >  
> > Does anyone know how to do this?
> >  
> > Thanks in advance,
> > Andreas
> >  
> >  
> > PS If there is a place to search old postings, please point it out to
> > me.
> 
> 
> 
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Question about App Name and url-pattern servlet-mapping

2002-09-03 Thread Troy Hart

You can look at , but you will probably have the same
nested tag problem (?). Alternatively, you can use the following
scriptlet:

<% String url = request.getContextPath() + relativeURL %>

Then pass your url String around as needed. NOTE: you may need to do
something additional to capture the 'module name' if you are using the
module (sub-app) features of struts-1.1.

Hope this helps,

Troy



On Tue, 2002-09-03 at 15:55, Andreas wrote:
> I need to pass a url as a parameter to a JSP page.  I can't rely on just
> using the relative path.
>  
> Currently the urls that map to struts actions look like this
>  
> http://localhost/appname/servletmappingurlpattern/path/that/resolves/to/
> struts/action
>  
> When using the struts tag html:link  all that I have to specify is
> /path/that/resolves/to/struts/action.  
>  
> I need to programatically retrieve or construct
> /appname/servletmappingurlpattern part of the url.  One way to do this
> is to just parse the url, but I would rather use the proper api if there
> is one.
>  
> I can't use the html:link tag as the page attribute won't accept nested
> tags.
>  
> Does anyone know how to do this?
>  
> Thanks in advance,
> Andreas
>  
>  
> PS If there is a place to search old postings, please point it out to
> me.



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




RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Troy Hart

A big problem that you will encounter is reliably trapping the "end" of
the request lifecycle. I haven't looked at filters to see if they
provide a 100% reliable solution for this, they may (I don't know what
happens in this scenario when some component decides to redirect the
request...), or there may be some other creative solution that fits your
needs.

However, I still think the goal should be to encapsulate as much as you
can behind a re-usable business API. Struts is great but you may have a
case for re-use elsewhere. For example, you could be tasked to implement
a messaging system that asynchronously executes business logic based on
the receipt of standard documents that come in from trading partners... 

You can pass a connection to the business components if you insist, but
if the business api is done right it should naturally encapsulate the
boundaries of your transactions. Also, by passing the connection into
the business layer you have tightly coupled the controller and model
layers. However, if this buisiness API only exposes a set of value
objects then the business tier is free to swap the relational database
for an ldap store... This API could be a session facade if you were to
use EJB Session beans, but you are certainly not tied to that approach.

My advice is to take the time to get the abstractions right. Don't
couple the tiers unnecessarily, and plan for re-use. This is just my
opinion and it may or may not be relevant (I don't know your apps
requirements).

Cheers,

Troy



On Mon, 2002-09-02 at 15:02, Frederic Laub wrote:
> Thanks to Troy,
> 
> But I read a lot of Java literature and the struts archive over the past
> weeks but in the all the examples the connection is retrieved and returned
> is the same class. I know it is the easiest and the best way to handle the
> problem.
> In most cases it provides a solution.
> I would like to implement a more flexible solution:
> - Retrieving a connection and saving it in the context (request scope) or
> saving an id associated with the connection.
> - When a connection is needed in the request, look first in the context if a
> connection has already been retrieved.
> - Based on a parameter => return the connection in the class.
> - Check at the end of the request if a connection exists, if yes return it
> to the pool.
> => Where does the request cycle ends?
> At the source I'm a database programmer so I prefer to manage the
> transactions myself.
> I think that another advantage of using a same connection through the whole
> request is the fact that in case of heavy loading, when connections are
> difficult to obtain, the request can be served as a whole. I prefer X
> requests with 100% satisfaction and y not satisfied than x+y requests with
> 30% satisfaction. If you understand what I mean?
> 
> Your help or advice will be appreciated.
> Frederic
> 
> I've excluded EJB for my project because most of the data is read only or
> linked to one user only.
> 
> -Original Message-
> From: Troy Hart [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 02, 2002 9:17 PM
> To: Struts Users Mailing List
> Subject: RE: Database Connection in Logic Beans - pooling?
> 
> 
> You can solve this problem by providing a business service framework for
> your application (There has been a lot of talk about this sort of thing
> on this list...I can't think of a particular thread to reference for you
> so you may just want to go through the archives). My approach to this
> problem has been to create a set of very coarse grained business service
> components (ours is an ecommerce system so we have components like the
> following: one for cataloging, one for requisitioning, one for order
> services, and etc...), where each component provides a public API that
> mirrors the "use-cases" one-to-one (for the most part). I think you will
> find that the top level "use-cases" defined for your system provide
> natural scoping boundaries for your transactions, and resource
> management in general.
> 
> This approach will leave you with a set of re-usable business components
> that are not tied to struts and/or the servlet paradigm. Also, this API
> provides an abstraction that will allow you to hide complexity from your
> struts actions (or whatever else uses the API). For example, the
> component you expose could be a facade to an EJB Session bean
> (http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html
> ).
> 
> Anyway, my suggestion is to think about your problem a little
> differently. Sorry if I didn't provide enough details, my intention was
> simply to give a high level overview of how I see the problem and the
> solution. Once again, I would urge to lookup other threads o

RE: Database Connection in Logic Beans - pooling?

2002-09-02 Thread Troy Hart

You can solve this problem by providing a business service framework for
your application (There has been a lot of talk about this sort of thing
on this list...I can't think of a particular thread to reference for you
so you may just want to go through the archives). My approach to this
problem has been to create a set of very coarse grained business service
components (ours is an ecommerce system so we have components like the
following: one for cataloging, one for requisitioning, one for order
services, and etc...), where each component provides a public API that
mirrors the "use-cases" one-to-one (for the most part). I think you will
find that the top level "use-cases" defined for your system provide
natural scoping boundaries for your transactions, and resource
management in general.

This approach will leave you with a set of re-usable business components
that are not tied to struts and/or the servlet paradigm. Also, this API
provides an abstraction that will allow you to hide complexity from your
struts actions (or whatever else uses the API). For example, the
component you expose could be a facade to an EJB Session bean
(http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html).

Anyway, my suggestion is to think about your problem a little
differently. Sorry if I didn't provide enough details, my intention was
simply to give a high level overview of how I see the problem and the
solution. Once again, I would urge to lookup other threads on this topic
to read what other people have said.

Hope this helps,

Troy


On Mon, 2002-09-02 at 10:45, Frederic Laub wrote:
> Hi,
> 
> How do achieve the following:
> In some cases I want to get a connection at the beginning of a request
> (request scope), pass the same connection to all the java beans that are
> called in the request and return the connection at the end of the request.
> Where do I put the code to return the connection to the pool at the end of
> the request and in case of an error be sure that the connection is returned
> to the pool?
> A same connection is required when all DML statements throughout a request
> are part of a same transaction.
> The commit (or rollback in case of an error) statement is issued at the end
> of the request before the connection is returned to the pool.
> Sorry if the vocabulary I used is database oriented and not 100 %
> java/struts compatible.
> 
> Your help will be appreciated.
> Frederic
> 
> 
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, September 02, 2002 9:06 AM
> To: Struts Users Mailing List
> Subject: Re: Database Connection in Logic Beans - pooling?
> 
> 
> Steve McLeod writes:
> 
> > I am using:
> > Tomcat 4.0
> > Struts 1.0.2
> >
> > The problem
> > 
> >
> > I have successfully used the Struts database connection pooling in a trial
> > web app, but as far as I can tell, a reference to the datasource can only
> be
> > obtained from within an Action class (or directly within a JSP page but
> > let's not think about that today).
> >
> > However I would like to have logic beans which handle database access,
> > rather than have this in the Action class. But I can't get a reference to
> > the datasource from the logic bean because it doesn't have a
> ServletContext
> > to which I can get a handle.
> >
> > I have toyed with various ideas:
> > - Initialise a logic bean by passing it a reference to the Servlet
> > - Acquire a connection in the Action class and pass that to the bean
> >
> > But really, I would rather the logic bean know inherently how to acquire a
> > database connection.
> >
> > My current workaround is to not use the Struts connection pooling, and
> > rather to manually create a connection each time database access needs to
> be
> > done, then destroy it. But this is clearly not suitable for our production
> > environment.
> 
> There are a few ways to solve your problem. One way would be to bind a
> datasource to some JNDI name that your logic beans are aware of. Then, using
> that name, your logic beans can lookup the datasource completely independent
> of struts.
> 
> Give it a try,
> 
> Troy
> 
> >
> >
> > The context of my problem
> > ==
> >
> > I want to use some code like this in a JSP:
> >
> >  > class="au.com.sunesis.timesheets.ClientManager" />
> > 
> > 
> > #
> > Client
> > Active
> > 
> >  > type="au.com.sunesis.timesheets.Client">
> > 
> > 
> > 
> > 
> > 
> > 
> >
> >
> > The idea is that ClientManager is used to handle all general database
> tasks
> > for the Client bean (which maps to a Client entity in the database).
> > ClientManager.getClients() connects to the database, creates an ArrayList
> of
> > Client objects, one for each row in the database, and returns the
> ArrayList.
> >
> > ClientManager has other methods, such as:
> > - ClientManager.delete(Client c), which deletes the row in the
> > database entit

Re: Re: Is Struts suitable for Java client?

2002-08-29 Thread Troy Hart

On Thu, 2002-08-29 at 12:28, Troy Hart wrote:
> IMHO the value of the struts framework has more to do with providing a
> set of "actions" that invoke business processes in the request/response
> (ie servlet) paradigm. 

To clarify, I DO NOT mean to imply that the business processes know
anything about the request/response.

Troy

> One of the cool features that struts provides in
> this endeavor is an automatic mapping of the request parameters into
> forms that can be declaratively associated with a given action...maybe
> I'm wrong, it wouldn't be the first time :(
> 
> Anyway, I was just trying to give Leslie a better answer than an
> emphatic NO, which didn't seem right to me based on my interpretation of
> her question.
> 
> Regards,
> 
> Troy
> 
> 
> 
> On Thu, 2002-08-29 at 02:37, Tom Klaasen wrote:
> > Makes you wonder what the advantage of using struts might be then. Struts is a 
>framework for mapping html form fields to bean properties (yeah, I know, there's a 
>lot of other stuff in it, but if this wasn't in there, nobody would be using struts).
> > 
> > "Hey, I found a nice hammer, let's slice this cheese real thin!"
> > 
> > tomK
> > 
> > 
> > 
> >  "Struts Users Mailing List" <[EMAIL PROTECTED]> wrote:
> > 
> > 
> > >I'm not sure the answer is no. Struts is not tied to forwarding to a jsp, or 
> > >any other type of resource for that matter. In fact you can simply return 
> > >null from an action and have the action generate the response itself. You 
> > >may need to think about your problem a little differently (???), but if you 
> > >write a client that understands the servlet request/response paradigm then 
> > >you should be able to engineer a solution that uses the struts framework for 
> > >the server side... 
> > >
> > >Good Luck, 
> > >
> > >Troy 
> > >
> > > 
> > >
> > >Gopalakrishnan Rangaswamy writes: 
> > >
> > >> NO 
> > >> 
> > >> -Original Message-
> > >> From: Leslie Yu [mailto:[EMAIL PROTECTED]]
> > >> Sent: Tuesday, August 13, 2002 10:39 AM
> > >> To: [EMAIL PROTECTED]
> > >> Subject: Is Struts suitable for Java client? 
> > >> 
> > >> 
> > >> Hi all, 
> > >> 
> > >> I'm going to develop a java application with java client on client
> > >> side
> > >> which talks to a controller servlet. The data transmitted between client
> > >> and
> > >> server may be serialized object.
> > >> Does Struts support java client by outputting a serialized object as
> > >> a
> > >> HTTP response instead of forwarding to a JSP? If yes, would anyone give
> > >> me
> > >> some hints? Thanks. 
> > >> 
> > >> Best Regards,
> > >> Leslie 
> > >> 
> > >> 
> > >> --
> > >> 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: 
> > >
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Re: Is Struts suitable for Java client?

2002-08-29 Thread Troy Hart

IMHO the value of the struts framework has more to do with providing a
set of "actions" that invoke business processes in the request/response
(ie servlet) paradigm. One of the cool features that struts provides in
this endeavor is an automatic mapping of the request parameters into
forms that can be declaratively associated with a given action...maybe
I'm wrong, it wouldn't be the first time :(

Anyway, I was just trying to give Leslie a better answer than an
emphatic NO, which didn't seem right to me based on my interpretation of
her question.

Regards,

Troy



On Thu, 2002-08-29 at 02:37, Tom Klaasen wrote:
> Makes you wonder what the advantage of using struts might be then. Struts is a 
>framework for mapping html form fields to bean properties (yeah, I know, there's a 
>lot of other stuff in it, but if this wasn't in there, nobody would be using struts).
> 
> "Hey, I found a nice hammer, let's slice this cheese real thin!"
> 
> tomK
> 
> 
> 
>  "Struts Users Mailing List" <[EMAIL PROTECTED]> wrote:
> 
>   
> >I'm not sure the answer is no. Struts is not tied to forwarding to a jsp, or 
> >any other type of resource for that matter. In fact you can simply return 
> >null from an action and have the action generate the response itself. You 
> >may need to think about your problem a little differently (???), but if you 
> >write a client that understands the servlet request/response paradigm then 
> >you should be able to engineer a solution that uses the struts framework for 
> >the server side... 
> >
> >Good Luck, 
> >
> >Troy 
> >
> > 
> >
> >Gopalakrishnan Rangaswamy writes: 
> >
> >> NO 
> >> 
> >> -Original Message-
> >> From: Leslie Yu [mailto:[EMAIL PROTECTED]]
> >> Sent: Tuesday, August 13, 2002 10:39 AM
> >> To: [EMAIL PROTECTED]
> >> Subject: Is Struts suitable for Java client? 
> >> 
> >> 
> >> Hi all, 
> >> 
> >> I'm going to develop a java application with java client on client
> >> side
> >> which talks to a controller servlet. The data transmitted between client
> >> and
> >> server may be serialized object.
> >> Does Struts support java client by outputting a serialized object as
> >> a
> >> HTTP response instead of forwarding to a JSP? If yes, would anyone give
> >> me
> >> some hints? Thanks. 
> >> 
> >> Best Regards,
> >> Leslie 
> >> 
> >> 
> >> --
> >> 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: 
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




Re: Container-managed authentication not possible

2002-08-22 Thread Troy Hart



On Wed, 2002-08-21 at 21:31, Craig R. McClanahan wrote:
> 
> 
> On Wed, 21 Aug 2002, Max Cooper wrote:
> 
> > Date: Wed, 21 Aug 2002 13:07:47 -0700
> > From: Max Cooper <[EMAIL PROTECTED]>
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>,
> >  [EMAIL PROTECTED]
> > Subject: Re: Container-managed authentication not possible
> >
> > Brandon,
> >
> > SecurityFilter *does* implement isUserInRole(), getUserPrincipal(), and
> > getRemoteUser(). By "mimics" I mean that your app (or Tiles and Struts) will
> > not be able to distinguish between SecurityFilter and Container Managed
> > Security. It behaves the same, and it looks the same to the code running on
> > top of it. One of the major design goals of the project is to allow you to
> > switch between container-managed and filter-based security without changing
> > your application's code. SecurityFilter also shares the same configuration
> > syntax and features, except that you put the info in a
> > securityfilter-config.xml file rather than web.xml.
> >
> 
> I haven't had time to check your docs for myself :-), but I hope you do
> point out one critical place where the application *does* have to care
> about whether it is "real" container managed security or not -- EJB
> access.  From the point of view of an EJB container, requests protected by
> any sort of mimicing security filter will appear to be coming from an
> unauthenticated web user (which might or might not be ok, depending on
> your security policies and application design).
> 
> > -Max
> 
> Craig

If the filter used JAAS authentication, what would it need to do in
order to integrate the Subject into the container's environment so that
EJB access wouldn't seem unauthorized? Would it be container specific?
In what ways? It seems like the request would also NOT need to be
wrapped if the Subject was properly established (i.e. had the right
~type~ of principals, and was stored in the container correctly [but
where would that be?]), does that sound right?

Troy 

> 
> 
> >
> > - Original Message -
> > From: "Brandon Goodin" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>;
> > <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 21, 2002 12:52 PM
> > Subject: RE: Container-managed authentication not possible
> >
> >
> > > That is a cool project. But, it only "mimics". It has the same terminology
> > > associated with it. But it is NOT container managed security. Nor does it
> > > integrate (at this point) with many projects that use the container based
> > > security check methods like isUserInRole(). so, for example if you are
> > using
> > > role checking with tiles it will not be able to locate the role and user
> > > information generated by SecurityFilter because it does not use container
> > > managed security. I wrote a SecurityFilter that interacts with an action
> > to
> > > take advantage of container based security. It allows for auto-login,
> > login
> > > from any page, and url based security. But the code is not very clean and
> > is
> > > Tomcat specific. I am waiting for the ServletSpec to come up to par.
> > > Meanwhile my "SecurityFilter" is working and using container based
> > security
> > > and I would rather stay tied to container managed security with all it's
> > > inflexibilities because it allows me to abstract my security from my app.
> > >
> > > Just my rambling thoughts,
> > > Brandon Goodin
> > > Phase Web and Multimedia
> > > P(406)862-2245
> > > F(406)862-0354
> > > http://www.phase.ws
> > >
> > > -Original Message-
> > > From: Todd G. Nist [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 21, 2002 2:46 PM
> > > To: 'Struts Users Mailing List'
> > > Subject: RE: Container-managed authentication not possible
> > >
> > >
> > > You may want to take a look at the SecurityFilter project on
> > SourceForge.net
> > > by Max Cooper.  Summary form site:
> > >
> > > "SecurityFilter is a Java Servlet Filter that mimics the behavior and
> > > configuration format of container managed security, with several
> > > development and deployment advantages."
> > >
> > > See the Home Page http://securityfilter.sourceforge.net at for more
> > > details.
> > >
> > > Regards,
> > >
> > > Todd G. Nist
> > >
> > >
> > > -Original Message-
> > > From: Brandon Goodin [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 21, 2002 2:48 PM
> > > To: Struts Users Mailing List
> > > Subject: RE: Container-managed authentication not possible
> > >
> > >
> > > You can implement container managed security in web.xml only if it has
> > been
> > > setup within the server.xml under your host settings.
> > >
> > > Brandon Goodin
> > > Phase Web and Multimedia
> > > P(406)862-2245
> > > F(406)862-0354
> > > http://www.phase.ws
> > >
> > > -Original Message-
> > > From: Elderclei R Reami [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, August 21, 2002 3:44 PM
> > > To: [EMAIL P

Re: Container-managed authentication not possible

2002-08-21 Thread Troy Hart

Max, 

Have you considered using JAAS for authentication? Why or why not?

Thanks,

Troy

On Wed, 2002-08-21 at 14:13, Max Cooper wrote:
> Elderclei,
> 
> Todd mentioned my SecurityFilter project as a possible alternative for you,
> and I enourage you to try it. Not having access to the server configuration
> is one of the particular situations in which I thought it would be useful.
> 
> -Max
> http://www.securityfilter.org/
> 
> - Original Message -
> From: "Elderclei R Reami" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 21, 2002 3:43 PM
> Subject: Container-managed authentication not possible
> 
> 
> > Hi Friends,
> >
> > It's been a month developing in struts, and the party's been pretty good.
> I'm just finishing my first application
> > (30 jsps, actions, and so on), and now I'm including some security in it.
> >
> > I'm in trouble regarding authentication, because my client's  ISP does not
> let me change server.xml configs,
> > probably because they use virtual hosting. My question is: is it possible
> to configure container-managed
> > authentication using the web.xml? Or must I implement my own
> authentication?
> >
> > Cheers,
> > Elderclei R Reami
> > Vertis Tecnologia
> > +55 11 3887-0835
> > www.vertisnet.com.br
> >
> >
> > --
> > 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: 




Of topic JAAS Question

2002-08-21 Thread Troy Hart

Hello,

Sorry for this off topic post, put I am trying to put the final pieces
together that will enable me to write a portable struts application that
uses CMA, or maybe a security filter (maybe Max's or something similar).

I have a couple of questions about assigning Principals in my custom
JAAS LoginModule. First, can I assign "role" Principals to the Subject
in my LoginModule, or are roles strictly declared in the deployment
descriptor and assigned by the container?

Second, is it a true statement to say that I must set container specific
User and Role Principal types on my Subject in order for the
getUserPrincipal() and isUserInRole(String) methods (defined on
HttpServletRequest) to work? If this is not a true statement then I am
missing something...how can the container know which principal is the
authenticated user principal?

Now I have one more question. Is there a way for me to map roles, via
the deployment descriptor, to named principals of a certain type? How do
I say that a user is granted "roleA" if said user is a member of
"userGroupA", where the group principal is a Principal of type
foo.Group? From what I can tell, roles are mapped in the deployment
descriptor strictly based on the presence of any principal type with a
given name.

Thanks so much for your help!

Troy


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




Re: dynamically Passing values to Javascript function

2002-08-15 Thread Troy Hart

On Thu, 2002-08-15 at 12:37, Chandra Sekharan Bhaskaran wrote:
> I have submit button in the iterate tag
> I need to pass the parameter   property="companionArticleNumber" />",this)
> to deletescript and it gives me parsing error.
> any one had worked on this pls let me know
> rgds
> C.Bhaskaran
>  
>   name="companionInfo" property="companionArticleNumber" />",this)"
> styleId="formbuttons" />
>key="labels.buttons.msmetadata.companion.deleteCompanion" />
>  
> 
> 

You can not embed the the  tag inside  tag. The
following is one alternative:


  


Troy

> **Disclaimer
> 
> 
> Information contained in this E-MAIL being proprietary to Wipro Limited
> is 'privileged' and 'confidential' and intended for use only by the
> individual or entity to which it is addressed. You are notified that any
> use, copying or dissemination of the information contained in the E-MAIL
> in any manner whatsoever is strictly prohibited.
> 
> 
> *
> 
> 
> 

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



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




RE: Use of Iterator tag

2002-08-14 Thread Troy Hart

Why not have both?

public Iterator getIterator() {
  return this.iterator();
}

Troy

On Wed, 2002-08-14 at 11:24, David Marine wrote:
> The convention of naming the method to access a collection's iterator
> "iterator" instead of the Bean compliant "getIterator" is one set by Sun
> itself. It is unfortunate, however, while renaming your method makes it
> inconsistent with the method naming used in the Java collections, it
> will make the method comply with Java Bean naming conventions... And
> work with STRUTS!
> 
> 
> -Original Message-
> From: Kamholz, Keith (corp-staff) USX [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, August 14, 2002 12:15 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Use of Iterator tag
> 
> 
> You're trying to bypass the internal workings of struts.  That's just
> the way struts works, if you want to pull the iterator out of the bean,
> you need the get method.  If you want to keep the iterator method only
> because it's used else where and you don't want to change it in those
> places, I suppose you could have both.  It results in slightly longer
> code, but you could have both if you wanted to.
> 
> ~ Keith
> http://www.buffalo.edu/~kkamholz
> 
> 
> -Original Message-
> From: nathan phillips [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 14, 2002 1:12 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Use of Iterator tag
> 
> 
> I simply have a method named "iterator" in my bean that I'd like to use.
> If
> 
> I rename it to "getIterator" then it works fine.  However, I don't want
> to 
> rename my method to "getIterator."  Any ideas?
> 
> 
> From: "Kamholz, Keith   (corp-staff) USX" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Use of Iterator tag
> Date: Wed, 14 Aug 2002 13:00:31 -0400
> MIME-Version: 1.0
> Received: from nagoya.betaversion.org ([192.18.49.131]) by 
> mc2-f26.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.4905); Wed, 14
> Aug
> 
> 2002 10:02:55 -0700
> Received: (qmail 18489 invoked by uid 97); 14 Aug 2002 17:02:12 -
> Received: (qmail 18438 invoked by uid 98); 14 Aug 2002 17:02:12 -
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Precedence: bulk
> List-Unsubscribe: 
> List-Subscribe: 
> List-Help: 
> List-Post: 
> List-Id: "Struts Users Mailing List" 
> Delivered-To: mailing list [EMAIL PROTECTED]
> X-Antivirus: nagoya (v4198 created Apr 24 2002)
> Message-ID: <[EMAIL PROTECTED]>
> X-Mailer: Internet Mail Service (5.5.2653.19)
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
> Return-Path: 
> [EMAIL PROTECTED]
> X-OriginalArrivalTime: 14 Aug 2002 17:02:56.0924 (UTC) 
> FILETIME=[6FD59DC0:01C243B4]
> 
> Oh, you're trying to do this without a get method?  Why don't you want
> to use the get method?  How else would you like to retrieve the iterator
> from your bean?
> 
> ~ Keith
> http://www.buffalo.edu/~kkamholz
> 
> 
> 
> -Original Message-
> From: nathan phillips [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 14, 2002 12:53 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Use of Iterator tag
> 
> 
> Hi Keith,
> 
> Thanks for the fast response.  I've since added the type per your
> suggestion.  However, it still complains that the method "iterator" has
> no getter.  When I add "getIterator" to my class it works fine.  There
> must be a way to get this to work without having to use a getter method.
> 
> 
> From: "Kamholz, Keith   (corp-staff) USX" <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
> Subject: RE: Use of Iterator tag
> Date: Wed, 14 Aug 2002 12:41:49 -0400
> MIME-Version: 1.0
> Received: from [192.18.49.131] by hotmail.com (3.2) with ESMTP id
> MHotMailBF23D3A3008840043194C0123183CA0B0; Wed, 14 Aug 2002 09:43:15
> -0700
> Received: (qmail 26214 invoked by uid 97); 14 Aug 2002 16:43:28 -
> Received: (qmail 26202 invoked by uid 98); 14 Aug 2002 16:43:27 -
> From struts-user-return-43223-nathanpp Wed, 14 Aug 2002 09:44:18 -0700
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Precedence: bulk
> List-Unsubscribe: 
> List-Subscribe: 
> List-Help: 
> List-Post: 
> List-Id: "Struts Users Mailing List" 
> Delivered-To: mailing list [EMAIL PROTECTED]
> X-Antivirus: nagoya (v4198 created Apr 24 2002)
> Message-ID: <[EMAIL PROTECTED]>
> X-Mailer: Internet Mail Service (5.5.2653.19)
> X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N
> 
> Hey,
> 
> For your first question, I think you should specify the 'type' attribute
> of the iterate tag.  This indicates the type of variable that the
> collection contains, and is pretty important (i think).
> 
> For the radio button, use a little scriptlet to set the 

Re: What is a better way to check user login?

2002-08-13 Thread Troy Hart

This topic has been discussed quite a bit on this list. I think the
consensus is that you should really use container managed authentication
(cma). You should search through the archives for discussions on the
topic. According to some you would be crazy (or maybe even stupid) to do
it any other way. Sometimes you don't have a lot of choice in the
matter, due to any number of factors, but you will be happy if you can
bite it off. :-)

Good luck,

Troy


On Tue, 2002-08-13 at 22:10, Struts Newsgroup (@Basebeans.com) wrote:
> Subject: What is a better way to check user login?
> From: "Hu Ji Rong" <[EMAIL PROTECTED]>
>  ===
> Hi,
> 
> I saw various ways to check user login in Struts, but a bit confused.
> CheckLogon Tag in Struts example, check user session data, overwrite the
> ActionServlet, and so on. Overwrite the ActionServlet maybe also have
> problem to migrate to 1.1?
> 
> Can anyone point to a right way? We have normally form based login page to
> validate the user.
> 
> Thanks,
> JiRong
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




RE: Forwards in strugs-config.xml

2002-08-02 Thread Troy Hart

I can think a one technique that would give you what you are looking
for. Use an action mapping that both your global forward and your local
forward refer to. Take the following struts-config for example:

 
  




  

  

  




This is something I do frequently and I like it pretty well because it
insulates me from changes to the names of the jsp pages...you only have
one spot to make a change.

Good luck,

Troy





On Fri, 2002-08-02 at 10:42, Kulp, Arian wrote:
> That's not actually what I'm getting it.  I realize that action forwards
> override globals, and either one can be used anywhere.  I'm trying to get
> the convenience (and intuitiveness) of saying "success" and "failure" from
> the login action while being able to define a mapping to a given resource
> only once.  So I can define "home" as "index.jsp" yet have home as the
> "success", "failure," or "exception ", etc. in any given action.  Maybe it's
> too esoteric of an example!  It makes sense to me anyway.  ;-)  Does this
> make more sense to others now?
> 
> -Arian
> 
> > -Original Message-
> > From:   Joe Germuska [SMTP:[EMAIL PROTECTED]]
> > Sent:   Friday, August 02, 2002 11:34 AM
> > To: Struts Users Mailing List
> > Subject:Re: Forwards in strugs-config.xml
> > 
> > You don't need to redefine global forwards in action-mappings.  In an 
> > action class, when you call "mapping.findForward()", if there is no 
> > local forward with the appropriate name, it will look through global 
> > forwards.
> > 
> > So, in "com.carefinder.action.LogoffAction", you could call 
> > 'mapping.findForward("logon")' and everything would work.
> > 
> > Get it?
> > 
> > Joe
> > 
> > PS Just 'cause it's so short, here's the code from ActionMapping.java:
> > 
> >  /**
> >   * Find and return the ForwardConfig instance
> > defining
> >   * how forwarding to the specified logical name should be handled.
> > This is
> >   * performed by checking local and then global configurations for the
> >   * specified forwarding configuration.  If no forwarding
> > configuration
> >   * can be found, return null.
> >   *
> >   * @param name Logical name of the forwarding instance to be returned
> >   */
> >  public ActionForward findForward(String name) {
> > 
> >  ForwardConfig config = findForwardConfig(name);
> >  if (config == null) {
> >  config = getApplicationConfig().findForwardConfig(name);
> >  }
> >  return ((ActionForward) config);
> > 
> >  }
> > 
> > 
> > 
> > At 10:31 AM -0500 2002/08/02, Kulp, Arian wrote:
> > >I'm afraid I can see the answer, but wanted to be sure.  In the
> > >strugs-config.xml you can specify global-fowards.  This seems like a
> > great
> > >way to set a logical name for the view resources.  Unfortunately it is
> > >rather redundant to define "logon" as "/logon.jsp" in global-forwards,
> > just
> > >to redefine it as "success" in a mapping for /logoff later on.  It would
> > be
> > >nice to be able to make action forwards be relative to an already-defined
> > >global forward.  I hope this is making sense!
> > >
> > >For example (hypothetical):
> > >
> > > 
> > > 
> > > 
> > > 
> > >
> > >  > > path="/logoff"
> > > type="com.carefinder.action.LogoffAction">
> > > 
> > > 
> > >
> > >In this case, specifying a gforward of "success" in the Action Servlet,
> > >would resolve to the global-forward defined for "logon" which would be
> > >"/logon.jsp."  Otherwise later when I put my JSP's into my WEB-INF
> > folder, I
> > >need to remember to change it in the global-forward and all action
> > forwards
> > >that use them.  Is this already possible in some creative (or directly
> > >supported) way?  Is this just not a good idea for some reason I'm not
> > >thinking of?  Any comments appreciated (well friendly ones anyway...  ;-)
> > )!
> > >
> > >Thanks!
> > >-Arian
> > >
> > >Arian Kulp
> > >Java Developer
> > >AEGON Financial Partners
> > >[EMAIL PROTECTED]
> > >319.298.4117
> > >
> > >
> > >
> > >
> > >--
> > >To unsubscribe, e-mail:
> > 
> > >For additional commands, e-mail:
> > 
> > 
> > 
> > -- 
> > --
> > * Joe Germuska{ [EMAIL PROTECTED] }
> > "It's pitiful, sometimes, if they've got it bad. Their eyes get 
> > glazed, they go white, their hands tremble As I watch them I 
> > often feel that a dope peddler is a gentleman compared with the man 
> > who sells records."
> > --Sam Goody, 1956
> > tune in posse radio: 
> > 
> > --
> > To unsubscribe, e-mail:
> > 
> > For additional commands, e-mail:
> > 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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

Re: Using relative actions in html:form attributes...

2002-08-01 Thread Troy Hart

I'm not so sure that is correct. It seems like I have done this before,
but I don't recall for sure. I am in the middle of some other stuff and
don't have time to test it now, but you should give it a quick try. Or,
maybe you already have?

Good Luck,

Troy

On Thu, 2002-08-01 at 15:05, Mark Meytin wrote:
> That would work of course, but as a result I won't be
> able to use other html tags that go inside html:form,
> such as html:select, html:text, etc - and therefore
> abandon a large chunk of functionality provided by Struts.
> I'm kinda curious why Struts developers would not
> simply allow relative action elements, perhaps if a
> special attribute was present.  Perhaps this is
> a question for dev-list.
> 
> Thanks for your answer,
> -M-
> 
> Troy Hart wrote:
> 
> > One very simple thing to do is forgo the use of  in favor of
> > the plain html .
> > 
> > Troy
> > 
> > 
> > 
> > On Thu, 2002-08-01 at 13:23, Mark Meytin wrote:
> > 
> >>Hello!
> >>
> >>I have the following interesting problem with Struts 1.0.2 running under
> >>Tomcat 4.0.4 and Apache combo.  I would like to specify relative
> >>actions in the html:form tags.  The problem now is that html:form
> >>tag converts action attributes into absolute paths, for example
> >>if I specify action="search.do" in html:form tags, the
> >>resulting HTML page contains 
> >>tag, where it gets /myapp prefix by always unconditionally making
> >>a call to request.getContextPath().  Well, in my case this is not
> >>working, because due to the use of Apache ProxyPass statements,
> >>URLs of the pages do not correspond to Tomcat ContextPaths.  
> >>Specifically, my JSP files are located in /webapps/superapp/subdir
> >>directory, through the magic of the following ProxyPass statements:
> >>
> >>ProxyPass /subdir http://localhost:8080/superapp/subdir
> >>ProxyPassReverse  /subdir http://localhost:8080/superapp/subdir
> >>
> >>I can access my pages by going to http:///subdir/page.jsp
> >>and my actions as http:///subdir/action.do.  But because
> >>html:form tag generates a link to /superapp/subdir/action.do my
> >>forms cannot access the action at all, resulting in Apache's 404
> >>result.  
> >>
> >>Any ideas will be much appreciated!  It there a way to handle this
> >>type of situation, when Apache URLs do not correspond to
> >>Tomcat ContextPath URLs?  I'm getting a bit desperate here ;^)
> >>
> >>-M-
> >>
> >>
> >>
> >>--
> >>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> >>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> >>
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: Using relative actions in html:form attributes...

2002-08-01 Thread Troy Hart

One very simple thing to do is forgo the use of  in favor of
the plain html .

Troy



On Thu, 2002-08-01 at 13:23, Mark Meytin wrote:
> Hello!
> 
> I have the following interesting problem with Struts 1.0.2 running under
> Tomcat 4.0.4 and Apache combo.  I would like to specify relative
> actions in the html:form tags.  The problem now is that html:form
> tag converts action attributes into absolute paths, for example
> if I specify action="search.do" in html:form tags, the
> resulting HTML page contains 
> tag, where it gets /myapp prefix by always unconditionally making
> a call to request.getContextPath().  Well, in my case this is not
> working, because due to the use of Apache ProxyPass statements,
> URLs of the pages do not correspond to Tomcat ContextPaths.  
> Specifically, my JSP files are located in /webapps/superapp/subdir
> directory, through the magic of the following ProxyPass statements:
> 
> ProxyPass /subdir http://localhost:8080/superapp/subdir
> ProxyPassReverse  /subdir http://localhost:8080/superapp/subdir
> 
> I can access my pages by going to http:///subdir/page.jsp
> and my actions as http:///subdir/action.do.  But because
> html:form tag generates a link to /superapp/subdir/action.do my
> forms cannot access the action at all, resulting in Apache's 404
> result.  
> 
> Any ideas will be much appreciated!  It there a way to handle this
> type of situation, when Apache URLs do not correspond to
> Tomcat ContextPath URLs?  I'm getting a bit desperate here ;^)
> 
> -M-
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




Re: validating existence of session attributes in all Actions

2002-07-30 Thread Troy Hart

I haven't used tiles yet so I am in unfamiliar territory here, but I
think you are not precluded from subclassing the request processor when
you adopt them. I have noticed that there is a base RequestProcessor
that must be used with tiles applications but it would seem that you
could extend it, and tell struts to use it, without problem...

I am very curious though about what the consensus is on the issue of
extending the RequestProcessor, both in general terms and in terms of
applications that use tiles. It seems that you can do a lot for yourself
by extending this class. We have used to to define some default behavior
that allows us to adopt a couple of standard practices and eliminate a
lot of code that otherwise has to be repeated in each action... 

Also, what if you are not using container managed authentication but you
want to take advantage of the declarative security that is offered by
the action mappings in the struts-config.xml. I don't have any direct
experience with cma so I could be wrong, however I don't think the base
implementation of the RequestProcessor processRoles() method will work
for you unless the container is managing user authentication...

I wonder what others think???

Thanks,

Troy



On Tue, 2002-07-30 at 16:07, Eddie Bush wrote:
> Craig R. McClanahan wrote:
> 
> >
> >On Tue, 30 Jul 2002, Eddie Bush wrote:
> >
> >>Date: Tue, 30 Jul 2002 12:54:12 -0500
> >>From: Eddie Bush <[EMAIL PROTECTED]>
> >>Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >>To: Struts Users Mailing List <[EMAIL PROTECTED]>
> >>Subject: Re: validating existence of session attributes in all Actions
> >>
> >>Do RequestProcessors stack like filters?  This is a point I'm not clear
> >>on.
> >>
> >
> >No.  There is one and only one request processor per application module
> >(just like there is one and only one controller servlet in Struts 1.0 that
> >had the same logic in it).
> >
> That's what I thought...
> 
> So you could cut your nose off really quick by extending 
> RequestProcessor - and if you DID extend RequestProcessor you'd wind up 
> having to change which one you extended if you moved to something like 
> Tiles - and *then* I don't know that there's even a way to specify "use 
> mine instead of the one you want to use by default"!
> 
> I wouldn't take this approach ... just my $0.02 - which is worthless in 
> today's economy.
> 
> Thanks for the info/clearification, Craig!
> 
> Eddie
> 
> >
> >
> >Craig
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




RE: Security and Struts

2002-07-30 Thread Troy Hart

I don't think it is that much work to put an action in front of every
jsp page that represents "page" in your application. I actually think it
is a very good abstraction. A couple of the advantages I can think of
right now include:

1) It gives your web-app a stable interface and simultaneously allows
you to freely swap the actual response generating resource, behind the
scenes. You provide a action mapping where you tie a stable name to an
action class, or even some other arbitrary resource...whatever suits
you. Along with this approach, most people will hide the jsp in WEB-INF.
I've heard reports of some having troubles with the hiding part, but it
has worked well for me.

2) You can sleep well at night knowing that all requests go through your
special request processing logic...you won't have to worry about the
"secure" page that you forgot to include the special taglib on. This
need can arguably be mitigated by using cma/filters.

Troy


On Tue, 2002-07-30 at 16:03, David Graham wrote:
> I've done it by using a custom tag on all the secured pages that checks the 
> login but this isn't ideal.  I could forget to put the tag in and I have to 
> do it for every page.
> 
> If you let struts do it then you can't let people go to .jsp pages directly 
> and I find this irritating at best.
> 
> Should you only use struts for the webforms and not for public display 
> pages?  I've always been a bit confused by this.  It seems that struts was 
> designed for the forms stuff but not necessarily to sit in front of your 
> whole app.
> 
> Thanks,
> Dave
> 
> >I tend to think the action is the wrong place for this sort of thing. I
> >could be wrong but that's just how it occurs to me. It seems that this
> >should either be handled in front of your web application (using
> >cma/filters) or by the front controller components in the struts
> >framework (NOTE: requests that do not map to the controller servlet,
> >like requests directly to a jsp page, will not invoke your request
> >processing logic).
> >
> >Struts also helps you along here. It provides a way for you to
> >*declare*, along with each action mapping (in struts-config.xml), a
> >specific set of roles that have access to the given action. Then, the
> >RequestProcessor defines the method processRoles() that you are free to
> >override, but by default it will invoke:
> >
> >request.isUserInRole(someRole)
> >
> >for each role declared in the action mapping. If the user is found to be
> >included in any of the roles then processRoles() returns true, otherwise
> >it returns false. True is also returned in the case where no roles are
> >declared on the action mapping. Check out the struts source for more
> >detail...
> >
> >Unless you use the cma/filters approach (and I haven't, so I don't know
> >what the issues are there), there will still be some details for you to
> >work out with respect to getting an authenticated user into the session.
> >This could be handled in a number of different ways. One that occurs to
> >me, off the top of my head, would be to wire a login page into the page
> >that is forwarded when processRoles() returns false...
> >
> >There may be some mis-truths in what I have said here, I am currently
> >working through some of this stuff, but in general I think the idea is
> >sound. Certainly having declarative security is something that you
> >should strive for...
> >
> >If anyone has feedback on what I've said here, I would love to hear it!
> >
> >Thanks & Good Luck,
> >
> >Troy
> >
> >
> >On Tue, 2002-07-30 at 12:59, Nelson, Tracy (ETW) wrote:
> > > I'd have each form check authorization.  That way, if someone bookmarks 
> >a
> > > page (or guesses its URL) they won't bypass your security scheme.  You 
> >could
> > > have a global exception set up in your configuration file that forwards 
> >to
> > > an "Access denied" page whenever one of your forms threw a 
> >UserNotAuthorized
> > > exception.  (NOTE: I am just learning Struts and haven't even written my
> > > first application using it yet.  I may not know what I am talking 
> >about.)
> > >
> > > Cheers!
> > > -- Tracy
> > >
> > > -Original Message-
> > > From: Ryan Cuprak [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, July 30, 2002 11:53
> > > To: [EMAIL PROTECTED]
> > > Subject: Security and Struts
> > >
> > >
> > >
> > > Hello,
> > >  I was hoping someone would have some advice on securing a website using
> > > struts. I am developing a webapp that has to be secure (password 
> >protected)
> > > and which restricts access to different parts of the site depending on 
> >the
> > > roles a user possesses. The roles each user has are stored as XML in a
> > > database and may be configured by an administrator. Does struts have any
> > > built-in security capabilities that I could take advantage of?
> > >
> > >
> > >  Any help/pointers would be much appreciated!
> > >
> > >  My first guess would be to put all jsp pages in WEB-INF (use only
> > > ForwardAction to get to each pa

RE: Security and Struts

2002-07-30 Thread Troy Hart

I tend to think the action is the wrong place for this sort of thing. I
could be wrong but that's just how it occurs to me. It seems that this
should either be handled in front of your web application (using
cma/filters) or by the front controller components in the struts
framework (NOTE: requests that do not map to the controller servlet,
like requests directly to a jsp page, will not invoke your request
processing logic). 

Struts also helps you along here. It provides a way for you to
*declare*, along with each action mapping (in struts-config.xml), a
specific set of roles that have access to the given action. Then, the
RequestProcessor defines the method processRoles() that you are free to
override, but by default it will invoke:

request.isUserInRole(someRole)

for each role declared in the action mapping. If the user is found to be
included in any of the roles then processRoles() returns true, otherwise
it returns false. True is also returned in the case where no roles are
declared on the action mapping. Check out the struts source for more
detail...

Unless you use the cma/filters approach (and I haven't, so I don't know
what the issues are there), there will still be some details for you to
work out with respect to getting an authenticated user into the session.
This could be handled in a number of different ways. One that occurs to
me, off the top of my head, would be to wire a login page into the page
that is forwarded when processRoles() returns false...

There may be some mis-truths in what I have said here, I am currently
working through some of this stuff, but in general I think the idea is
sound. Certainly having declarative security is something that you
should strive for...

If anyone has feedback on what I've said here, I would love to hear it! 

Thanks & Good Luck,

Troy


On Tue, 2002-07-30 at 12:59, Nelson, Tracy (ETW) wrote:
> I'd have each form check authorization.  That way, if someone bookmarks a
> page (or guesses its URL) they won't bypass your security scheme.  You could
> have a global exception set up in your configuration file that forwards to
> an "Access denied" page whenever one of your forms threw a UserNotAuthorized
> exception.  (NOTE: I am just learning Struts and haven't even written my
> first application using it yet.  I may not know what I am talking about.)
> 
> Cheers!
> -- Tracy
> 
> -Original Message-
> From: Ryan Cuprak [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 30, 2002 11:53
> To: [EMAIL PROTECTED]
> Subject: Security and Struts
> 
> 
> 
> Hello,
>  I was hoping someone would have some advice on securing a website using
> struts. I am developing a webapp that has to be secure (password protected)
> and which restricts access to different parts of the site depending on the
> roles a user possesses. The roles each user has are stored as XML in a
> database and may be configured by an administrator. Does struts have any
> built-in security capabilities that I could take advantage of?
> 
> 
>  Any help/pointers would be much appreciated!
> 
>  My first guess would be to put all jsp pages in WEB-INF (use only
> ForwardAction to get to each page) and subclass ActionServlet with the logic
> for check authentication etc. However, will this cause any problems when it
> comes to a user book marking a page?
> 
> Thanks,
> -Ryan Cuprak
> 
> 
> 
> --
> 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: validating existence of session attributes in all Actions

2002-07-30 Thread Troy Hart

I've done the same sort of thing in the past, but over time I grew to
dislike the fact that all my actions needed to extend the one that
implemented this special logic. It made it so that I couldn't freely use
standard actions, like those defined in org.apache.struts.actions.
However, by putting this logic in the front controller
(RequestProcessor/ActionServlet) component you break the dependency on
the base action and life is good again...

Troy

On Mon, 2002-07-29 at 17:10, Struts Newsgroup (@Basebeans.com) wrote:
> Subject: Re: validating existence of session attributes in all Actions
> From: "David Chu" <[EMAIL PROTECTED]>
>  ===
> Ah, thanks, I ended up creating a subclass of Action,
> VerifySessionVarsAction, whos perform() verifies certain session variables
> then calls performWithVerifiedUser().  This new method
> performWithVerifiedUser() does nothing in this class but subclasses of
> VerifySessionVarsAction, such as GetUserShoppingCart() override
> performWithVerifiedUser rather than perform().  This seems to work pretty
> well.  (Is this a good design?) Thanks!
> 
> --
> -david
> 
> --
> David C. Chu
> America Online
> Network Tools Intern
> --
> "Troy Hart" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]...
> > You could extend the request processor if you are using 1.1 or the
> > ActionServlet otherwise. Every request is handled by these front
> > controllers and therefore they provide a good place to put logic that
> > pertains to all your actions. To answer your last question, look at the
> > process() method of the ActionServlet or RequestProcessor (which ever is
> > appropriate for your app).
> >
> > Hope this helps,
> >
> > Troy
> >
> >
> >
> > On Sat, 2002-07-27 at 12:55, Struts Newsgroup (@Basebeans.com) wrote:
> > > Subject: validating existence of session attributes in all Actions
> > > From: "David Chu" <[EMAIL PROTECTED]>
> > >  ===
> > > What is the best way to check across all (or most) Actions that certain
> > > session attributes are set?  I could do an if test inside each Action's
> > > perform() but I was wondering if there is a standard extension to handle
> > > this?  So does the ability to define a universal pre_perform() exist?
> > >
> > > --
> > > -david
> > >
> > > --
> > > David C. Chu
> > > America Online
> > > Network Tools Intern
> > > --
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




Re: validating existence of session attributes in all Actions

2002-07-29 Thread Troy Hart

You could extend the request processor if you are using 1.1 or the
ActionServlet otherwise. Every request is handled by these front
controllers and therefore they provide a good place to put logic that
pertains to all your actions. To answer your last question, look at the
process() method of the ActionServlet or RequestProcessor (which ever is
appropriate for your app).

Hope this helps,

Troy



On Sat, 2002-07-27 at 12:55, Struts Newsgroup (@Basebeans.com) wrote:
> Subject: validating existence of session attributes in all Actions
> From: "David Chu" <[EMAIL PROTECTED]>
>  ===
> What is the best way to check across all (or most) Actions that certain
> session attributes are set?  I could do an if test inside each Action's
> perform() but I was wondering if there is a standard extension to handle
> this?  So does the ability to define a universal pre_perform() exist?
> 
> --
> -david
> 
> --
> David C. Chu
> America Online
> Network Tools Intern
> --
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
> 



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




Re: How do I navigate from one subApp to another in Struts1.1?

2002-07-26 Thread Troy Hart

Craig,

What do you mean below??? I am trying to understand how sub-applications
work and I thought I had a handle on it, but I am now confused. Why/how
are you bypassing the controller servlet when using



Can you tell me where my understanding of the this process breaks down?
I will spell out the major steps that are related to the sub-application
stuff as I see it:

1) A request comes in to ActionServlet, which inspects the request path
to determine the sub-application to use (which may be the default app --
sub-app prefix = ""), and fetches the application configuration for that
sub-application. 
3) The application configuration request attribute is updated to hold
the current sub-app configuration.
4) The process() method of the sub-app specific request processor is
invoked, which ultimately may end up forwarding to a jsp page that
contains 
5) html:link taglib code accesses the current sub-application
configuration to lookup the global forward "foo" and renders the link
appropriately. That is to say, if the current sub-app has defined a
contextRelative forward named "foo" that references an action in the
"goo" sub-app a link to some "goo" sub-app action will be rendered in
the browser.
6) Now the page is rendered and the user clicks the link to the "goo"
sub-app action.

Is this request not bound for the action servlet? And/or will it not
cause the action servlet to select the "goo" sub-application
configuration?

Also, I would like to be able to use the SwitchAction, but can not tet
it to work. Does it really work for you in practice? From what I am able
to gather no one has ever been successful at getting it to work and I
wonder what you are doing differently. 

I've posted a few messages already on this topic, but I've never had a
single response. If you could spare a few minutes to point me in the
right direction I would greatly appreciate it. The company I work for is
collaborating with 2 other companies to build a single struts
application for the department of defense EMall. As you can well
imagine, the sub-application features of struts are very desirable given
our situation.

Many thanks for any help I can get on this issue!

Troy

> 
> The tempting way to do this is to do something like
> 
>   
> 
> and mark the "foo" forward as being context relative.  However, this will
> ONLY work if you are switching to the default sub-app, because you'd be
> bypassing the controller servlet where sub-app selection is performed.
> 
> The better way is to make your link go through an  that uses the
> standard SwitchAction class.  This wants you to send along the application
> prefix of the sub-app you want to switch to, as well as a resource in that
> sub-app to forward to after the switch.
> 
> > danny
> >
> 
> Craig
> 



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




Re: sub-apps and templates

2002-07-17 Thread Troy Hart

Never mind, I figured it out. It turns out the the  and
 tags do not prefix the sub-app name to the given URI
(which is a relief). I had a problem in my struts-config that made it
look like this was happening.

Thanks,

Troy

On Wed, 2002-07-17 at 15:50, Troy Hart wrote:
> Is there way to tell the template tag libs to treat URIs as context
> relative?
> 
> I am working on a large struts application that has been split into
> multiple sub-apps. We are using the template tag libs and I would like
> to be able to share some of the templates/content across all the
> sub-apps. However, the sub-app prefix is always prefixed to the URIs I
> specify with  and , resulting in bogus
> URIs.
> 
> I can provide more information if it is helpful. 
> 
> Thanks in advance,
> 
> Troy
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>




sub-apps and templates

2002-07-17 Thread Troy Hart

Is there way to tell the template tag libs to treat URIs as context
relative?

I am working on a large struts application that has been split into
multiple sub-apps. We are using the template tag libs and I would like
to be able to share some of the templates/content across all the
sub-apps. However, the sub-app prefix is always prefixed to the URIs I
specify with  and , resulting in bogus
URIs.

I can provide more information if it is helpful. 

Thanks in advance,

Troy




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




SwitchAction

2002-07-12 Thread Troy Hart

Does anyone have any information on the status of the SwitchAction. It
simply doesn't work as far as I can tell...

I've read all the emails on this list that talk about it, and I've
looked at the source. I've also previously posted a message on the topic
but no one has responded...

Has anyone ever seen this work??? 

Thanks in advance for your time!

Troy




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




switching sub-application issues

2002-07-11 Thread Troy Hart

I have recently started using the new sub-application feature of
struts-1.1 and I think it is an excellent addition. However, the
standard SwitchAction does not seem to work as advertised. I am
currently able to work around this issue by defining global forwards
(with the contextRelative attribute set to "true") in sub-applications
that need to link to other sub-applications... However, I feel that I
will be faced with a real problem unless the technique used in the
standard SwitchAction can be made to work as advertised.

I have read all the email on this list that talks about the issue and I
have the same problem that everyone else has. 

I have looked at the source and in my cursory review I don't see how
this action could possibly work. In the RequestProcessor, the method
processForward() contains the following lines of code:


// Construct a request dispatcher for the specified path
String uri = appConfig.getPrefix() + forward;


The problem I see with this is that the appConfig variable is the member
variable of the RequestProcessor that is processing the current
SwitchAction request, not the ApplicationConfig object that was set on
the request by the RequestUtils.selectApplication() call made in the
SwitchAction (*). That said, appConfig.getPrefix() will not return the
prefix of the sub-application you want to switch to...

(*) Another problem I am seeing is the ApplicationConfig request
attribute (key='org.apache.struts.action.APPLICATION'), which is set in
the SwithAction via the RequestUtils.selectApplication() call, is
getting overwritten by the time the jsp gets controll... I have verified
that selectApplication() is setting the ApplicationConfig to that of the
sub-application I am trying to switch to. However, when I inspect the
request attributes from my jsp page the ApplicationConfig attribute is
somehow magically reset to the config for the sub-app that invoked the
SwitchAction...

Is anyone currently addressing this issue??? Has anyone ever seen
SwitchAction work as advertised??? If so what is the trick???

Thanks,

Troy


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




Re: Form Bean

2001-11-01 Thread Troy Hart

Ted, your response caught my attention. I haven't noticed problems, but
I also haven't got down to serious debugging so maybe I just haven't
noticed it yet... Anyway, are you supposed to call setServlet() whey you
instantiate a Form yourself and put it on the session (say from within
some Action's perform method)? What about when you set it as a request
attribute? ...I guess the latter case probably wouldn't be a problem???
Are there any other gotcha to watch out for if you are using this
technique??? 

Thanks, 

Troy 


Ted Husted writes: 

> When you create the ActionForm, are you calling setServlet()? 
> 
> Cameron Ingram wrote:
>> 
>> Hi all! 
>> 
>>  Ok here is the problem I have a form bean that I create in an action class, I 
>then set the variables in it and then add it to the session.
>> This is before the corresponding jsp has been loaded  The jsp is loaded and it 
>appears that the action servlet is then recreating the form bean and re-adding it to 
>the session, thus all of the fields I set are set back to there original values. I 
>overrode the reset method so I know that it's not calling that to clear the 
>variables.  As I understand it the action servlet should check to see if it's in the 
>session before it recreates it. The name I am using to define it in the session is 
>the same name that the struts-config file uses to define the name. Any ideas??? 
>> 
>> This is the name that I am using when 
>the form bean is added to the session.
>>   type="net.pscu.ndswebutils.EditDeleteUserNdsForm"/> 
>> 
>> --
>> 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: Sorting at client side

2001-10-31 Thread Troy Hart

John, your solution is similar to how most people would do it, but it 
wouldn't be client side sorting. The only way you are going to do client 
side sorting would be to use javascript or an applet... Personally, I 
wouldn't recomend client side sorting. 

Raj, are you sure you want to do this on the client side? 

Troy 

John Schroeder writes: 

> Raj, 
> 
> I have implemented this.  I have created an object called Table which holds
> tabular data (typically populated from a ResultSet).  This object has a
> sort() method which takes the column index as a parameter and will sort the
> Table according to that column index. 
> 
> On the JSP side, I have 2 tags:
>  TableTag- iterates over the contents of a table.
>  TableColTag - displays (formats) a particular column (for the row) in the
> table - e.g. displays the cell. 
> 
> For each of the header columns I have used an arrow graphic that is a link
> to an action with a parameter of sort (ascending or descending) and column
> name.  This will sort the table and return it to the JSP. 
> 
> Let me know if this is something that you might want to look at for your own
> use. 
> 
> --John 
> 
>  
> 
>  
> 
> -Original Message-
> From: Rajeshwar Rao V [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 31, 2001 12:05 PM
> To: Struts Users Mailing List
> Subject: Sorting at client side 
> 
> 
> Hi , 
> 
>   We are displaying data in tabular form in a JSP. I want to sort it
> on column name. How can i do it at JSP level?
> we are using "Struts" in our application.Please help if anybody worked on
> same kinda stuff. 
> 
> Thnaks in advance
> raj 
> 
> --
> 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: 




HELPPPPPPPPPPPPPPPPPP (fwd)

2001-10-31 Thread Troy Hart

storck writes:
> Could someone HELP me with my previously posted messages 
> Its urgent!

I guess this is the previous message of which you speak... 

storck writes:
> Hi,  
> 
> How can I acces the index of a iterator-tag within a logic-tag ?  
> 
>
>  Index over 0
>   
>   
> 
> THANKS !  
> 

This should work for you: 



 Index over 0
 

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




Re: Placing JSP's below the WEB-INF directory

2001-10-26 Thread Troy Hart

I do exactly this, and it works great! 

Rahim Lalani writes: 

> Hi, 
> 
> I would like to hide all of my jsp pages under the WEB-INF directory so that
> I can place all of my security in my actions.  However, I would also like to
> use the Struts Template taglib such that my ActionForwards return jsp pages
> that use templates.  Will I be able to use "put" to include jsp pages that
> are located under the WEB-INF directory into a template?  If not, do you
> have any alternative suggestions? 
> 
> 
> Thanks, 
> 
> Rahim 
> 
 



Re: doubly nested data structures and iterate

2001-09-04 Thread Troy Hart

Has anyone ever used a collection within a collection???

On Monday 03 September 2001 10:59 am, Troy wrote:
> Is there a convenient way to work with the iterate tag, using the "indexed"
> attribute, and data structures that are doubly nested?
>
> I have a search form with a dynamic set of search attributes, and each
> search attribute optionally has a dynamic set of conditions.
>
> I have used scriptlets to generate request parameter names in the following
> form: "searchAttr[i].condition[j].someProperty". And these parameters have
> worked with standard html tags (they've successfully updated the correct
> property when the from has been submitted). However, the struts taglibs
> don't seem to want to work. When I try to use these generated names, I get
> exceptions (like "Invalid declaration" exceptions, where the array
> subscripts on searchAttr were complained about).
>
> Has any else worked with the iterate tag using the "indexed" attribute to
> accomplish something similar?
>
> I would envision being able to do something like the following:
>
>  property="searchAttributes">  name="searchAttr" properties="conditions">  name="condition" property="someProperty" /> 
> 
>
> I would then expect the  tag to generate a parameter name as my
> scriptlet does...
>
> Any thoughts on this would be appreciated!
>
> Thanks,
>
> Troy
>
>
> __
> Your favorite stores, helpful shopping tools and great gift ideas.
> Experience the convenience of buying online with Shop@Netscape!
> http://shopnow.netscape.com/
>
> Get your own FREE, personal Netscape Mail account today at
> http://webmail.netscape.com/



Re: rtexprvalue - what is it?

2001-09-04 Thread Troy Hart

That is true or false based on whether or not the attribute can accept a run 
time expression. That is, in the jsp can you do the following or not:



On Monday 03 September 2001 05:01 pm, you wrote:
> In the .tld files, every attribute looks like this. But I can't find
> anything anywhere about the third one:  rtexprvalue, and when to set it
> true and false.
>
> 
> value
> false
> true
> 
>
> Also, where did I miss it, if it is in the documentation somewhere?
> --
> Pete Carapetyan
> http://datafundamentals.com
> Java Development Services
>
> Open standards technology for commercial profitability



Re: ActionForm question ?

2001-09-04 Thread Troy Hart

You'd have the same problems if you used request scope. What you need to do 
is reset your form after the acton has successfully processed it.

Troy

On Tuesday 04 September 2001 04:02 am, you wrote:
> As much as I know, if you redisplay your form, and you use "session" for
> your scope, it will show you the values. If you need a initialized form,
> use "request" instead.
>
> marcel
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 04, 2001 11:53 AM
> To: [EMAIL PROTECTED]
> Subject: ActionForm question ?
>
>
> Hello,
>
> I've got a functionnal problem with ActionForm:
>
> I fill a form and submit then when I re-display this
> form, my old value are display on the form.
>
> How can I initialize the ActionForm after sumit ?
>
> Where the ActionForm is stocked (session, request, ...
> ) ?
>
> Thanx.
>
> ___
> Do You Yahoo!? -- Un e-mail gratuit @yahoo.fr !
> Yahoo! Courrier : http://fr.mail.yahoo.com



Re: Validation errors and scope.

2001-09-03 Thread Troy Hart

Beans that were in the request when the page was rendered are long gone when 
you submit a "new" request from that page. Therefore, you must re-create them 
and put them back in the request if the validation fails. Many people forego 
validation in the form and do it in the action instead to accommodate this 
need...

Troy

On Monday 03 September 2001 12:10 pm, you wrote:
> Hi,
>
> My question concerns beans in the request scope and what happens to them
> when validation fails. In fact I know they disappear, and that is my
> problem. I do not want to use the session scope to store them for the
> reasons below.
>
> THE CONTEXT
>
> I am on an intranet project where it has been decided to have very long
> session time out. We will have quiet a few users on the system (~ 500), so
> we want to put our beans (whether forms or other beans) in the request
> scope as we don't want to have too many of them in the session (too much
> memory would be used too long).
>
> My pages contain some dynamic content, which I pass on to my jsp through
> beans (stored in the request). The problem is that when the forms are
> validated and fail validation, only the data that is in the form is kept as
> the user is redirected to the data-entry page. Any object in the request is
> purged.
>
> POTENTIAL SOLUTIONS but not quiet satisfying
>
> The  tag:
> The beans I use for the dynamic content are too complex to be handled
> through the  tag, so that is not an option. And anyway,
> the form is not a good to put these beans in as they are not data to be
> modified by the user.
>
> Using the session scope:
> One of the solutions is to use the session scope and remove the beans from
> the session once we don't need them anymore. But this can be easily
> forgotten and is not obvious to spot. It also reminds me too much of C++.
> :(
>
> SO...
>
> So... Is there any way in struts that would allow the data in the request
> scope to be reused when validation fails? Or another to organise the lot?
> Did I miss something?


Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
Content-Transfer-Encoding: quoted-printable
Content-Description: 





Re: Dynamic Forwarding ...

2001-09-03 Thread Troy Hart

Instead of trying to add a parameter to the forward, it sounds like you would 
be better served to simply add a request attribute to specify the "formName". 
In your action class you do this:

request.setAttribute("formName", action);

Then on your jsp page:



That should do it.

Troy

On Monday 03 September 2001 03:34 am, you wrote:
> Thanks, Ted, for the reply.
> Actually, I am not forwarding from Action to Action.
> The mapping of the forward "dummy" resolves to a JSP
> named dummy.jsp and not an action (*.do).
>
> From an action, on submit, I would like to tansfer
> control to a JSP to accept more inputs. Along with
> this control transfer, I would like to pass a
> parameter to indicate some logic.
>
> I finally did this using a request.getParameter(
> "formName" ) in the JSP as a scriplet, and declaring a
> hidden property in the JSP :
> 
>
> Now I can access this property from the action class
> of the form dummyForm. Please suggest, if there is a
> better method of doing this (without the scriplet).
>
> Regarding the link that u have mentioned, I had
> already gone thru it. I do not understand one point.
> If I have a form formA, having a property "formName",
> then when I forward to another form, formB, how will
> the property be retained as part of formB ?
>
> Regards.
>
> - Debasish
>
> --- Ted Husted <[EMAIL PROTECTED]> wrote:
> > What's in the JSP wouldn't matter, since you are
> > going from one Action
> > to another.
> >
> > If formName is a property in the ActionForm, then it
> > shuld be populated.
> >
> > I would try using request.getParameter("formName")
> > and see if that's
> > null too.
> >
> > I'd also try hardcoding the value for action to be
> > sure that is not
> > null.
> >
> > If you haven't already, see also
>
> http://www.mail-archive.com/struts-user@jakarta.apache.org/msg14280.html
>
> > Debasish Ghosh wrote:
> > > Hi All -
> > >
> > > I have trying to implement dynamic forwarding in
> >
> > my
> >
> > > application.
> > > In the Action class where I am preparing the
> >
> > forward
> >
> > > URL, I am doing the following :
> > >
> > > ActionForward fwd = mapping.findForward("dummy");
> > > StringBuffer path = new StringBuffer(
> >
> > fwd.getPath() );
> >
> > > path.append( "?formName=" ).append( action );
> > > return new ActionForward( path.toString(),
> > >   fwd.getRedirect() );
> > >
> > > With this, I am getting the correct parameter to
> > > ActionForward, and the control is also forwarded
> >
> > to
> >
> > > the appropriate JSP. But I am not able to access
> >
> > the
> >
> > > passed-in parameter. I have a property named
> > > "formName" in the called form. But from the action
> >
> > of
> >
> > > the called form, when I access the property
> > > getFormName(), I get NULL.
> > >
> > > In order to achieve this, do I have to declare
> > > anything in the JSP ?
> > >
> > > Please help !!
> > >
> > > Regards.
> > >
> > > - Debasish
> > >
> > > __
> > > Do You Yahoo!?
> > > Get email alerts & NEW webcam video instant
> >
> > messaging with Yahoo! Messenger
> >
> > > http://im.yahoo.com
>
> __
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
> http://im.yahoo.com



Re: obtaining action forwards in jsps

2001-08-30 Thread Troy Hart

look at 

Troy

On Wednesday 29 August 2001 04:24 am, you wrote:
> Hi,
>
> Is there any way to obtain the action forward urls in jsps using their
> logical 'struts-config' name? I'd like to code links etc point to certain
> action forward urls found in struts config rather than hard coding the url?
> Similarly I'd like to be able to change the action url of forms using
> values found in struts-config using the logical forward name.
>
> Is this possible?
>
> Cheers
> Nathan
>
>
> **
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
>
> www.mimesweeper.com
> **



Re: Setting focus on field with error

2001-08-16 Thread Troy Hart

On Thursday 16 August 2001 01:55 pm, you wrote:
> I could be wrong but I can't think of anything that would be very
> convenient. The only way I could imagine doing it (and I'm not sure it
> would even work) would be to invoke a javascript function every time the
> page loads. You could add a bean with the data needed by the javascript  to
> the request, from your action class. NOTE: this would require you to forgo
> the automatic form validation and instead trigger validation from your
> action class. This is the only way to get the bean I talked about into the
> request (as a request attribute that is).

oops, wasn't thinking straight. The validate method takes the request as an 
argument so you wouldn't need to forgo automatic form validation. 

>
> Troy
>
> On Thursday 16 August 2001 11:03 am, you wrote:
> > Is their a nifty way to have the focus automagically go to the field with
> > the error, on an input form?  For example, if I have a form with an
> > 'amount' field, and the user enters an invalid amount, causing my Action
> > to return an appropriate error, keyed in the ActionErrors container with
> > the 'amount' property, is there a slick way to have the focus set to that
> > field on the form?  I know how to have the error message display next to
> > the offending field, but having the focus go there also would be nice.
> >
> > Thanks!
> >
> > Steve Molitor
> > [EMAIL PROTECTED]



Re: Setting focus on field with error

2001-08-16 Thread Troy Hart

I could be wrong but I can't think of anything that would be very convenient. 
The only way I could imagine doing it (and I'm not sure it would even work) 
would be to invoke a javascript function every time the page loads. You could 
add a bean with the data needed by the javascript  to the request, from your 
action class. NOTE: this would require you to forgo the automatic form 
validation and instead trigger validation from your action class. This is the 
only way to get the bean I talked about into the request (as a request 
attribute that is).

Troy

On Thursday 16 August 2001 11:03 am, you wrote:
> Is their a nifty way to have the focus automagically go to the field with
> the error, on an input form?  For example, if I have a form with an
> 'amount' field, and the user enters an invalid amount, causing my Action to
> return an appropriate error, keyed in the ActionErrors container with the
> 'amount' property, is there a slick way to have the focus set to that field
> on the form?  I know how to have the error message display next to the
> offending field, but having the focus go there also would be nice.
>
> Thanks!
>
> Steve Molitor
> [EMAIL PROTECTED]



Re: book ??????????

2001-08-14 Thread Troy Hart

Thanks, sorry for being snippy. 


On Tuesday 14 August 2001 09:01 am, you wrote:
> The server is doing that, not the messenger.  I had that happen to one of
> my previous messages also...
>
>
>
>
>
>     Troy Hart
> <[EMAIL PROTECTED]To:
> [EMAIL PROTECTED] et>  cc:
>  Subject: Re: book ??
> 08/14/2001
> 09:45 AM
> Please
> respond to
> struts-user
>
>
>
>
>
>
> ENOUGH ALREADY!!!
>
> On Friday 14 July 2000 12:59 am, you wrote:
> > Hi everybody
> >
> > is there any book where i can find strut related material???
> >
> >
> > praveen



Re: Acronym BMO ( Session Beans )What does it stand 4.

2001-08-14 Thread Troy Hart

I'm not sure, but I would guess Business Model Objects.

On Tuesday 14 August 2001 02:21 am, you wrote:
> Hi i didn't get a response or a suggestion regarding BMO (Session Beans
> ) Thus i would like to know what this acronym stands for . I have come
> across a UML class diagram that connects a BMO TO a DAO (Data Access
> Object ) via Query / Update.Has or does BMO SOMETHING TO DO WITH
> Business Method Objects to hazard a guess as it is within the Business
> Layer of the UML Class Diagram
>
> Cheers Chuckie



Re: book ??????????

2001-08-14 Thread Troy Hart

ENOUGH ALREADY!!!

On Friday 14 July 2000 12:59 am, you wrote:
> Hi everybody
>
> is there any book where i can find strut related material???
>
>
> praveen



Re: session question

2001-08-08 Thread Troy Hart

There is no way to approach this problem as you currently are. You should be 
able to achieve the same effect however, but you will need to restructure 
your approach. Not knowing the details of you situation I would advise you to 
think in terms of having an action initialize your action form and set it as 
a request (or session...) attribute. 

Good Luck,

Troy

On Tuesday 07 August 2001 07:16 am, you wrote:
> Thanks for the response but I was talking about the ActionForm not the
> Action - perhaps I wasn't clear in my earlier post.  The reason I am asking
> is that I would like to prepare some data for a jsp within an ActionForms
> constructor and have the jsp display this data via reflection of the
> ActionForms elements.  I would like to be able to grab a value from the
> session within the ActionForms constructor but can't figure out how to
> access it as there doesn't seem to be any means of doing so.
>
> Anyone have any thoughts?
>
> Simon.
>
> -Original Message-
> From: Jon Crater [mailto:[EMAIL PROTECTED]]
> Sent: 07 August 2001 13:47
> To: [EMAIL PROTECTED]
> Subject: Re: session question
>
>
> the action form's perform method receives a HttpServletRequest object,
> which
>
> has a getSession() method.  call it to get access to the current session.
> note that getAttribute(String key) returns Object, so a typecast would
> probably be required.
>
> public ActionForward perform(ActionMapping mapping, ActionForm form,
> HttpServletRequest request, HttpServletResponse response)
> {
>HttpSession session = request.getSession();
>YourObject o = (YourObject)session.getAttribute("yourSessionKey");
>//do something with the object
> }
>
>
> Original Message Follows
> From: "Prior, Simon" <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: session question
> Date: Tue, 7 Aug 2001 13:33:31 +0100
>
> Hi all,
>
> Does anybody know whether it is possible to access elements on the session
> from the action form? - outside of the methods reset and validae?
>
> Thanks,
>
> Simon.
> For optimum solutions that save you time, visit www.ds-s.com.
>
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
> For optimum solutions that save you time, visit www.ds-s.com.



Re: Templates: a design question

2001-08-02 Thread troy hart

In my mind it's a cleaner separation to do it with multiple files. The
page(s) responsible for the "content" can focus exclusively on that content,
and the page responsible for laying out the template (i.e. putting the named
"content" elements in place) can focus on that. It ends up being very easy
to maintain this way. This is especially true in the case where your
template defines multiple "non-direct" named "content" elements. In my
example you can develop these elements of content as reusable components...

To be honest, I had never even given your suggestion any thought. I imagine
there may be situations where this would be extremely convenient, and as
long as it works I'd say do it if it fits your needs...

Troy

- Original Message -
From: "Erik Hatcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 02, 2001 12:46 AM
Subject: Re: Templates: a design question


> Troy,
>
> Why have two pages for each page that uses templates rather than collapse
> them into a single page with the content embedded like this:
>
> 
> content here
> 
>
> By having two pages, don't you end up with one page having the page title,
> and the other with the content as well as possibly other things separated?
>
> Erik
>
> - Original Message -
> From: "troy hart" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, August 01, 2001 9:25 AM
> Subject: Re: Templates: a design question
>
>
> > The approach I use (and I believe it is a common approach) is to have
two
> > jsp pages for each page on my site that is going to use templates. For
> > example, if I have an ecommerce site it is likely I will have a shopping
> > cart page, a search page and a search results pages... For this example,
> the
> > set of jsp pages would be as follows:
> >
> > MainLayout.jsp - the main template layout page.
> > ShopCart_content.jsp - the actual content of the shopping card page.
> > ShopCart.jsp - the shopping cart page that references MainLayout.jsp and
> > tells it to use ShopCart_content.jsp...
> > Search_content.jsp - the actual content of the search page.
> > Search.jsp - the search page that references MainLayout.jsp and tells it
> to
> > use Search_content.jsp...
> > SearchResults_content.jsp - the actual content of the search results
page.
> > SearchResults.jsp - the search results page that references
MainLayout.jsp
> > and tells it to use SearchResults_content.jsp...
> >
> > This way your action mappings reference ShopCart.jsp, Search.jsp, and
> > SearchResults.jsp...
> >
> > Hope this helps,
> >
> > Troy
> >
> >
> > - Original Message -
> > From: "Oleg Bondarenko" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 01, 2001 10:57 AM
> > Subject: Templates: a design question
> >
> >
> >
> > Hello all,
> >
> > I am very new to Struts and I find it interesting. I like the action
> mapping
> > and also templates, but I have difficulties using them together.
> >
> > E.g. I have a central page, say Main.jsp that has a template which
> contains
> > constant header and footer and a variable content part. This content
part
> (a
> > jsp) must be determined at the run-time. Because of the template I have
to
> > always send back to the user the Main.jsp. How to use action mapping
then?
> >
> > One possible solution would be the following. The action handler stores
> the
> > variable content part as a session attribute and always returns the
global
> > mapping "main" (which is mapped to the Main.jsp). The Main.jsp retrieves
> the
> > central variable part from the session and pass it to the template.
> >
> > This works, but I have a feeling that I am not correctly using the
Struts.
> > Any input from experts would be highly appreciated.
> >
> > Best Regards,
> > Oleg Bondarenko
> >
> >
> >
> > --
> >
> > Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
> > Informationen. Wenn Sie nicht der richtige Adressat sind oder diese
E-Mail
> > irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
> > vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> > Weitergabe dieser Mail ist nicht gestattet.
> >
> > This e-mail may contain confidential and/or privileged information. If
you
> > are not the intended recipient (or have received this e-mail in error)
> > please notify the sender immediately and destroy this e-mail. Any
> > unauthorised copying, disclosure or distribution of the material in this
> > e-mail is strictly forbidden.
> >
> >
> >
>
>




Re: Templates: a design question

2001-08-01 Thread troy hart

The approach I use (and I believe it is a common approach) is to have two
jsp pages for each page on my site that is going to use templates. For
example, if I have an ecommerce site it is likely I will have a shopping
cart page, a search page and a search results pages... For this example, the
set of jsp pages would be as follows:

MainLayout.jsp - the main template layout page.
ShopCart_content.jsp - the actual content of the shopping card page.
ShopCart.jsp - the shopping cart page that references MainLayout.jsp and
tells it to use ShopCart_content.jsp...
Search_content.jsp - the actual content of the search page.
Search.jsp - the search page that references MainLayout.jsp and tells it to
use Search_content.jsp...
SearchResults_content.jsp - the actual content of the search results page.
SearchResults.jsp - the search results page that references MainLayout.jsp
and tells it to use SearchResults_content.jsp...

This way your action mappings reference ShopCart.jsp, Search.jsp, and
SearchResults.jsp...

Hope this helps,

Troy


- Original Message -
From: "Oleg Bondarenko" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 01, 2001 10:57 AM
Subject: Templates: a design question



Hello all,

I am very new to Struts and I find it interesting. I like the action mapping
and also templates, but I have difficulties using them together.

E.g. I have a central page, say Main.jsp that has a template which contains
constant header and footer and a variable content part. This content part (a
jsp) must be determined at the run-time. Because of the template I have to
always send back to the user the Main.jsp. How to use action mapping then?

One possible solution would be the following. The action handler stores the
variable content part as a session attribute and always returns the global
mapping "main" (which is mapped to the Main.jsp). The Main.jsp retrieves the
central variable part from the session and pass it to the template.

This works, but I have a feeling that I am not correctly using the Struts.
Any input from experts would be highly appreciated.

Best Regards,
Oleg Bondarenko



--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte
Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail
irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und
vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte
Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorised copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.






Re: Action class question

2001-07-20 Thread troy hart

This would be entirely up to you... Depending upon the nature of the two
actions one choice may be preferable to the other.

If you wanted to have one action class you would need to check the request
to see which button was pressed. There would be a number of ways to do this
but the most straight forward would probably be to give the two buttons
distinct names. Then, if the "New" button was pressed there will be a
request parameter with it's name...

If you wanted to try the two action class approach you would probably need
to use javascript to toggle the value form's action between the two.

I would probably choose the first option in most cases.

Hope this helps,

Troy


- Original Message -
From: "Alberto Corona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 20, 2001 3:19 PM
Subject: Action class question


> Is an Action class responsbile for performing all
> possible actions submitted by a form?
>
> For example, if a Form includes two submit buttons: "New" and "Edit"
> Do I create one Action class that handles both actions?
> If so how do I check which submit button was pressed? Do I just check on
the
> HttpRequest?
>
> Thanks
>
> Alberto Corona
> ObjectWave Corp.
> 312.269.0111
> [EMAIL PROTECTED]
>
>




Re: not finding property on a form bean

2001-07-20 Thread troy hart

actually, my reply was a little hasty...on a closer look I'm little confused
at what you want...but here's my best guess.

If you really want to invoke the action associated with
"genTklsDailyForm.do" then the action of your form must not be
action="tklsDaily.do", but rather action="/genTklsDailyForm.do" (take note
of the slash).

Then your action-mapping should be:



  


...




This may not be exactly what you want, but it should work... I would
recomend taking a closer look at how to specify an action in your
struts-config.xml fileyou may want to specify the scope...

Hope this helps,

Troy

- Original Message -
From: "Paul Holser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 20, 2001 12:11 PM
Subject: not finding property on a form bean


new to struts, bear with me...8^)

i'm having difficulty making a particular form bean's properties available
to a JSP.

scenario:

...requesting genTklsDailyForm.do
...the TicketlessDailyReportFormAction puts a
com.blah.TicketlessDailyReportForm
bean into request scope
...then forwards to /jsp/tklsDailyForm.jsp
...error is: No getter method available for property selectedDateRange for
bean
under name org.apache.struts.taglib.html.BEAN

any hints?

my JSP:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


Commissions: Ticketless Daily Report Form



  

  




TicketlessDailyReportForm has these methods:

public String getSelectedDateRange()
public void setSelectedDateRange(String selectedDateRange)
public String[] getDateRanges()

relevant synopsis of my struts-config.xml:


  ...
  

  
  

  


  

  







Re: not finding property on a form bean

2001-07-20 Thread troy hart

You seem to have action element a little messed up... try the following
(notice the change to "path" and the addition of "name"):



  

...



- Original Message -
From: "Paul Holser" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 20, 2001 12:11 PM
Subject: not finding property on a form bean


new to struts, bear with me...8^)

i'm having difficulty making a particular form bean's properties available
to a JSP.

scenario:

...requesting genTklsDailyForm.do
...the TicketlessDailyReportFormAction puts a
com.blah.TicketlessDailyReportForm
bean into request scope
...then forwards to /jsp/tklsDailyForm.jsp
...error is: No getter method available for property selectedDateRange for
bean
under name org.apache.struts.taglib.html.BEAN

any hints?

my JSP:

<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


Commissions: Ticketless Daily Report Form



  

  




TicketlessDailyReportForm has these methods:

public String getSelectedDateRange()
public void setSelectedDateRange(String selectedDateRange)
public String[] getDateRanges()

relevant synopsis of my struts-config.xml:


  ...
  

  
  

  


  

  







forwarding with an anchor directive

2001-07-06 Thread troy hart



I have a situation in which I need to forward to a 
certain place with a form (i.e. I need to reference an anchor in my href...). I 
can code my action class to determine what the anchor needs to be, but I'm at a 
loss for how I would get the ActionForward to include the anchor...
 
I could maybe do something like: 
myActionForward.setPath(myActionForward.getPath() + 
"myAnchor");
 
But then I believe the path would be tainted 
for subsequent requests that need to use that 
ActionForward
 
Has anyone dealt with this issue 
before???
 
Thanks,
 
Troy


Re: JavaBeans creation

2001-07-06 Thread troy hart

Try JBuilder, it has a bean wizard tool. Also, I don't know for sure but I'd
imagine most of the top tier java IDEs (like Forte or NetBeans or VisualAge
for Java...) would have similar features...

Troy


- Original Message -
From: "Marc-andre Thibodeau" <[EMAIL PROTECTED]>
To: "struts" <[EMAIL PROTECTED]>
Sent: Friday, July 06, 2001 9:02 AM
Subject: JavaBeans creation


>
> Hi!
>
> Could anybody suggest me a tool for generating JavaBeans setters and
> getters automatically?
> Thanks!
>
> MA
>
>




Re: html:link problem

2001-07-05 Thread troy hart



Additionally, you can always use the type property 
to in effect "cast" a bean that you define, so you could do this:
 

click 
here
 
This way your referece to myCollectionElement will 
be of the correct type, so getId() will be valid...
 
Hope this helps,
 
Troy

  - Original Message - 
  From: 
  troy hart 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 2:44 
  PM
  Subject: Re: html:link problem
  
  Well, there are a few different ways to handle 
  this. One possible scenario is this:
   
  
  click here
   
   
  
- Original Message - 
From: 
Rama 
Krishna 
To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 2:40 
PM
Subject: Re: html:link problem

cause it assumes myCollectionElement as a 
normal java Object and says no method getId() in 
java.lang.Object
 
 
 

  - Original Message - 
  From: 
  troy hart 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 1:36 
  PM
  Subject: Re: html:link problem
  
  What doesn't work with that???
  
- Original Message - 
From: 
Rama Krishna 
To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 2:25 
PM
Subject: Re: html:link 
problem

no. this doesn't work. then i'll have to 
use jsp bean tag and do this.
 
is there anyother way???
 
 

  - Original Message - 
      From: 
  troy hart 
  
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 
  1:08 PM
  Subject: Re: html:link 
  problem
  
  To the best of knowledge, you can't use 
  the  tag that way. I believe it would 
  be:
   
  click here
   
   
  Hope this helps...
  
- Original Message - 
From: 
Rama Krishna 
To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 
1:09 PM
Subject: html:link 
problem

is this correct
 
click here
 
where myCollectionElement is a  
collection
        
    id is a property in the collection
 
and i want  http:///target.cm?value=2 
(value of id)
 
i get null when i say
 
req.getParameter("value"); in my 
action class??
 
any help???
 
thanks,
rama
 
 
 
 
 


Re: html:link problem

2001-07-05 Thread troy hart



Well, there are a few different ways to handle 
this. One possible scenario is this:
 

click here
 
 

  - Original Message - 
  From: 
  Rama 
  Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 2:40 
  PM
  Subject: Re: html:link problem
  
  cause it assumes myCollectionElement as a 
  normal java Object and says no method getId() in java.lang.Object
   
   
   
  
- Original Message - 
From: 
troy hart 
To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 1:36 
PM
Subject: Re: html:link problem

What doesn't work with that???

  - Original Message - 
  From: 
  Rama 
  Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 2:25 
  PM
  Subject: Re: html:link problem
  
  no. this doesn't work. then i'll have to 
  use jsp bean tag and do this.
   
  is there anyother way???
   
   
  
- Original Message - 
From: 
    troy hart 

To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 1:08 
PM
Subject: Re: html:link 
problem

To the best of knowledge, you can't use the 
 tag that way. I believe it would be:
 
click here
 
 
Hope this helps...

  - Original Message - 
  From: 
  Rama Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 
  1:09 PM
  Subject: html:link problem
  
  is this correct
   
  click here
   
  where myCollectionElement is a  
  collection
          
      id is a property in the collection
   
  and i want  http:///target.cm?value=2 
  (value of id)
   
  i get null when i say
   
  req.getParameter("value"); in my action 
  class??
   
  any help???
   
  thanks,
  rama
   
   
   
   
   


Re: html:link problem

2001-07-05 Thread troy hart



What doesn't work with that???

  - Original Message - 
  From: 
  Rama 
  Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 2:25 
  PM
  Subject: Re: html:link problem
  
  no. this doesn't work. then i'll have to use 
  jsp bean tag and do this.
   
  is there anyother way???
   
   
  
- Original Message - 
From: 
troy hart 
To: [EMAIL PROTECTED] 

Sent: Thursday, July 05, 2001 1:08 
PM
Subject: Re: html:link problem

To the best of knowledge, you can't use the 
 tag that way. I believe it would be:
 
click 
here
 
 
Hope this helps...

  - Original Message - 
  From: 
  Rama 
  Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 1:09 
  PM
  Subject: html:link problem
  
  is this correct
   
  click here
   
  where myCollectionElement is a  
  collection
          
      id is a property in the collection
   
  and i want  http:///target.cm?value=2 
  (value of id)
   
  i get null when i say
   
  req.getParameter("value"); in my action 
  class??
   
  any help???
   
  thanks,
  rama
   
   
   
   
   


Re: html:link problem

2001-07-05 Thread troy hart



To the best of knowledge, you can't use the 
 tag that way. I believe it would be:
 
click 
here
 
 
Hope this helps...

  - Original Message - 
  From: 
  Rama 
  Krishna 
  To: [EMAIL PROTECTED] 
  
  Sent: Thursday, July 05, 2001 1:09 
  PM
  Subject: html:link problem
  
  is this correct
   
  click here
   
  where myCollectionElement is a  
  collection
          
      id is a property in the collection
   
  and i want  http:///target.cm?value=2 (value 
  of id)
   
  i get null when i say
   
  req.getParameter("value"); in my action 
  class??
   
  any help???
   
  thanks,
  rama
   
   
   
   
   


Re: beans and scope

2001-06-29 Thread troy hart

You could do the following in, say, one of your action classes to remove a
session scoped bean called "foo"

request.getSession().removeAttribute("foo");


- Original Message -
From: "Gangadharappa, Kiran" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, June 29, 2001 5:52 PM
Subject: RE: beans and scope


> if it is session scope, When will the bean get destroyed?
> Does it have to wait till the session is ended?
> What I mean is , isnt there any way to control the lifetime of this bean
say
> programmatically?
>
> -Original Message-
> From: Niall Pemberton [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 28, 2001 2:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: beans and scope
>
>
> You can use "request" scope by storing the values in hidden fields using
the
>  tag - that way the values you are not showing get
re-populated
> back into your form when submitted.
>
> Additionally to what John said about the "default" scope - I agree it is
> "session" but Struts also supplies two ActionMapping sub-classes which can
> be used to control the "default" scope - these are SessionActionMapping
and
> RequestActionMapping - all you have to do is add a "mapping" attribute to
> the web.xml and you can have whichever default scope you prefer.
>
> 
>   mapping
>
> org.apache.struts.action.RequestActionMapping
> 
>
> Niall
>
> > -Original Message-
> > From: DHarty [mailto:[EMAIL PROTECTED]]
> > Sent: 28 June 2001 21:22
> > To: [EMAIL PROTECTED]
> > Subject: RE: beans and scope
> >
> >
> > Thank you John!
> >
> > Funny thing is, I had changed that in previous attempts.  When that
didn't
> > work, I must have forgot to put it back.
> >
> > Speaking of request scope,  Is there a way to do this (wizard steps)
using
> > the request scope, or do I just have to make the action classes
> > responsible
> > for reseting the form to start from scratch?
> >
> > Thanks again
> >
> > David
> >
> > -Original Message-
> > From: John Schroeder [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 4:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: RE: beans and scope
> >
> >
> > Try removing the scope="request" line below.  The formbean will default
to
> > session scope (I believe).  If you specify request scope, then
> > the formbean
> > will be accessible on the second page, but not the third...
> >
> > This worked for me after I banged my head against it as well!!
> >
> > 
> >  >type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >name="ProjectForm"
> >scope="request"  <-- remove this.
> >validate="false"
> >input="/admin/project/project_create.jsp">
> >> path="/admin/project/project_add_leader.jsp"/>
> > 
> > 
> >
> > Hope this helps...
> >
> > --John
> >
> >
> >
> >
> >
> > -Original Message-
> > From: DHarty [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, June 28, 2001 12:57 PM
> > To: [EMAIL PROTECTED]
> > Subject: beans and scope
> >
> >
> > I'm trying to get a series of pages to populate a form ala a "wizard"
> > interface.
> >
> > Each page enters a chunck of information which is then forwarded
> > to the next
> > page in the sequence.  The previous information is dispalyed along with
an
> > area to enter the next bit of info.
> >
> > The Problem is that after the information on the second page is
> > entered, the
> > third page doesn't receive the information from the fist page, only the
> > second.  The informatoin never makes it into the second pages
> > action class.
> > I made the scope="session", but this still doesn't work.
> >
> > Please help, I've been banging my head against this for days.
> >
> >
> > --first page---
> > 
> >   Enter Project Name:   > property="name" tabindex="1" /> 
> >    
> >   Project Description:
> > > property="description" rows="5" tabindex="2" />
> >   
> >   
> >   
> > Next
> >   
> > 
> > --
> > -second page---
> >
> >  
> > Add Project Leader:
> > 
> > 
> >
> > Project Name:
> > 
> >
> > Project Description:
> > 
> >   
> > --
> > from stuts-config.xml---
> >  > type="edu.erau.dcm.teammate.form.ProjectForm"/>
> >
> > 
> >
> > 
> >  >type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >name="ProjectForm"
> >scope="request"
> >validate="false"
> >input="/admin/project/project_create.jsp">
> >> path="/admin/project/project_add_leader.jsp"/>
> > 
> > 
> >
> > 
> >  >type="edu.erau.dcm.teammate.action.ProjectCreateAction"
> >name="ProjectForm"
> >scope="request"
> >validate="false"
> >input="/admin/project/project_add_le

setting properties on nested collections

2001-06-29 Thread troy hart

I know there has been talk around this subject, if it hasn't been addressed
directly, but I can't seem to find the answer that will work.

My problem:

I have a bean (instance of an ActionForm), lets call it OrderForm. It has an
ArrayList of LineItem objects, and each LineItem contains ArrayList of
Detail objects (the Detail contains shipping information...I allow a
LineItems to be split to multiple shipping addresses...). I can successfully
itterate over and display the contents of this nested structure, but the
problems comes into play when I want to update the contents of the Detail or
LineItem objects. Note: it is no problem to update the simple String
properties of the OrderForm itself.

I simple don't know how to name the  properties such that the
BeanUtils class can set the values for me... Below is my approach (all
layout details left off and otherwise simplified...):

...
Some Order Property: 
...

Some Line Item Property: 
...

Some Detail Property: 
...


...

The code above renders on the page perfectly, but when I make a change to
one of the detail or lineItem properties they don't make it to the nested
objects... I understand that the names of the text  parameters that
are generated with the above code will not give the BeanUtils class a chance
in hell of setting the nested values for me, but I am at a loss for how to
approach this...

Any ideas??? Or can someone point me to an email that has already answered
this question???

Thanks,

Troy




RE: need ServletConfig object in Action class

2001-04-07 Thread Troy Hart

It's easier than that even. Your action class subclasses
org.apache.struts.action.Action which defines a protected instance of the
ActionServlet (servlet). So all you need to do from your action class is:

servlet.getServlerContext()...

Troy

-Original Message-
From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 06, 2001 3:37 PM
To: '[EMAIL PROTECTED]'
Subject: RE: need ServletConfig object in Action class



Yeah. Use the form object that comes as an input parameter in the perform()
method.

I think the call is ...  form.getServlet().getServletContext()..


-Original Message-
From: Bever, Nick [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 06, 2001 4:36 PM
To: '[EMAIL PROTECTED]'
Subject: need ServletConfig object in Action class


Is there any way to access the Action controller's ServletConfig object from
an Action class?  
 Thanks.

Nick Bever
Tallan
Email: [EMAIL PROTECTED]



RE: servlet context attribute?

2001-04-07 Thread Troy Hart

You could implement your class as a singleton.

-Original Message-
From: Young, Wayne [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 06, 2001 11:10 AM
To: Struts-User@Jakarta. Apache. Org (E-mail)
Subject: servlet context attribute?



I've seen references on this list about storing an object as a servlet
context attribute.

Basically, I want to create one instance of an object (to use as a cache)
and share it among all sessions. Does this require modifying ActionServlet &
adding the attribute? Or is there some other way?

Thanks.

Wayne
[EMAIL PROTECTED]



RE: html:submit tag question

2001-04-05 Thread Troy Hart

There is no support for this. I originally had a problem with this fact, but
when you think about it in terms of the fact that the action servlet is
using reflection to set properties automatically on your form beans, the
need to define your parameters names in a constants interface sorta goes
away. In reality it would be more problematic in this case to have to keep
your constants interface in sync with the properties of your form beans...if
that makes sense. The javadoc of your form beans give the person writing the
html the names of the properties automatically...

Troy


-Original Message-
From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 05, 2001 2:08 PM
To: '[EMAIL PROTECTED]'
Subject: html:submit tag question




Hi all,

  Is it possible to convert the below HTML into a struts tag ? Thanks
for your information.

" >


  p.s All names are declared in a Constants file so that they can be
accessed in a uniform way across the application.


cheers,
Amar..



RE: More about that "edit form" example...

2001-04-05 Thread Troy Hart

The controller servlet (ActionServlet) is responsible for identifying the
action form and populating it with data from the request, before calling the
perform() method on your actioin class. So you are correct that the code
from EditRegistrationAction will never execute (why is it there then???).
There is one case where the code would execute however, and that is the case
where the action mapping in your struts-config.xml doen't include a
actionForm name...in this case the controller servlet doesn't create the
acton form. I would suggest that you take a look at the source for the
AtionServlet to get a sense for how this works.

-Original Message-
From: Bryan Field-Elliot [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 04, 2001 11:25 PM
To: [EMAIL PROTECTED]
Subject: More about that "edit form" example...


Question about the following code in EditRegistrationAction:

   // Populate the user registration form
   if (form == null) {
   if (servlet.getDebug() >= 1)
   servlet.log(" Creating new RegistrationForm bean under key "
   + mapping.getAttribute());
   form = new RegistrationForm();
   if ("request".equals(mapping.getScope()))
   request.setAttribute(mapping.getAttribute(), form);
   else
   session.setAttribute(mapping.getAttribute(), form);
   }

Is this code ever really executed? My testing from my own app indicates 
that, even with the ActionMapping's "validate=false", and even with a 
link directly to the action without any form submission, STILL, there is 
a construction of an empty ActionForm, and it is passed to the 
process()'s "form" parameter. So the above code doesn't look like it 
ever executes. Am I off base here?

Thanks,
Bryan



Re: using titles from an application resource file in my templates

2001-03-27 Thread Troy Hart

This doesn't work. In the case you show below, the title ends up being:

  "   "

Troy

> Luckly someone answered this last week: 
> 
>  
>   
>   
> 
> 
> Troy Hart wrote:
>> 
>> I am using struts-template.tld and I want to be able to use my
application
>> resources to get the correct title for any given page. I thought I had
seen
>> this talked about somewhere but I can't find it anyplace in the mail
>> archives. I'm sure people that use struts templates must be doing this,
but
>> I'm just not seeing how right now. It seems to me that I need a tag that
>> works similar to:
>> 
>> 
>> 
>> Except that it needs to expose a scripting variable with the value,
instead
>> of writing it to the output stream. Maybe the message tag could be
extended
>> to include an "id" parameter which, if set, stores the value in a page
>> scoped attribute with the given name... This way I could do something
like
>> this:
>> 
>> ...
>> 
>> 
>> ...
>> 
>> Maybe there is already a mechanism to cleanly accomplish this...any
>> pointers?
>> 
>> Thanks,
>> 
>> Troy



using titles from an application resource file in my templates

2001-03-23 Thread Troy Hart

I am using struts-template.tld and I want to be able to use my application
resources to get the correct title for any given page. I thought I had seen
this talked about somewhere but I can't find it anyplace in the mail
archives. I'm sure people that use struts templates must be doing this, but
I'm just not seeing how right now. It seems to me that I need a tag that
works similar to:



Except that it needs to expose a scripting variable with the value, instead
of writing it to the output stream. Maybe the message tag could be extended
to include an "id" parameter which, if set, stores the value in a page
scoped attribute with the given name... This way I could do something like
this:

...


...

Maybe there is already a mechanism to cleanly accomplish this...any
pointers?


Thanks,

Troy




RE: strange html:form tag

2001-03-20 Thread Troy Hart

OK, so let me see if I understand what you are saying:

the tag  will trigger FormTag.doStartTag(),
which will append ".do" if no extension was specified. I guess it looks
first to see if if extension mapping is being used vs. path (???) mapping?

Maybe I should go review the tag's java source... :)

Thanks,

Troy

-Original Message-
From: Rob Leland [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 9:36 AM
To: [EMAIL PROTECTED]
Subject: Re: strange html:form tag


Then struts html:form tag is processed
if the action name does not have
a .do at the end, one will be appended so when
it is sent out to the browser it will
always see a 'XXX.do' present.

Troy Hart wrote:
>
> What does that mean? How do you set up your servlet mapping in web.xml
then?
>
> -Original Message-
> From: Rob Leland [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 20, 2001 6:39 AM
> To: [EMAIL PROTECTED]
> Subject: Re: strange html:form tag
>
> Yuan Jun wrote:
> >
> > i download jakarta-struts-1.0-b1 today and found next in
registration.jsp
> >
> > 
> > 
> > 
> >
> > should it be:
> > 
>
> Either would be correct.
>
> The '.do' has been optional since the last week
> in January, maybe before.
>
> > or i've missed something?
> >
> > John.
>
> -Rob




RE: strange html:form tag

2001-03-20 Thread Troy Hart

What does that mean? How do you set up your servlet mapping in web.xml then?

-Original Message-
From: Rob Leland [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 6:39 AM
To: [EMAIL PROTECTED]
Subject: Re: strange html:form tag




Yuan Jun wrote:
> 
> i download jakarta-struts-1.0-b1 today and found next in registration.jsp
> 
> 
> 
> 
> 
> should it be:
> 

Either would be correct.

The '.do' has been optional since the last week
in January, maybe before.

> or i've missed something?
> 
> John.

-Rob



RE: Performance of struts

2001-03-19 Thread Troy Hart

check orion out... (http://www.orionserver.com/)

-Original Message-
From: James Howe [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 3:16 PM
To: [EMAIL PROTECTED]
Subject: Re: Performance of struts


If Tomcat's performance is pretty awful, what are some JSP implementations
(commercial or otherwise) that are particularly good?

At 12:10 PM 3/19/2001 -0800, you wrote:

>Struts based apps (or any app that uses custom tags heavily) are going to
>be significantly impacted by the quality of the JSP implementation in your
>container.  Which version are you using?  (NOTE:  Tomcat's performance
>w.r.t. JSP pages is pretty awful, for example).
>
> > Thanks!
> > keith
> >
> >
> >
>
>Craig McClanahan

James W. Howe   mailto:[EMAIL PROTECTED]
Allen Creek Software, Inc.  pgpkey:
http://ic.net/~jwh/pgpkey.html
Ann Arbor, MI 48103




RE: struts-template tag library vs.

2001-03-19 Thread Troy Hart

The template custom actions (including "insert", "put", and "get") are
absolutely distinct from the JSP "include" action. I would recommend that
you review the code for the struts-template web application that comes with
struts1.0 beta 1. In a nutshell, the template allows you to define a single
template page that lays out a set of components by referencing the
components by name.

Let's say the following is the contents of a file called
"/somePageLayoutSetup.jsp":
---
<%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %>






---

Now then, here is the template, "/myTemplate.jsp":
---
<%@ taglib uri='/WEB-INF/tlds/struts-template.tld' prefix='template' %>










I can also put any static stuff that I desire directly on this layout
template...

---

This is obviously a simple example but it illustrates the point. Namely, you
have a page that references a layout template and "put"s named components
into a context such that the referenced template can "get" at them.
Obviously, the power here is that for any given page on your site you only
need to know what the components of the layout are, not how they are laid
out. When you want to change the way they are laid out you only need to
change the layout JSP (assuming components don't change). The mechanism that
is used by the  action is (as I understand) functionally
equivalent to, if not exactly the same as, that used by the  (when the named element was "put" with "direct='false'", which is
the default).

Like I said initially, a review of the "struts-template" web app. will clear
this up for you.

Good luck,

Troy


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Jim Newsham
Sent: Monday, March 19, 2001 12:59 PM
To: [EMAIL PROTECTED]
Subject: Re: struts-template tag library vs. 



Thank you for your reply, but this didn't really answer my question.  Let me
rephrase.  I am talking about , which is a dynamic templating
mechanism, as opposed to <%@ include %>, which is static.  As I understand
it:

 and  are both dynamic templating
mechanisms
-- they are re-evaluated at runtime whenever referenced.  They allow you to
create a template with placeholders for dynamic values which you will supply
at
runtime.  This is where they are similar.  What I'm interested in hearing is
how they differ.

I assume that struts-template offers some improvement over jsp:include,
otherwise it serves no purpose.  So my question is, what does
struts-template
offer as an improvement over jsp:include?  The answer may be as simple as
"it
provides a consistent and readable syntax", or it may be more substantial.

Thank you,

Jim Newsham


Robert Taylor wrote:

> Although it doesn't discuss struts template tag specifically, the J2EE
> BluePrint has a good section on the comparison of JSP includes and using
> templates. I believe it is in section 10.3 where it discuss the Sample
> Application: View.
> http://java.sun.com/j2ee/blueprints/sample_application/view/index.html
>
> HTH,
>
> Robert
>
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
> > Jim Newsham
> > Sent: Friday, March 16, 2001 9:20 PM
> > To: [EMAIL PROTECTED]
> > Subject: struts-template tag library vs. 
> >
> >
> >
> > Hi,
> >
> > What are the differences between using the struts template tag library
and
> > jsp's include action?  What are the advantages and trade-offs of each?
> >
> > Thanks,
> >
> > Jim Newsham
> >
> >
> >
> >
> >




RE: Please Help

2001-03-19 Thread Troy Hart

I have been prototyping an app using struts on my windows workstation for a
week now and have never had a problem.

Troy

-Original Message-
From: JOEL VOGT [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 17, 2001 4:48 AM
To: [EMAIL PROTECTED]
Subject: Re: Please Help


Okay,
After playing around a little, I am starting to get the impression that
struts and windows together isn't going to go. Is this neccessarily the
case? Anyone had problems and then worked it out?

Thanks again, Joel





RE: struts-template tag library vs.

2001-03-19 Thread Troy Hart

the biggest thing for me is that you limit the potential layout bugs, and
you make it possible to change the layout, site wide, with the editing of a
single file. The alternative (just using ) forces you to
replicate the layout framework (typically this includes a set of nested
tables where you set the header, footer, sidebar, and etc...) on every
single jsp page.

Troy


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of
Jim Newsham
Sent: Friday, March 16, 2001 7:20 PM
To: [EMAIL PROTECTED]
Subject: struts-template tag library vs. 



Hi,

What are the differences between using the struts template tag library and
jsp's include action?  What are the advantages and trade-offs of each?

Thanks,

Jim Newsham






RE: dynamically constructing non-jsp pages

2001-03-14 Thread Troy Hart

I don't know why you need the file to be a .js file (there is no rule that
says javascript must be defined in such a file). You can build a .jsp file
that dynamically defines a bunch of client side javascript, and then simply
include that file wherever you need it...

Alternatively you could also map *.js such that the JspServlet processes it,
but this seems arbitrarily complex.

Troy


-Original Message-
From: Martijn Spronk [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 14, 2001 10:13 AM
To: Troy Hart
Subject: RE: dynamically constructing non-jsp pages


I assume one way should be by configuring your servlet/JSP
engine. For example in Resin, jsp files are processed by the
JspServlet servlet because of the mapping:



I don't see why this wouldn't work for *.js.

Martijn.



Martijn Spronk
[EMAIL PROTECTED]
www.columbusgroup.com
604.801.5758 ext. 248
Vancouver + Toronto + Seattle


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: March 14, 2001 8:51 AM
To: [EMAIL PROTECTED]
Subject: dynamically constructing non-jsp pages




first, let me say that this is not necessarily struts-specific, but since
i'm
pretty much using struts exclusively these days, and this list generates so
much
more useful info than the sun jsp and servlet list, i decided to try here
first.

here's my situation, i would like query a database and load the results for
some
reference tables into .js files, where they can then be quickly accessed for
client side validation.  (not an ideal solution, i know, but it would take
me
along time to explain why we came to this decision.)  i realize i can do
this
the hard way by directly printing out the response in the servlet, but i'd
like
to avoid that if possible.  is there a way to dynamically load a page and
not
have it end with the .jsp suffix?

thanks,

ab




RE: Alternative Frameworks - continued

2001-03-13 Thread Troy Hart

While the push model has traditionally been encouraged with Turbine, you can
also use pull-MVC model without any major problems. Whether the push or the
pull model is right for you depends on the nature of your application.

The learning curve associated with Turbine is a little steeper, but it is
also more powerful than struts. For one, you are not limited to JSP for the
presentation. In fact, I would imagine most people that use Turbine don't
use JSP. There is a slick templating language called Velocity
(http://jakarta.apache.org/velocity), and I would imagine that more often
than not this is used in favor of JSP with Turbine.

I am currently on a project using Turbine/Velocity and it works very well.
In all fairness it was a pain in the ass to overcome some of the
shortcomings in the documentation, some of it was outright misleading.
However, you should be able to come up to speed in a good day, or at most a
few of days

Good luck!

Troy

-Original Message-
From: Eric Brown [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 2:33 PM
To: Troy Hart
Subject: RE: Alternative Frameworks - continued


My team did an evaluation of Turbine and struts three months ago and Turbine
has some advantages, but while we had trouble getting both Turbine and
struts to work, Turbine was impossible while struts was merely difficult. I
also think the pull-MVC model that struts uses is superior in the long-run
to Turbine's push model.

I'm happy to report that my team is actively developing with struts and that
we have overcome the difficulties most usually have to overcome when
learning struts (and likely any new framework).

Bellow is my original message with comparison data, etc.

-Original Message-
From: Eric Brown
Sent: Monday, December 11, 2000 10:46 PM
To: Turbine; [EMAIL PROTECTED]
Cc: Yogieric (E-mail)
Subject: App framework eval: Turbine and/or Struts - Push vs. Pull MVC

I'm looking for an application framework for future work at my company and
am considering Turbine, Stuts and a few others. (My company currently uses
IIS/ASP/SQL Server and will move to apache/Java app server, Tomcat first and
Resin later as performance dictates, and Oracle.) Turbine seems to have the
most features including Torque (DB abstraction) and a personalization engine
that are important to me. However, as the push versus pull MVC paradigms
(http://java.apache.org/turbine/pullmodel.html) recently discussed on the
Turbine list concluded, Turbine's preferred UI language, Velocity, is a push
model that does not allow me to develop tag-like APIs for my UI/HTML
designers the way struts does, a pull MVC model. I believe Turbine allows
raw JSP that would allow me to use Turbine AND struts where appropriate
although I'm not sure that's the best answer either.

Pri Issue   ASP JSP Enhydra Struts  Turbine
XML/XSL
1   Separate UI from business logic XXX X   XXX
X
1   Database abstraction layer  XXX XXX
1   Reliable, Stable and scaleable  XXX XXX XXX ?   ?
?
1   Growth path X   XX  XX  XXX XXX
XX
1   Error validation and reporting  ?   X?  ?
1   Error message separation?   ?   ?
1   Reasonably Fast XXX XXX ?   ?   ?
X?
2   Very Fast   XX  XX  ?   ?   ?
?
2   Personalization Engine  X
2   Source code availabilityX   X   XX  XXX
X
2   Longevity -- Been aroundXXX XX  XX  X   X
X
2   Code reusabilityXXX XXX XX
XX
2   Documentation   XXX XXX XX  X   X
XX
2   HTML form rich API  ?   X?  ?
2   Early compilation   XXX ?   ?
XX
2   Vendor Freedom  X   XXX XX  XXX XXX
XXX
2   MVC Pull model  ?   XXX ?
3   MVC Push model  ?   XXX
XX
3   Strict API enforcement  XXX XXX
XXX
3   API Extensibility   XXX XXX X
XX
3   Internationalization?   X?  X?
X
3   File Upload API ?   ?   X?

I've tried to note what I know exists in each framework. The legend is as
follows:
X - Feature exists
XX - Feature exists and is reasonably good
XXX - Feature exists and is great
? - Feature might exist, unsure
X? - Feature exists but quality is unknown

ASP - IIS, ChiliSoft, Perl::ASP
Straight JSP - See www.javasoft.com
Enhydra - See www.enhydra.org
Struts - See jakarta.apache.org
Turbine - See java.apache.org
XML/XSL - M$ Implements on ASP, Cocoon (java.apache.org), Resin
(www.c

RE: Alternative Frameworks

2001-03-13 Thread Troy Hart

Try turbine: http://jakarta.apache.org/turbine/.

-Original Message-
From: Perez, Bill [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 13, 2001 11:54 AM
To: Troy Hart
Subject: Alternative Frameworks


Does anyone know of some good JSP/Servlet MVC Frameworks besides Struts?