Re: File Download with multiple files. Design question

2010-11-21 Thread Paweł Wielgus
Hi Roger,
below is Off-Topic as for struts.

 That's what I'm doing, but the StreamResult requires an InputStream
 which forces the intermediate step of creating a temporary file

I'm not so sure, i haven't done it myself, but there were a discussion
here some time ago
pointing out that one can create some kind of sophisticated
MySpecialBufferedStream
that will do exactly what You want.
In short this stream would need to have access to single files
but creates zip stream on-the-fly.
Google creating zip stream on the fly  - there are some nice results.

Best greetings,
Paweł Wielgus.

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



Re: File Download with multiple files. Design question

2010-11-20 Thread Paweł Wielgus
Hi All,
read about streamResult (I assume You use struts2), and also there is
no need for next action in chain, user can simply check as many files
as he wants and click download what will call downloadAction that will
simply return zip file for download, after downoading user is still at
the same page.

Best greetings,
Pawel Wielgus.



2010/11/19 RogerV roger.var...@googlemail.com:



 Li Ying wrote:

 My suggestion:

 (1)I believe you can use ZipOutputStream to output the zipped data to
 the response OutputStream directly, instead of a temp file. So no temp
 file need to be created.


 Hmm, write to the response.outputStream directly from within my action? That
 would work I guess. Any examples of doing this in struts 2 and how to
 navigate to the next display after the download?

 In this instance the first option would be best as I don't need the temp
 file, it was my first solution to providing the StreamResult with an input
 stream that would download multiple files.

 Regards

 --
 View this message in context: 
 http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30258354.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



Re: File Download with multiple files. Design question

2010-11-20 Thread Li Ying
 Any examples of doing this in struts 2

You can get the HttpServletResponse by:
   ServletActionContext.getResponse()

And then, you can set the download file name, by:
   response.setHeader(Content-Disposition,
attachment; filename= + fileName);

And then, you can get the OutputStream, by:
  response.getOutputStream()

Finally, you can output zipped data to the OutputStream.



 how to navigate to the next display after the download?

I believe you can not navigate to the next page.
Because for one http request, the server side can send only one response.
If you want to download file and then show next page, it need 2 responses.
I think this is impossible mission for one http request.

If you send a file download response, then the browser will download
it, and don't refresh the page, which means the current displayed page
will remain.

If you really want to implement this, may be you need some client side
JavaScript to send a file download request first, and then send
another request to display the next page.

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



Re: File Download with multiple files. Design question

2010-11-20 Thread Roger Varley
On Sat, 2010-11-20 at 09:41 +0100, Paweł Wielgus wrote:
 Hi All,
 read about streamResult (I assume You use struts2), and also there is
 no need for next action in chain, user can simply check as many files
 as he wants and click download what will call downloadAction that will
 simply return zip file for download, after downoading user is still at
 the same page.
 
Hi Pawel

That's what I'm doing, but the StreamResult requires an InputStream
which forces the intermediate step of creating a temporary file and it's
the issue of how to clean up the temporary file (knowing when the
StreamResult has completed) that's causing the issue.

Li's suggestion of writing directly to the response.getOutputStream()
would work, but it means my action now has to know about the servlet api
and will be awkward to test.

A third alternative I was considering was something like;

public class DeleteOnCloseFileInputStream extends FileInputStream {

File file;

public DeleteOnCloseFileInputStream(File file) {
super(file);
this.file = file;
}
@Override
public void close() {
super.close();
file.delete();
}

}

and passing that to the StreamResult.

Regards


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



File Download with multiple files. Design question

2010-11-19 Thread RogerV

Hi

I have a requirement to present the user with a list of files stored on the
server, and then download the files selected to the user. If the user
selects a single file - no problem. However if the user selects multiple
files, then, unless anyone knows different, all the files have to be sent in
the single input stream read by the stream result. Therefore I create a
temporary file with File.createTempFile() and use the ZipOutputStream to zip
the files and then return an input stream over the temp file. This works
suprisingly well. However, the problem I've now got is, how to get rid of
the temp files I am creating on the server?

file.deleteOnExit() is no use because the server VM will (in theory) never
shutdown. Once the download is complete Struts automatically re-displays the
original selection screen and provided the user uses the applicatoin
supplied navigation to exit then I can delete the temp file, but if they
simply close the browser or use the browser back button to navigate away I'm
still left with the temp files sitting around. 

Creating the zipfile in memory is not an option as some of these can
potentially be huge if the user goes mad and selects everything in sight.

Is there someway of detecting/intercepting the fact that the Stream result
has completed before Struts gets on with deciding what .jsp to display next
so that I can safely clean up? Any other suggested approaches would be
welome.

Regards

-- 
View this message in context: 
http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30256036.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: File Download with multiple files. Design question

2010-11-19 Thread Rahul Mohan
Roger,

In my project, we implemented a FileManager for storing, retrieving and 
cleaning up files. On upload, the filemanager creates a temp file on disk 
and stores the file-URL in a map correlated with the session id. We also 
implemented a SessionListener which calls FileManager.deleteFiles()  with 
the session-id as a parameter whenever a session is invalidated.  Deleting 
file after finish of streaming might not be a good idea, since it is very 
common to download the same file multiple times.

- Rahul



From:
RogerV roger.var...@googlemail.com
To:
user@struts.apache.org
Date:
19-11-2010 15:14
Subject:
File Download with multiple files. Design question




Hi

I have a requirement to present the user with a list of files stored on 
the
server, and then download the files selected to the user. If the user
selects a single file - no problem. However if the user selects multiple
files, then, unless anyone knows different, all the files have to be sent 
in
the single input stream read by the stream result. Therefore I create a
temporary file with File.createTempFile() and use the ZipOutputStream to 
zip
the files and then return an input stream over the temp file. This works
suprisingly well. However, the problem I've now got is, how to get rid of
the temp files I am creating on the server?

file.deleteOnExit() is no use because the server VM will (in theory) never
shutdown. Once the download is complete Struts automatically re-displays 
the
original selection screen and provided the user uses the applicatoin
supplied navigation to exit then I can delete the temp file, but if they
simply close the browser or use the browser back button to navigate away 
I'm
still left with the temp files sitting around. 

Creating the zipfile in memory is not an option as some of these can
potentially be huge if the user goes mad and selects everything in sight.

Is there someway of detecting/intercepting the fact that the Stream result
has completed before Struts gets on with deciding what .jsp to display 
next
so that I can safely clean up? Any other suggested approaches would be
welome.

Regards

-- 
View this message in context: 
http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30256036.html

Sent from the Struts - User mailing list archive at Nabble.com.


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



=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you




Re: File Download with multiple files. Design question

2010-11-19 Thread Li Ying
My suggestion:

(1)I believe you can use ZipOutputStream to output the zipped data to
the response OutputStream directly, instead of a temp file. So no temp
file need to be created.

OR

(2)You can create a batch application, repeatedly run it with some
interval (use cron or something).
And in this batch app, you can check the timestamp of your temp files,
and delete them if they are old enough.

I think the first way is the best, because there is not any side effects.
But the second way is also valuable, because it can help you to clean
up your working folder when you really need temp files.



2010/11/19 RogerV roger.var...@googlemail.com:

 Hi

 I have a requirement to present the user with a list of files stored on the
 server, and then download the files selected to the user. If the user
 selects a single file - no problem. However if the user selects multiple
 files, then, unless anyone knows different, all the files have to be sent in
 the single input stream read by the stream result. Therefore I create a
 temporary file with File.createTempFile() and use the ZipOutputStream to zip
 the files and then return an input stream over the temp file. This works
 suprisingly well. However, the problem I've now got is, how to get rid of
 the temp files I am creating on the server?

 file.deleteOnExit() is no use because the server VM will (in theory) never
 shutdown. Once the download is complete Struts automatically re-displays the
 original selection screen and provided the user uses the applicatoin
 supplied navigation to exit then I can delete the temp file, but if they
 simply close the browser or use the browser back button to navigate away I'm
 still left with the temp files sitting around.

 Creating the zipfile in memory is not an option as some of these can
 potentially be huge if the user goes mad and selects everything in sight.

 Is there someway of detecting/intercepting the fact that the Stream result
 has completed before Struts gets on with deciding what .jsp to display next
 so that I can safely clean up? Any other suggested approaches would be
 welome.

 Regards

 --
 View this message in context: 
 http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30256036.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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



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



Re: File Download with multiple files. Design question

2010-11-19 Thread RogerV



Li Ying wrote:
 
 My suggestion:
 
 (1)I believe you can use ZipOutputStream to output the zipped data to
 the response OutputStream directly, instead of a temp file. So no temp
 file need to be created.
 

Hmm, write to the response.outputStream directly from within my action? That
would work I guess. Any examples of doing this in struts 2 and how to
navigate to the next display after the download?

In this instance the first option would be best as I don't need the temp
file, it was my first solution to providing the StreamResult with an input
stream that would download multiple files.

Regards

-- 
View this message in context: 
http://old.nabble.com/File-Download-with-multiple-files.-Design-question-tp30256036p30258354.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Design Question Global Properties

2009-06-01 Thread Richard Sayre
I have some global properties in my application that I need to access
from several of my JSP pages.

In my application I have a base action which all of my actions use.  I
was thinking of putting a getGlobalProperties method in that action
that return an instance of an Singleton that holds my properties.

My other thought was to use an interceptor plus a singleton to add the
properties to the stack.  I'm not sure if this is possible with an
interceptor.

I am looking for some feedback on these designs.  I am leaning towards
the base action + singleton to do this but I want to make sure I am
making a good decision here.

Thanks,

Rich

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



Re: Design Question

2009-01-07 Thread Musachy Barroso
Plugins are not that different than putting all those mappings,
classes, etc in the webapp. The limitations would be the same as the
S2 limitations (in theory at least).

musachy

On Tue, Jan 6, 2009 at 7:24 PM, Dan Daly dancd...@yahoo.com wrote:
 Hello,

 I am working on an application that needs different sets of functionality 
 based on where it is installed.  The Struts 2 plugin mechanism looks like a 
 perfect solution as it would all us to write sets of plugins that we could 
 install as needed.

 The upper bound on the number of plug-ins that might be shipped with any 
 single installation would be around 30-40.  Does this sound like a reasonable 
 or am I pushing the envelope on the use of plug-ins?

 Thanks,
 dan







-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Design Question

2009-01-06 Thread Dan Daly
Hello, 

I am working on an application that needs different sets of functionality based 
on where it is installed.  The Struts 2 plugin mechanism looks like a perfect 
solution as it would all us to write sets of plugins that we could install as 
needed.

The upper bound on the number of plug-ins that might be shipped with any single 
installation would be around 30-40.  Does this sound like a reasonable or am I 
pushing the envelope on the use of plug-ins?

Thanks,
dan



  

Re: Design Question

2009-01-06 Thread Wes Wannemacher
Perhaps take a look at the OSGi plugin as well... It's in beta, but
provides functionality such as deploying bundles of actions during
runtime. 

http://cwiki.apache.org/S2PLUGINS/osgi-plugin.html

-Wes

On Tue, 2009-01-06 at 16:24 -0800, Dan Daly wrote:
 Hello, 
 
 I am working on an application that needs different sets of functionality 
 based on where it is installed.  The Struts 2 plugin mechanism looks like a 
 perfect solution as it would all us to write sets of plugins that we could 
 install as needed.
 
 The upper bound on the number of plug-ins that might be shipped with any 
 single installation would be around 30-40.  Does this sound like a reasonable 
 or am I pushing the envelope on the use of plug-ins?
 
 Thanks,
 dan
 
 
 
   


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



Re: struts2 design question

2008-02-21 Thread Maxx
On Thu, Feb 21, 2008 at 2:03 AM, Jeromy Evans
[EMAIL PROTECTED] wrote:
  Just thought I'd mention that Dave followed this up for you in struts-dev:
  http://www.nabble.com/StrutsStatics...-td15595866.html

Just to let you know this link does not work (seems incomplete).

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



Re: struts2 design question

2008-02-21 Thread Jeromy Evans

Maxx wrote:

On Thu, Feb 21, 2008 at 2:03 AM, Jeromy Evans
[EMAIL PROTECTED] wrote:
  

 Just thought I'd mention that Dave followed this up for you in struts-dev:
 http://www.nabble.com/StrutsStatics...-td15595866.html



Just to let you know this link does not work (seems incomplete).
  


Works for me in FF and IE6 and from Thunderbird!  




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



Re: struts2 design question

2008-02-21 Thread Dave Newton
--- Jeromy Evans [EMAIL PROTECTED] wrote:
 Maxx wrote:
  On Thu, Feb 21, 2008 at 2:03 AM, Jeromy Evans
  [EMAIL PROTECTED] wrote:
   http://www.nabble.com/StrutsStatics...-td15595866.html
  Just to let you know this link does not work (seems incomplete).
 Works for me in FF and IE6 and from Thunderbird!  

And Safari... As odd as it looks, that is the actual URL (mailing list
message subject plus a message ID).

Dave

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



Re: struts2 design question

2008-02-21 Thread Maxx
Strangely it first freezes my browser. Re-testing it now and it's working.
I also thought the three dots could come from a shortened url, while
it's effectively not.
Apologies.

Maxx

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



Re: struts2 design question

2008-02-21 Thread eric . jung
I wouldn't have seen that. Thanks, Jeromy. It's disturbing to see this 
kind of code in 2008 and makes me wonder what other antipatterns might 
exist in the struts2 codebase.





Dave Newton wrote:
 --- [EMAIL PROTECTED] wrote:
 
 I'm curious why the developers of struts2 chose to define constants in 
an 
 interface (StrutsStatics) and then implement that interface in at least 
18 
 classes
 
Just thought I'd mention that Dave followed this up for you in struts-dev:
http://www.nabble.com/StrutsStatics...-td15595866.html

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



*** IMPORTANT
NOTE* The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman  Co., its
subsidiaries and affiliates (BBH). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.


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



Re: struts2 design question

2008-02-21 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 I wouldn't have seen that. Thanks, Jeromy. It's disturbing to see this 
 kind of code in 2008 and makes me wonder what other antipatterns might 
 exist in the struts2 codebase.

Funny; I was thinking the same thing about the static context stuff in JSF
that makes it really difficult to test in isolation. Makes me wonder what
other antipatterns exist in the JSF codebase. If only there was a perfectly
refactored, up-to-date, everything-done-as-it-should-be framework.

Dave


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



Re: struts2 design question

2008-02-21 Thread Musachy Barroso
I am confused here. You do know that you don't need to
extend/implement any class/interface right? Or I am missing the whole
point.

musachy

On Thu, Feb 21, 2008 at 11:39 AM,  [EMAIL PROTECTED] wrote:
 Funny; I was thinking the same thing about the static context stuff in
  JSF
  that makes it really difficult to test in isolation.

  What makes you think that's difficult? I'm sure you're aware of mock
  objects. There are a number of mock JSF test frameworks---JMock and Shale
  come to mind. Writing actions and beans that extend or inherit MVC
  classes/interfaces are worse than static context stuff because:

  1. Java doesn't have multiple inheritance so if you want to make your own
  base classes, you're forced to create an inheritance chain tied to the MVC
  framework

  2. Swapping out frameworks is next to impossible.

  3. Classes can't stand on their own.

  4. It's easier for Java beginners to mix business logic with MVC framework
  code.

  We've been down this road before with struts1. Spring-MVC brought us the
  next generation of thinking by making all framework dependencies
  interfaces (implementations are provided but not required, like struts2).
  JSF takes this idea to its logical conclusion.

  If your action and bean methods only refer to a framework context (which,
  by the way, *is* injectable with Seam or with your own VariableResolver,
  contrary to your statement in a previous post. For example,
  http://www.jboss.com/index.html?module=bbop=viewtopicp=3977385), you can
  write them to support multiple frameworks simultaneously. In practice, no
  one does this, but it demonstrates the flexibility of the JSF approach. I
  can, for example, write an action class that works with both Struts2 and
  JSF:

  public class CreateCustomerAction extends ActionSupport /* ActionSupport
  req'd by struts2 */ {
   ...
   ...

   /** Stuts2 action */
   public String execute() throws Exception {
   if (!customerDAO.create(...))
 addActionError(Unable to create customer);
   return INPUT;
   }

   /** JSF action */
   public String createCustomer() {
 if (!customerDAO.create(...))
   FacesContext.getCurrentInstance().addMessage(someId, Unable to
  create customer);
 return input;
   }
  }

  If JSF required the extension of a framework class or implementation of a
  framework interface like struts2 does, the code above couldn't be written
  without a mixin/delegation (esp. if the interfaces shared the same method
  names like execute()). I hope you can see how JSF has a lighter footprint
  than struts2.




  *** IMPORTANT
  NOTE* The opinions expressed in this
  message and/or any attachments are those of the author and not
  necessarily those of Brown Brothers Harriman  Co., its
  subsidiaries and affiliates (BBH). There is no guarantee that
  this message is either private or confidential, and it may have
  been altered by unauthorized sources without your or our knowledge.
  Nothing in the message is capable or intended to create any legally
  binding obligations on either party and it is not intended to
  provide legal advice. BBH accepts no responsibility for loss or
  damage from its use, including damage from virus.
  

  -


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





-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



[OT] Re: struts2 design question

2008-02-21 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 3. Classes can't stand on their own.

Neither can a class that's using a static method.

 4. It's easier for Java beginners to mix business logic with 
 MVC framework code.

Easier? Like... typing is actually easier with S2?

Never mind, I don't get that one, and this isn't the forum to discuss it.

 If your action and bean methods only refer to a framework context (which, 
 by the way, *is* injectable with Seam

Another dependency.

  or with your own VariableResolver, 

Isn't that a JEE dependency?

 I hope you can see how JSF has a lighter footprint 
 than struts2.

I hope you can understand that reasonable people can disagree.

Dave


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



Re: struts2 design question

2008-02-21 Thread Dave Newton
--- Musachy Barroso [EMAIL PROTECTED] wrote:
 I am confused here. You do know that you don't need to
 extend/implement any class/interface right? Or I am missing the whole
 point.

The original issue was regarding error messages and how they're stored in the
action rather than in a thread/instance variable referenced through a static
class.

Dave


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



Re: struts2 design question

2008-02-21 Thread eric . jung
Funny; I was thinking the same thing about the static context stuff in 
JSF
that makes it really difficult to test in isolation.

What makes you think that's difficult? I'm sure you're aware of mock 
objects. There are a number of mock JSF test frameworks---JMock and Shale 
come to mind. Writing actions and beans that extend or inherit MVC 
classes/interfaces are worse than static context stuff because:

1. Java doesn't have multiple inheritance so if you want to make your own 
base classes, you're forced to create an inheritance chain tied to the MVC 
framework

2. Swapping out frameworks is next to impossible.

3. Classes can't stand on their own.

4. It's easier for Java beginners to mix business logic with MVC framework 
code.

We've been down this road before with struts1. Spring-MVC brought us the 
next generation of thinking by making all framework dependencies 
interfaces (implementations are provided but not required, like struts2). 
JSF takes this idea to its logical conclusion.

If your action and bean methods only refer to a framework context (which, 
by the way, *is* injectable with Seam or with your own VariableResolver, 
contrary to your statement in a previous post. For example, 
http://www.jboss.com/index.html?module=bbop=viewtopicp=3977385), you can 
write them to support multiple frameworks simultaneously. In practice, no 
one does this, but it demonstrates the flexibility of the JSF approach. I 
can, for example, write an action class that works with both Struts2 and 
JSF:

public class CreateCustomerAction extends ActionSupport /* ActionSupport 
req'd by struts2 */ {
  ...
  ...

  /** Stuts2 action */
  public String execute() throws Exception {
  if (!customerDAO.create(...))
addActionError(Unable to create customer);
  return INPUT;
  }

  /** JSF action */
  public String createCustomer() {
if (!customerDAO.create(...))
  FacesContext.getCurrentInstance().addMessage(someId, Unable to 
create customer);
return input;
  }
}

If JSF required the extension of a framework class or implementation of a 
framework interface like struts2 does, the code above couldn't be written 
without a mixin/delegation (esp. if the interfaces shared the same method 
names like execute()). I hope you can see how JSF has a lighter footprint 
than struts2.



*** IMPORTANT
NOTE* The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman  Co., its
subsidiaries and affiliates (BBH). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.


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



Re: struts2 design question

2008-02-21 Thread Jeromy Evans

[EMAIL PROTECTED] wrote:
I wouldn't have seen that. Thanks, Jeromy. It's disturbing to see this 
kind of code in 2008 and makes me wonder what other antipatterns might 
exist in the struts2 codebase.



  
Actually I only linked to that discussion to show that Dave had been 
courteous enough to follow it up for you.
From a design perspective I think it's a negligible issue that people 
are opinionated about because it's rather easy to understand.


Put First things First

Incidentally, the most significant antipattern present in Struts 2 that 
affects me is that of the Fragile Base Class. 
http://en.wikipedia.org/wiki/Fragile_base_class
It's caused by xwork actually and is evident because Struts 2 is used in 
scenarios that were probably not even conceived when the base classes 
were developed.


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



struts2 design question

2008-02-20 Thread eric . jung
Hi,

I'm curious why the developers of struts2 chose to define constants in an 
interface (StrutsStatics) and then implement that interface in at least 18 
classes (see 
http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/StrutsStatics.html).
 
Theinterface constant pattern has been out-of-favor since at least the 
publication of Joshua Bloch's landmark book, Effective Java in mid-2001 
(see item #17, pages 69-70).

This anti-pattern is repeated in the XWork code, too (example: 
http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/XWorkMessages.html),
 
and I'm wondering if it's systemic.

Can anyone comment on why this particular design decision was made?

Thank you.

*** IMPORTANT
NOTE* The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman  Co., its
subsidiaries and affiliates (BBH). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.


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



Re: struts2 design question

2008-02-20 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 I'm curious why the developers of struts2 chose to define constants in an 
 interface (StrutsStatics) and then implement that interface in at least 18 
 classes

It's likely you'd need to ask the original WebWork developers.

Item #17, Use interfaces only to define types, is on page 89 in my copy,
btw.

Dave


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



Re: struts2 design question

2008-02-20 Thread Jeromy Evans

Dave Newton wrote:

--- [EMAIL PROTECTED] wrote:
  
I'm curious why the developers of struts2 chose to define constants in an 
interface (StrutsStatics) and then implement that interface in at least 18 
classes


Just thought I'd mention that Dave followed this up for you in struts-dev:
http://www.nabble.com/StrutsStatics...-td15595866.html

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



Struts framework design question: Type Converters and Tags

2008-01-22 Thread jimski

I recently ran into an issue where I noticed that a custom type converter was
being called when parameters were being applied to a model object but not
when that model was being rendered out to a result via the s:select tag. 
The issue is probably summed up by Jasper Rosenberg's previous bug report
WW-2047 (https://issues.apache.org/struts/browse/WW-2047).  After reading
that report I have the following question/observation:

Since XWork's type conversion capabilities are among the best features of
the framework, why are they being subverted by hard-coding the tags so that
they only call toString, even in the presence of a custom type converter. 
The response in the Jira issue was to make sure toString returned what we
wanted.  The trouble with that is now the web framework is dictating how the
model classes are designed...  and wasn't getting away from that kind of
problem one of the major benefits of moving to s2?  The type converters are
there explicitly to provide flexibility to the framework so that the
framework designer's assumptions don't end up hamstringing the applications
being written on top of the framework.

Just how difficult would it be for the tags to look for a type converter
first (since the appropriate call in this circumstance would be returning a
string) and then fail back to toString if one was not found?  Wouldn't that
approach be more in keeping with the spirit of the framework?


-- 
View this message in context: 
http://www.nabble.com/Struts-framework-design-question%3A-Type-Converters-and-Tags-tp15019888p15019888.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Struts framework design question: Type Converters and Tags

2008-01-22 Thread Ted Husted
I'm not sure how difficult it would be to have the tags look for a
type converter first, but if you can come up with a working patch, I'd
be happy to review it.

HTH, Ted

On Jan 22, 2008 9:41 AM, jimski [EMAIL PROTECTED] wrote:

 I recently ran into an issue where I noticed that a custom type converter was
 being called when parameters were being applied to a model object but not
 when that model was being rendered out to a result via the s:select tag.
 The issue is probably summed up by Jasper Rosenberg's previous bug report
 WW-2047 (https://issues.apache.org/struts/browse/WW-2047).  After reading
 that report I have the following question/observation:

 Since XWork's type conversion capabilities are among the best features of
 the framework, why are they being subverted by hard-coding the tags so that
 they only call toString, even in the presence of a custom type converter.
 The response in the Jira issue was to make sure toString returned what we
 wanted.  The trouble with that is now the web framework is dictating how the
 model classes are designed...  and wasn't getting away from that kind of
 problem one of the major benefits of moving to s2?  The type converters are
 there explicitly to provide flexibility to the framework so that the
 framework designer's assumptions don't end up hamstringing the applications
 being written on top of the framework.

 Just how difficult would it be for the tags to look for a type converter
 first (since the appropriate call in this circumstance would be returning a
 string) and then fail back to toString if one was not found?  Wouldn't that
 approach be more in keeping with the spirit of the framework?

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



S2 Design Question

2007-06-20 Thread stanlick

I have discovered an optimized (very little code) solution to CRUD using
S2.  My next question has to do with CRUD across a 1:M domain model.  I have
the Preparable and ModelDriven technique working nicely with the id (PK)
being set in the BaseAction class.  What I would like to work through next
is how to link a parent with children where the children make up an entirely
new CRUD.

Ideas?

--
Scott
[EMAIL PROTECTED]


jsp page/actions design question

2006-11-13 Thread fea jabi

Using struts. Have a JSP cust.jsp

In it half of it is very specific to that page only. other half is shown in 
this cust.jsp and another report.jsp too.


want to implement this so that code can be re-used in the other one too.

The way I have designed is for a jsp have a prepare action and dispatch 
action.



But not sure how to design this page so that I can re-use the code in 
another too.


any suggesions are appreciated.

Thanks.

_
Get today's hot entertainment gossip  
http://movies.msn.com/movies/hotgossip?icid=T002MSN03A07001



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



Re: jsp page/actions design question

2006-11-13 Thread Lixin Chu

you can use %@ include file=... % to include the common JSP.


On 11/14/06, fea jabi [EMAIL PROTECTED] wrote:


Using struts. Have a JSP cust.jsp

In it half of it is very specific to that page only. other half is shown
in
this cust.jsp and another report.jsp too.

want to implement this so that code can be re-used in the other one too.

The way I have designed is for a jsp have a prepare action and dispatch
action.


But not sure how to design this page so that I can re-use the code in
another too.

any suggesions are appreciated.

Thanks.

_
Get today's hot entertainment gossip
http://movies.msn.com/movies/hotgossip?icid=T002MSN03A07001


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




Re: jsp page/actions design question

2006-11-13 Thread Chris Pratt

I'd look at either JSP Include or Tiles.
 (*Chris*)

On 11/13/06, fea jabi [EMAIL PROTECTED] wrote:


Using struts. Have a JSP cust.jsp

In it half of it is very specific to that page only. other half is shown
in
this cust.jsp and another report.jsp too.

want to implement this so that code can be re-used in the other one too.

The way I have designed is for a jsp have a prepare action and dispatch
action.


But not sure how to design this page so that I can re-use the code in
another too.

any suggesions are appreciated.

Thanks.

_
Get today's hot entertainment gossip
http://movies.msn.com/movies/hotgossip?icid=T002MSN03A07001


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




Re: Struts form design question

2006-08-01 Thread Antonio Petrelli

Adam Gordon ha scritto:

We have a table which we populate with a user's choice of custom
registration fields (name, email, phone, company, etc...).


Probably this can help you:
http://struts.apache.org/1.x/userGuide/building_controller.html
Go to section: 4.3.3 Map-backed ActionForms (Adam, thank Frank W. 
Zammetti for this!)



Each row in this
table is essentially a button to remove the row, a text field to enter the
name of the field, and a checkbox to indicate whether or not that particular
field is required when a user registers.  At the bottom of the table is an
Add Field button which will insert a new row in the table. 
  


What do you mean with row here? Are there more that one user 
displayed, like a data grid?


Ciao
Antonio


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



RE: Struts form design question

2006-08-01 Thread Lance
I do this using 3 actions

loadAction - called first time the page is loaded, populates the form with
values from the db, the form has session scope.

editAction - called by a click on the add or delete button, adds or removes
a row from the form. Add and delete buttons should post to this action so
that any field changes will be picked up.

saveAction - commits the form to the db, called by a save button.

This means that clicking on add and save requires a page refresh but it
means struts will read input fields into your form automatically. Im sure
you could go the ajax way and add / delete from your ActionForm without
re-loading the page.

-Original Message-
From: Adam Gordon [mailto:[EMAIL PROTECTED] 
Sent: 31 July 2006 21:02
To: Struts Users Mailing List
Subject: Struts form design question

Hi folks.

The more I think of this problem, the more I think that we will be unable to
use only Struts for this particular situation.

We have a table which we populate with a user's choice of custom
registration fields (name, email, phone, company, etc...).  Each row in this
table is essentially a button to remove the row, a text field to enter the
name of the field, and a checkbox to indicate whether or not that particular
field is required when a user registers.  At the bottom of the table is an
Add Field button which will insert a new row in the table. 

Right now, the Add Field and Remove Row buttons are implemented in
JavaScript because we don't want to edit the database every time the user
makes a change.  Additionally, we want the ability to reset the table back
to what the user had originally (the user's defaults can change over time,
and since they come from the database, this is why we don't want live
editing).

Initially creating the table isn't the problem, we can use DynaForms to
correctly create the table, the problem is how/can we read the values (the
rows of textfield/checkbox items) back when the user is finished editing
using Struts?  I don't think we can use DynaForms because the user can
change what was originally rendered...or am I misunderstanding DynaForms?

Thanks.

-Adam




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



RE: Struts form design question

2006-08-01 Thread Adam Gordon
Antonio-

I'll check out that link after I send this.  We found a demo online
somewhere but it's from 2004, and doesn't appear to be working for us -
we're getting an NPE when struts is trying to render a property for a bean
in the array of bean objects - using the debugger, I can see that the fields
are not negative, so I'm not sure what's going on however, adding the value
attribute to the lt;html:inputgt; element, oddly enough, caused this error
to go away...

So, by row, I mean our table could look like this (make sure you are
using a fixed-width font):

--- SNIP ---

|---|
|   | Field Name   | Required   | 
|---| 
| [ Remove Button ] |Name  | [Checkbox] |
|---|
| [ Remove Button ] |Email | [Checkbox] |
|---|
| [ Remove Button ] |Phone | [Checkbox] |
|---|
| [ Remove Button ] |Company   | [Checkbox] |
|---|
| [ Add Field Button ]  |
|---|

  [ Preview ] [ Default ] [ Save ] -- More buttons

--- SNIP ---

So, to answer your question, don't worry about the concept of
users.

The [ Remove Button ] is the remove button for that row and the [Add
Field Button] inserts a new row in the table.  Right now these are both
done w/ JavaScript.  The table is initially populated via database
parameters but a user can customize the field names or get rid of some
entirely.  We don't want live-editing of the database meaning if the
user clicks Remove or Add, no contact w/ the server is done.  We want
this because if the user clicks Default, we want to reload the page
from the database with the user's current setup whereas if they click
save, we want to read the table and determine the new/changed/deleted
fields they've added/modified/removed.  It would be awesome if Struts
did this automatically on form submittal but I'm not sure it can.

Hope that was clear.  Thanks,

-Adam

-Original Message-
From: Antonio Petrelli [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 01 August 2006 04:04
To: Struts Users Mailing List
Subject: Re: Struts form design question

Adam Gordon ha scritto:
 We have a table which we populate with a user's choice of custom
 registration fields (name, email, phone, company, etc...).

Probably this can help you:
http://struts.apache.org/1.x/userGuide/building_controller.html
Go to section: 4.3.3 Map-backed ActionForms (Adam, thank Frank W. 
Zammetti for this!)

 Each row in this
 table is essentially a button to remove the row, a text field to enter the
 name of the field, and a checkbox to indicate whether or not that
particular
 field is required when a user registers.  At the bottom of the table is an
 Add Field button which will insert a new row in the table. 
   

What do you mean with row here? Are there more that one user 
displayed, like a data grid?

Ciao
Antonio


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


Re: Struts form design question

2006-08-01 Thread Adam Gordon

Lance-

That works as long as you can pre-populate your field before clicking 
the editAction button.  Recall that our Add Field button, via 
JavaScript, adds a new row to the table and by default the textfield is 
empty so the only way we would be able to retrieve the user's input 
would be to force them to click some sort of update button for that row 
after they enter some text in the text field - and I can tell you now, 
marketing will not go for that.  :-)


However, we can use the editAction to delete a row and just make an AJAX 
call to modify the bean array in session scope (using a DynaActionForm) 
on the server without modifying the database.


-adam

Lance wrote:

I do this using 3 actions

loadAction - called first time the page is loaded, populates the form with
values from the db, the form has session scope.

editAction - called by a click on the add or delete button, adds or removes
a row from the form. Add and delete buttons should post to this action so
that any field changes will be picked up.

saveAction - commits the form to the db, called by a save button.

This means that clicking on add and save requires a page refresh but it
means struts will read input fields into your form automatically. Im sure
you could go the ajax way and add / delete from your ActionForm without
re-loading the page.

-Original Message-
From: Adam Gordon [mailto:[EMAIL PROTECTED] 
Sent: 31 July 2006 21:02

To: Struts Users Mailing List
Subject: Struts form design question

Hi folks.

The more I think of this problem, the more I think that we will be unable to
use only Struts for this particular situation.

We have a table which we populate with a user's choice of custom
registration fields (name, email, phone, company, etc...).  Each row in this
table is essentially a button to remove the row, a text field to enter the
name of the field, and a checkbox to indicate whether or not that particular
field is required when a user registers.  At the bottom of the table is an
Add Field button which will insert a new row in the table. 


Right now, the Add Field and Remove Row buttons are implemented in
JavaScript because we don't want to edit the database every time the user
makes a change.  Additionally, we want the ability to reset the table back
to what the user had originally (the user's defaults can change over time,
and since they come from the database, this is why we don't want live
editing).

Initially creating the table isn't the problem, we can use DynaForms to
correctly create the table, the problem is how/can we read the values (the
rows of textfield/checkbox items) back when the user is finished editing
using Struts?  I don't think we can use DynaForms because the user can
change what was originally rendered...or am I misunderstanding DynaForms?

Thanks.

-Adam




-
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]



Struts form design question

2006-07-31 Thread Adam Gordon
Hi folks.

The more I think of this problem, the more I think that we will be unable to
use only Struts for this particular situation.

We have a table which we populate with a user's choice of custom
registration fields (name, email, phone, company, etc...).  Each row in this
table is essentially a button to remove the row, a text field to enter the
name of the field, and a checkbox to indicate whether or not that particular
field is required when a user registers.  At the bottom of the table is an
Add Field button which will insert a new row in the table. 

Right now, the Add Field and Remove Row buttons are implemented in
JavaScript because we don't want to edit the database every time the user
makes a change.  Additionally, we want the ability to reset the table back
to what the user had originally (the user's defaults can change over time,
and since they come from the database, this is why we don't want live
editing).

Initially creating the table isn't the problem, we can use DynaForms to
correctly create the table, the problem is how/can we read the values (the
rows of textfield/checkbox items) back when the user is finished editing
using Struts?  I don't think we can use DynaForms because the user can
change what was originally rendered...or am I misunderstanding DynaForms?

Thanks.

-Adam



Design question

2006-07-06 Thread fea jabi

have a table

in one of the columns have html:text. not all rows have the html:text.

need to validate the user entered values in the html:text using 
validator.xml.


Created an object.java file which holds the row data of the table.  Created 
a list of these row objects.


Not sure how to proceed now. should I put the List as a property in the 
form-bean?? if I did so how will the user edited html:text updated to the 
list so that I can do validations?


need help with this.

Thanks.

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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



Struts Design question

2006-06-21 Thread Kavita Mehta


Hi,
I have a form which has 3 submit buttons .
which is a gud ides ...
1) having seperate 3 action classes for each
2) having a single action class which manages the submit action based on 
the button which has called this action class.


Thanks,
Kavita




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



Re: Struts Design question

2006-06-21 Thread Scott Van Wart

Kavita Mehta wrote:


Hi,
I have a form which has 3 submit buttons .
which is a gud ides ...
1) having seperate 3 action classes for each
2) having a single action class which manages the submit action based 
on the button which has called this action class.
It's up to you ;).  I typically divide things into multiple actions (and 
possibly forms) when the form data is different.  So, if I had a 
record-editing page where you can:

1) Update the record you're currently editing.
2) Create a new record from the data you've entered.
3) Delete the record you're currently editing.

I'd have 2 actions, and 1 form:
/saveRecord (recordForm) - SaveRecordAction.execute
/deleteRecord (recordForm -- only uses the record key) - 
DeleteRecordAction.execute


You can inspect the button value returned to determine the button 
clicked in a single form.


Have fun,
 Scott

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



Re: Struts Design question

2006-06-21 Thread Monkeyden

If your implementation is similar to what Scott has mentioned (i.e.
different operations on the same type of object), then I consider this a
classic example of a DispatchAction, where type of business entity doesn't
change...just the selected operation on the business entity, thus it makes
sense to have it in the same action.

On 6/21/06, Scott Van Wart [EMAIL PROTECTED] wrote:


Kavita Mehta wrote:

 Hi,
 I have a form which has 3 submit buttons .
 which is a gud ides ...
 1) having seperate 3 action classes for each
 2) having a single action class which manages the submit action based
 on the button which has called this action class.
It's up to you ;).  I typically divide things into multiple actions (and
possibly forms) when the form data is different.  So, if I had a
record-editing page where you can:
1) Update the record you're currently editing.
2) Create a new record from the data you've entered.
3) Delete the record you're currently editing.

I'd have 2 actions, and 1 form:
/saveRecord (recordForm) - SaveRecordAction.execute
/deleteRecord (recordForm -- only uses the record key) -
DeleteRecordAction.execute

You can inspect the button value returned to determine the button
clicked in a single form.

Have fun,
Scott

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




Re: Struts Design question

2006-06-21 Thread Scott Van Wart

Monkeyden wrote:

If your implementation is similar to what Scott has mentioned (i.e.
different operations on the same type of object), then I consider this a
classic example of a DispatchAction, where type of business entity 
doesn't
change...just the selected operation on the business entity, thus it 
makes

sense to have it in the same action.
So I'm trying to figure this out myself.  I don't actually have multiple 
buttons in a single form, but I'd like to know the solution to this if I 
run across it in the future... so here's an example:


form-bean name=myForm class=mypkg.MyForm /

action path=/myAction type=mypkg.MyAction name=myForm 
scope=request validate=false parameter=action

 forward . /
/action

OK and then here's my form:

html:form action=/myForm

 input type=submit name=action value=Create
 input type=submit name=action value=Update

/html:form

Now... two things:
 - I used HTML because I can't find a way to get Struts to let me name 
the buttons with html:submit.
 - When the form is submitted, let's say the user clicked the Create 
button.  The action will end up with action=Create, which will hit my 
DispatchAction method's Create method.


Is this the right way of doing things?  It seems kind of weird, because 
now you can't do internationalization (buttons always have to be the 
same), and you're pretty restricted with what you can name your buttons 
and call your DispatchAction's methods.


Ideas?

- Scott


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



RE: Struts Design question

2006-06-21 Thread Givler, Eric
If you are using Struts 1.2.9, then lookup EventActionDispatcher.

-Original Message-
From: Scott Van Wart [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 21, 2006 1:39 PM
To: Struts Users Mailing List
Subject: Re: Struts Design question


Monkeyden wrote:
 If your implementation is similar to what Scott has mentioned (i.e.
 different operations on the same type of object), then I consider this a
 classic example of a DispatchAction, where type of business entity 
 doesn't
 change...just the selected operation on the business entity, thus it 
 makes
 sense to have it in the same action.
So I'm trying to figure this out myself.  I don't actually have multiple 
buttons in a single form, but I'd like to know the solution to this if I 
run across it in the future... so here's an example:

form-bean name=myForm class=mypkg.MyForm /

action path=/myAction type=mypkg.MyAction name=myForm 
scope=request validate=false parameter=action
  forward . /
/action

OK and then here's my form:

html:form action=/myForm

  input type=submit name=action value=Create
  input type=submit name=action value=Update

/html:form

Now... two things:
  - I used HTML because I can't find a way to get Struts to let me name 
the buttons with html:submit.
  - When the form is submitted, let's say the user clicked the Create 
button.  The action will end up with action=Create, which will hit my 
DispatchAction method's Create method.

Is this the right way of doing things?  It seems kind of weird, because 
now you can't do internationalization (buttons always have to be the 
same), and you're pretty restricted with what you can name your buttons 
and call your DispatchAction's methods.

Ideas?

- Scott


-
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: [shale] Design question involving ViewController

2006-06-19 Thread Craig McClanahan

On 6/17/06, Gary VanMatre [EMAIL PROTECTED] wrote:


From: Sean Schofield [EMAIL PROTECTED]

 I am writing an application that is using MyFaces tree2 to allow the
 user to navigate to a more detailed view of the item they click on. I
 just wanted some feedback on the following strategy:

 The node in the tree has an action method that puts the selected
 node's id into the request as a parameter. The String returned by the
 action method navigates you to a general detail page which is
 associated with a ViewController. The vc's init() method reads the
 node id out of the request and pulls the necessary info out of the
 data.

 Does this general approach make sense?


I think that's exactly what the extra callbacks on the view controller
should be used for.  You could use the setter injections stuff on a managed
bean to grab the values out of the request but without the view controller,
you wouldn't have a good hook for pre process or staging logic since the
view root doesn't have these kind of events.



While biulding a Shale-based prototype application recenty, I ran into a
gotcha with respect to the setter injection stuff when you don't actually
have a request parameter on the incoming request.  If you use #{param.foo}
as your managed property's value element, and there is no request
parameter named foo, the RI (at least) will throw an exception when trying
to do the value push.  (Didn't have time to confirm whether MyFaces acts the
same way).

One could argue that this is a usability issue that should be addressed even
if the spec is silent on the topic.  But, in the mean time, I'm doing
exactly what Sean describes (copy the request parameters in the init()
callback) to pull out these sorts of values.  Indeed, if you use the latest
sources (in the Maven-generated buld that we just switched to), I've added
the following convenience method to AbstractFacesBean (ancestor to
AbstractViewController) to make this kind of thing a bit simpler to code:

   public String getRequestParameter(String parameterName);



TIA,

 Sean

Gary



Craig


[shale] Design question involving ViewController

2006-06-17 Thread Sean Schofield

I am writing an application that is using MyFaces tree2 to allow the
user to navigate to a more detailed view of the item they click on.  I
just wanted some feedback on the following strategy:

The node in the tree has an action method that puts the selected
node's id into the request as a parameter.  The String returned by the
action method navigates you to a general detail page which is
associated with a ViewController.  The vc's init() method reads the
node id out of the request and pulls the necessary info out of the
data.

Does this general approach make sense?

TIA,

Sean

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



Re: [shale] Design question involving ViewController

2006-06-17 Thread Gary VanMatre
From: Sean Schofield [EMAIL PROTECTED] 

 I am writing an application that is using MyFaces tree2 to allow the 
 user to navigate to a more detailed view of the item they click on. I 
 just wanted some feedback on the following strategy: 
 
 The node in the tree has an action method that puts the selected 
 node's id into the request as a parameter. The String returned by the 
 action method navigates you to a general detail page which is 
 associated with a ViewController. The vc's init() method reads the 
 node id out of the request and pulls the necessary info out of the 
 data. 
 
 Does this general approach make sense? 


I think that's exactly what the extra callbacks on the view controller should 
be used for.  You could use the setter injections stuff on a managed bean to 
grab the values out of the request but without the view controller, you 
wouldn't have a good hook for pre process or staging logic since the view root 
doesn't have these kind of events.

 TIA, 
 
 Sean 

Gary

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

re: reŁş html:options collection design question

2006-05-10 Thread Stanislav
Hi!

That is fine if i want to set bgcolor to ALL text, but i want to set different 
bgcolor for different
choices in drop down menu.

Tnx,
Stanislav


- Original Message Follows -
 maybe css would be one solution, edit your css class, and use styleClass 
 attribute to ref it

   options ... ... styleClass=.mycssclass /

 Stanislav [EMAIL PROTECTED] Đ´ľŔŁş  Hi!

 I want to set background color in drop down menu that is generated with 
 html:options collection.
 Is there any way to do that?

 Here is code sample:





 Tnx,
 Stanislav

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




 -
  ŃĹť˘ĂâˇŃÓĘĎä-3.5GČÝÁżŁŹ20M¸˝źţ
  ŃĹť˘ÖúĘÖ-ËŃË÷Ą˘ÉąśžĄ˘ˇŔɧČĹ

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



re: re: re: html:options collection design question

2006-05-10 Thread Kyle Wu
I am not sure if there's better idea than writing your own JavaScript to do 
that..

Stanislav [EMAIL PROTECTED] :  Hi!

That is fine if i want to set bgcolor to ALL text, but i want to set different 
bgcolor for different
choices in drop down menu.

Tnx,
Stanislav


- Original Message Follows -
 maybe css would be one solution, edit your css class, and use styleClass 
 attribute to ref it

   

 Stanislav  写道:  Hi!

 I want to set background color in drop down menu that is generated with 
 html:options collection.
 Is there any way to do that?

 Here is code sample:





 Tnx,
 Stanislav

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




 -
  雅虎免费邮箱-3.5G容量,20M附件
  雅虎助手-搜索、杀毒、防骚扰

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




-
抢注雅虎免费邮箱-3.5G容量,20M附件! 

html:options collection design question

2006-05-09 Thread Stanislav
Hi!

I want to set background color in drop down menu that is generated with 
html:options collection. Is
there any way to do that?

Here is code sample:

html:select property=id styleClass=Podaci
html:options collection=hmUserList property=user-1-0 
labelProperty=user-2-0/
/html:select

Tnx,
Stanislav

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



re: html:options collection design question

2006-05-09 Thread Kyle Wu
maybe css would be one solution, edit your css class, and use styleClass 
attribute to ref it
  
  options ... ... styleClass=.mycssclass /

Stanislav [EMAIL PROTECTED] 写道:  Hi!

I want to set background color in drop down menu that is generated with 
html:options collection. Is
there any way to do that?

Here is code sample:





Tnx,
Stanislav

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




-
 雅虎免费邮箱-3.5G容量,20M附件
 雅虎助手-搜索、杀毒、防骚扰  

Struts Exception handling design question !

2006-03-03 Thread digant . k . joshi
Hi !

I want to find out what is best thing to do when it comes to 
Exception Handling?

I have my Application specific AppException I create many 
different sub-class of AppExceptions based on different conditions
in my application.
In struts config I am trying to put exception with All Action with 
AppException ( My base Application specific Exception )
 action
path=/sectorProcess
name=sectorForm
type=web.action.SectorAction
scope=request
parameter=dispatch
exception
key=SessionExpiredException
type=web.exception.AppException
path=/sessionExpired.jsp /

1.  In my DAO/DTO/Business layers should i keep on propagating 
exception upto Action class.
In my Action I have put try/catch for generic Exception, 
so all known exception including my AppException are caught and logged.
Struts frame work will redirect to AppException related 
jsp.
OR
2.  When ever exception happens in DAO/DTO/Business layers I 
catch it there Make my application specific Exception without 
propagating  to all the way upto Action  class because 
Struts frame work would redirect to AppExcpetion jsp based on 
struts-config.


Pls. advise !

Thanks.


This communication is for informational purposes only. It is not intended
as an offer or solicitation for the purchase or sale of any financial
instrument or as an official confirmation of any transaction. All market prices,
data and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein 
do not necessarily reflect those of JPMorgan Chase  Co., its subsidiaries 
and affiliates.

Re: error-page design question

2006-02-22 Thread Laurie Harper

Jay Burgess wrote:

Our app currently throws a custom UnavailableException from a couple of places
inside our Action handlers when the app is offline doing end-of-day
processing. We thought we had this situation covered from the UI perspective, as
we'd configured the following mapping in our web.xml:

error-page
exception-typeUnavailableException/exception-type
location/unavailable.jsp/location
/error-page

However, our end-of-day processing now shuts down our web server, which causes
the webapp to unload, and the unavailable.jsp to become inaccessible.  The
problem I've got is that if the user tries to access the webapp between the time
it has started unloading and the time the web server goes down, instead of our
unavailable.jsp, the user sees an ugly HTTP 500 error and a stack trace.

What I'd like to do, as it affects the smallest amount of code, is something
like the following:

error-page
exception-typeUnavailableException/exception-type
error-code503/error-code
/error-page

That is, if the container catches the UnavailableException, generate a standard
HTTP 503 error back to the browser.

Is something like this possible to do in web.xml? (I don't see it in the DTD.)
Or is my only option to catch the exception myself and do something like
HttpServletResponse.sendError(SC_SERVICE_UNAVAILABLE) in the code?


I think you're going to be out of luck there. The first thing the 
container does when asked to undeploy a web application is to stop 
forwarding requests to it... In other words, for the requests you're 
interested in, there is nowhere you can place a 'catch'.


You really need to either a) avoid shutting down the container, or b) 
use some type of load-balancing or other HA techniques to switch request 
processing to some temporary HTTP server before shutting down the 
container, so you can guarantee that all requests are served by a 
container that's in a consistent, live state.


L.


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



Re: error-page design question

2006-02-22 Thread [EMAIL PROTECTED]
Try looking at your web servers custom error pages. Once the container is
unavailable the web server is the only one that can process a request. Once
the server goes down you will need to go with Laurie's said (good advice for
any shop)

Bryan LaPlante

-- Original Message ---
From: Laurie Harper [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Wed, 22 Feb 2006 14:41:42 -0500
Subject: Re: error-page design question

 Jay Burgess wrote:
  Our app currently throws a custom UnavailableException from a couple of 
  places
  inside our Action handlers when the app is offline doing end-of-day
  processing. We thought we had this situation covered from the UI
perspective, as
  we'd configured the following mapping in our web.xml:
  
  error-page
  exception-typeUnavailableException/exception-type
  location/unavailable.jsp/location
  /error-page
  
  However, our end-of-day processing now shuts down our web server, which 
  causes
  the webapp to unload, and the unavailable.jsp to become inaccessible.  The
  problem I've got is that if the user tries to access the webapp between
the time
  it has started unloading and the time the web server goes down, instead of 
  our
  unavailable.jsp, the user sees an ugly HTTP 500 error and a stack trace.
  
  What I'd like to do, as it affects the smallest amount of code, is something
  like the following:
  
  error-page
  exception-typeUnavailableException/exception-type
  error-code503/error-code
  /error-page
  
  That is, if the container catches the UnavailableException, generate a
standard
  HTTP 503 error back to the browser.
  
  Is something like this possible to do in web.xml? (I don't see it in the 
  DTD.)
  Or is my only option to catch the exception myself and do something like
  HttpServletResponse.sendError(SC_SERVICE_UNAVAILABLE) in the code?
 
 I think you're going to be out of luck there. The first thing the 
 container does when asked to undeploy a web application is to stop 
 forwarding requests to it... In other words, for the requests you're 
 interested in, there is nowhere you can place a 'catch'.
 
 You really need to either a) avoid shutting down the container, or b) 
 use some type of load-balancing or other HA techniques to switch request 
 processing to some temporary HTTP server before shutting down the 
 container, so you can guarantee that all requests are served by a 
 container that's in a consistent, live state.
 
 L.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
--- End of Original Message ---

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



error-page design question

2006-02-21 Thread Jay Burgess
Our app currently throws a custom UnavailableException from a couple of places
inside our Action handlers when the app is offline doing end-of-day
processing. We thought we had this situation covered from the UI perspective, as
we'd configured the following mapping in our web.xml:

error-page
exception-typeUnavailableException/exception-type
location/unavailable.jsp/location
/error-page

However, our end-of-day processing now shuts down our web server, which causes
the webapp to unload, and the unavailable.jsp to become inaccessible.  The
problem I've got is that if the user tries to access the webapp between the time
it has started unloading and the time the web server goes down, instead of our
unavailable.jsp, the user sees an ugly HTTP 500 error and a stack trace.

What I'd like to do, as it affects the smallest amount of code, is something
like the following:

error-page
exception-typeUnavailableException/exception-type
error-code503/error-code
/error-page

That is, if the container catches the UnavailableException, generate a standard
HTTP 503 error back to the browser.

Is something like this possible to do in web.xml? (I don't see it in the DTD.)
Or is my only option to catch the exception myself and do something like
HttpServletResponse.sendError(SC_SERVICE_UNAVAILABLE) in the code?

Thanks.

Jay

| Jay Burgess [Vertical Technology Group]
| http://www.vtgroup.com/



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



Re: Another struts design question

2006-02-15 Thread Mark Lowe
On 2/15/06, Lixin Chu [EMAIL PROTECTED] wrote:
 ok, I let page A or B pass a returnURL to page C who keeps it in the session
 scoped actionForm.

I think what's being suggested is storing a reference to the referer
in the session, and thus circumventing any potential issues with the
Referer header being removed in some mystorious way. Not scoping an
action form to session to achieve this..

My understanding of the suggestion is like replicating the history
object in client side javascript. Which does sound like a good
suggestion.

Another suggestion could be to pass the returnUrl as a parameter

input type=text name=returnUrl value=[EL or scriptlet to
getRequestURI()] /

String returnUrl = request.getParameter(retrunUrl);
returnUrl = returnUrl.replaceFirst(request.getContextPath(),);
return new ActionForward(returnUrl,true);

Mark


 On 2/15/06, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 
  Michael Jouravlev wrote:
   On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:
  
   In the action just look for some param like fromPage and key off of
   that for your return. (Of course a drawback is you'll need to remember
   to set this var on the pages that need it - of course there are ways
  you
   could simplify that even, if really necessary).
  
  
   Using session is much simpler ;-)
  
  
  This is one of those times I would agree :)
 
  My suggestion would be to have a base Action in which you set a session
  attribute to tell which page was server.  Actually, you would store two,
  the current and the previous.
 
  Here's my concern... let's say you have page A and page B, from which
  you can go to page C.  From page C you want to return to page A or B as
  appropriate.  You could do this a number of ways, but what if you are
  using the common paradigm of a setup Action for a screen, and then a
  collection of Actions which really can be though of as event handlers
  for a given screen (could be a DispatchAction just as well, that
  wouldn't change anything).
 
  If you want to go back to page A from page C, and you got to page C by
  maybe submitting a form, then the problem is that you got to page C via
  an event handler in essence.  But, when you return to page A, you really
  want the setup Action to fire again.  So, just recording the last
  request isn't sufficient.
 
  If you have a base Action that sets that session attribute, then you can
  have only your setup Actions extend that base class.  Then, when you
  want to return to the last page from any other page, you look up that
  value and you now know which SETUP Action you need to call.  More
  precisely, you would look at the second value in session (think of it as
  a stack) because every time a setup Action is called you really need to
  push a value on the stack so that the second value on the stack is truly
  the last page, not the current pages' setup Action.
 
  Does that make any sense to anyone but me?? :)
 
  Frank
   -
   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]
 
 



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



Re: Another struts design question

2006-02-15 Thread Frank W. Zammetti
On Wed, February 15, 2006 4:24 am, Mark Lowe said:
 My understanding of the suggestion is like replicating the history
 object in client side javascript. Which does sound like a good
 suggestion.

That's a good way to put it :)  The only difference is that you wouldn't
build up a whole history, although I suppose you could if you wanted a
breadcrumb-type thing.  Instead, always have a two-element history stack,
so to speak, probably as simple as two session attributes, something like
currentURI and previousURI.  When you hit an Action, you do:

previousURI = currentURI
currentURI = thisURI

And like I said, only do this from Actions you would want to return to,
i.e., setup Actions... don't do it for an Action that is the target of a
form submission for instance because most likely the forward from that
will (a) be to the same page (think of an add item to list kind of
function) or (b) be to a new page.  If it's (a), you wouldn't want to
change the values in session because they would be correct already and
would be made incorrect by changing them (because previousURI and
currentURI would become the same), and if it's (b) you would want to
change them so that the current page becomes the previousURI and the new
page is currentURI so that your history remains intact as expected.

Of course, you wouldn't have to do this as a custom Action, you could just
as easily have a helper function that you only call from the appropriate
Actions.  I'd probably do that myself, although then it isn't quite
automatic as it would be (seemingly) with a custom Action.  Also, this
implies that *everything* goes through an Action in your app, which is a
Struts best practice anyway.  If you ever jump directly to JSPs, your
history won't work as expected.

Frank

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



Re: Another struts design question

2006-02-15 Thread [EMAIL PROTECTED]

I'm liking Frank's idea about makeing a setup action super class which would 
store the url for the setup action.  I think that this identification of these 
setup actions would probably be important to a web application in other ways 
too.  It seems that these kind of actions frequently have other regional data 
objects that could be kept in scope for the length of time you are in that 
region.  If you had identified such regions, then one of the things you could 
do upon entering a region ( hitting a setup action ) would be too clear out all 
other stuff from session scope that had been related to the previous region.

Is it, however, possible that you could design you application to where all the 
mapped actions were setup actions?  I guess not.  Basically this is a 
question of whether we can introduce a hierachy into the actions?  Is this a 
bad thing?  Something that should already be handled?  




 --- On Tue 02/14, Frank W. Zammetti  [EMAIL PROTECTED]  wrote:
From: Frank W. Zammetti [mailto: [EMAIL PROTECTED]
To: user@struts.apache.org
Date: Tue, 14 Feb 2006 18:59:11 -0500
Subject: Re: Another struts design question

Michael Jouravlev wrote: On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:  
  In the action just look for some param like fromPage and key off of 
that for your return. (Of course a drawback is you'll need to remember to set 
this var on the pages that need it - of course there are ways you could 
simplify that even, if really necessary).  Using session is much 
simpler ;-)   This is one of those times I would agree :)My suggestion would 
be to have a base Action in which you set a session attribute to tell which 
page was server.  Actually, you would store two, the current and the 
previous.Here's my concern... let's say you have page A and page B, from which 
you can go to page C.  From page C you want to return to page A or B as 
appropriate.  You could do this a number of ways, but what if you are using the 
common paradigm of a setup Action for a screen, and then a collection of 
Actions which really can be though of as event handlers for a given screen 
(could be a DispatchAction just as well, that wouldn't change anything).If you 
want to go back to page A from page C, and you got to page C by maybe 
submitting a form, then the problem is that you got to page C via an event 
handler in essence.  But, when you return to page A, you really want the setup 
Action to fire again.  So, just recording the last request isn't sufficient.If 
you have a base Action that sets that session attribute, then you can have only 
your setup Actions extend that base class.  Then, when you want to return to 
the last page from any other page, you look up that value and you now know 
which SETUP Action you need to call.  More precisely, you would look at the 
second value in session (think of it as a stack) because every time a setup 
Action is called you really need to push a value on the stack so that the 
second value on the stack is truly the last page, not the current pages' setup 
Action.Does that make any sense to anyone but me?? :)Frank 
- To 
unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL 
PROTECTED]   
-To 
unsubscribe, e-mail: [EMAIL PROTECTED] additional commands, e-mail: [EMAIL 
PROTECTED]

___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



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



Re: Another struts design question

2006-02-15 Thread Frank W. Zammetti
On Wed, February 15, 2006 2:46 pm, [EMAIL PROTECTED] said:
 Is it, however, possible that you could design you application to where
 all the mapped actions were setup actions?  I guess not.  Basically this
 is a question of whether we can introduce a hierachy into the actions?  Is
 this a bad thing?  Something that should already be handled?

I guess the question to ask is what are the kinds of Actions... I don't
mean DispatchAction vs. Action vs. whateve else, but the *purpose* of the
Action.

I can only see:

* Setup Action, called when any page is first displayed
* Event Handler Action, called most usually in response to a form
submission.  There is really two sub-types to this, one where the
resultant forward returns you to the same page, and one where it brings
you to another page.

When you go to another page, the question is, do you forward directly to a
JSP (I'd bet most people do... I know I do that most often) or does it go
to another Action, which is the setup Action for the next page?  Some
people may refer to that as action chaining, but I don't think it is. 
If you always forward to another Action, instead of directly to JSPs, what
your rally doing is creating almost a prerender phase to the next page. 
You also are giving yourself the opportunity to have more information, not
to mention control, over what goes on.

In that way, I suppose you *could* create an app that was nothing but
setup actions... that would imply though that there are no events outside
page transitions... sounds a lot like a wizard to me :)  In other words,
you have something like:

Action A executes to set up page A...
Page A is shown...
For submitted to Action A1, forward to Action B...
Action B executes to set up Page B...
Page B is shown...
...and so on...

Nothing unusual there, except that no Action would ever return a forward
that points directly to a JSP, except a setup Action... Action A1 for
instance would return a forward that points to Action B's mapping.

Frank




  --- On Tue 02/14, Frank W. Zammetti  [EMAIL PROTECTED]  wrote:
 From: Frank W. Zammetti [mailto: [EMAIL PROTECTED]
 To: user@struts.apache.org
 Date: Tue, 14 Feb 2006 18:59:11 -0500
 Subject: Re: Another struts design question

 Michael Jouravlev wrote: On 2/14/06, Rick Reumann [EMAIL PROTECTED]
 wrote:In the action just look for some param like fromPage and
 key off of that for your return. (Of course a drawback is you'll need to
 remember to set this var on the pages that need it - of course there are
 ways you could simplify that even, if really necessary).  Using
 session is much simpler ;-)   This is one of those times I would agree
 :)My suggestion would be to have a base Action in which you set a session
 attribute to tell which page was server.  Actually, you would store two,
 the current and the previous.Here's my concern... let's say you have page
 A and page B, from which you can go to page C.  From page C you want to
 return to page A or B as appropriate.  You could do this a number of ways,
 but what if you are using the common paradigm of a setup Action for a
 screen, and then a collection of Actions which really can be though of as
 event handlers for a given screen
 (could be a DispatchAction just as well, that wouldn't change anything).If
 you want to go back to page A from page C, and you got to page C by maybe
 submitting a form, then the problem is that you got to page C via an event
 handler in essence.  But, when you return to page A, you really want the
 setup Action to fire again.  So, just recording the last request isn't
 sufficient.If you have a base Action that sets that session attribute,
 then you can have only your setup Actions extend that base class.  Then,
 when you want to return to the last page from any other page, you look up
 that value and you now know which SETUP Action you need to call.  More
 precisely, you would look at the second value in session (think of it as a
 stack) because every time a setup Action is called you really need to push
 a value on the stack so that the second value on the stack is truly the
 last page, not the current pages' setup Action.Does that make any sense to
 anyone but me?? :)Frank
 - To
 unsubscribe, e-mail: [EMAIL PROTECTED] For additional
 commands, e-mail: [EMAIL PROTECTED]
 -To
 unsubscribe, e-mail: [EMAIL PROTECTED] additional
 commands, e-mail: [EMAIL PROTECTED]

 ___
 Join Excite! - http://www.excite.com
 The most personalized portal on the Web!



 -
 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: Another struts design question

2006-02-15 Thread Michael Jouravlev
On 2/15/06, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 On Wed, February 15, 2006 2:46 pm, [EMAIL PROTECTED] said:
  Is it, however, possible that you could design you application to where
  all the mapped actions were setup actions?  I guess not.

Yes you can. In this case you need to somehow distinguish the
semantics of the request: do you want to render a page or do you want
to submit input data. The choices are:

* distinguish by request method (POST vs. GET). This is simple and it
works, but all your input must be done via POST. This is how it works
in .NET and it seems that the same approach is used in JSF. Hence the
term postback not getback ;-)

* distinguish by presence of a certain parameter in the request (event
parameter). This means, that all your input must be send along with
event name, therefore DispatchAction-type actions can be used very
effectively here, directing request to a method that corresponds to
event.

This kind of action would process both render requests and input
requests, for example:
http://struts.sourceforge.net/strutsdialogs/dialogaction.html This
concept seems a little complex for many people who got used to a pair
of setup/input actions, so I am currently revising my library to
employ MappingParameterDispatchAction
(http://issues.apache.org/bugzilla/show_bug.cgi?id=38343) This one is
worth checking out. I hope it makes into 1.3.1

  Basically this
  is a question of whether we can introduce a hierachy into the actions?  Is
  this a bad thing?  Something that should already be handled?

 I guess the question to ask is what are the kinds of Actions... I don't
 mean DispatchAction vs. Action vs. whateve else, but the *purpose* of the
 Action.

 I can only see:

 * Setup Action, called when any page is first displayed
 * Event Handler Action, called most usually in response to a form
 submission.  There is really two sub-types to this, one where the
 resultant forward returns you to the same page, and one where it brings
 you to another page.

 When you go to another page, the question is, do you forward directly to a
 JSP (I'd bet most people do... I know I do that most often) or does it go
 to another Action, which is the setup Action for the next page?

An action should *never* forward to a page that does not belong to
that action; this practice leads to a spaghetti code both in Java and
in config file.

 Some
 people may refer to that as action chaining, but I don't think it is.
 If you always forward to another Action, instead of directly to JSPs, what
 your rally doing is creating almost a prerender phase to the next page.

I would say slightly different: what you really doing is transferring
control to another web resource and you *do not care* which page will
be shown. To select and to setup a proper page is the task of the
resource you are forwarding to.

 You also are giving yourself the opportunity to have more information, not
 to mention control, over what goes on.

Exactly, and to break your spaghetti-mappings into separate
self-contained chunks.

 In that way, I suppose you *could* create an app that was nothing but
 setup actions... that would imply though that there are no events outside
 page transitions...

What do you mean? As I see it, every page (or a set of pages) belong
to a particular pair of setup action / input action (or to a single
dialog action). Setup action (I call it render action) renders a
page. When you click anywhere on this page or sumbit a form, event
goes to an input action that belongs to this web resource. Event does
not go outside! Only an action can transfer control to another action.

 Action A executes to set up page A...
 Page A is shown...
 For submitted to Action A1, forward to Action B...
 Action B executes to set up Page B...
 Page B is shown...
 ...and so on...

If A and A1 belong to the same resource, then I agree with that. I
would use redirect instead of forward simply to prevent double submit
issues. What if you refresh page B? Redirection between resources does
not imply that actionforms must be session-scoped ;-)

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



Re: Another struts design question

2006-02-15 Thread Frank W. Zammetti

Michael Jouravlev wrote:

An action should *never* forward to a page that does not belong to
that action; this practice leads to a spaghetti code both in Java and
in config file.


If you mean forward directly to a JSP, I agree.  If you meant something 
else, I'm not sure how you would ever get to another page :)



I would say slightly different: what you really doing is transferring
control to another web resource and you *do not care* which page will
be shown. To select and to setup a proper page is the task of the
resource you are forwarding to.


Yep, I think you meant what I said above :)  I agree.


In that way, I suppose you *could* create an app that was nothing but
setup actions... that would imply though that there are no events outside
page transitions...


What do you mean? As I see it, every page (or a set of pages) belong
to a particular pair of setup action / input action (or to a single
dialog action). Setup action (I call it render action) renders a
page. When you click anywhere on this page or sumbit a form, event
goes to an input action that belongs to this web resource. Event does
not go outside! Only an action can transfer control to another action.


I think we're saying the same things, just with some different 
terminology.  As I read back what I wrote, I realized even in the 
situation I was trying to outline, you would *still* have setup actions 
and event handler actions as I think of them... I think you would use 
the terms render action and input action.  Same idea though.



Action A executes to set up page A...
Page A is shown...
For submitted to Action A1, forward to Action B...
Action B executes to set up Page B...
Page B is shown...
...and so on...


If A and A1 belong to the same resource, then I agree with that. 


Yes, exactly.


I would use redirect instead of forward simply to prevent double submit
issues. What if you refresh page B? Redirection between resources does
not imply that actionforms must be session-scoped ;-)


No problem with that here, makes sense... always has, I know you've been 
preaching this for some time :)


Frank

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



Re: Another struts design question

2006-02-15 Thread Dakota Jack
Is there any actual verification that these remarks are true?  Could you
give us some links?

On 2/14/06, Michael Jouravlev [EMAIL PROTECTED] wrote:

 On 2/14/06, Mark Lowe [EMAIL PROTECTED] wrote:
  You could use the referer header to create an action forward based on
  that value.

 referer field is unreliable. Can fail depending on your mix or
 forwarding/redirecting/reloading a page. It is also often removed by
 proxies/firewalls. I would not recommend using referer field.

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




--
You can lead a horse to water but you cannot make it float on its back.
~Dakota Jack~


Another struts design question

2006-02-14 Thread Keith Sader
Greetings, I need to have an action return to a previous page
depending upon which page originally requested the common page.  Think
of it as a settings page that can be accessed from multiple places.

Like this:

Entry 1 --- Common Page Entry 2

How can I tell the common page action to return to the correct requestor page?

thanks,
--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader

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



Re: Another struts design question

2006-02-14 Thread Mark Lowe
You could use the referer header to create an action forward based on
that value.

String referer = request.getHeader(Referer);
URL url = new URL(referer);
String path = url.getPath();
String contextPath = request.getContextPath();
path = path.replaceFirst(contextPath,);

return new ActionForward(path,true);

You may have to append any parameters to the path, but i'm sure you
can work that out..

Mark

On 2/14/06, Keith Sader [EMAIL PROTECTED] wrote:
 Greetings, I need to have an action return to a previous page
 depending upon which page originally requested the common page.  Think
 of it as a settings page that can be accessed from multiple places.

 Like this:

 Entry 1 --- Common Page Entry 2

 How can I tell the common page action to return to the correct requestor page?

 thanks,
 --
 Keith Sader
 [EMAIL PROTECTED]
 http://www.saderfamily.org/roller/page/ksader

 -
 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: Another struts design question

2006-02-14 Thread Keith Sader
That could work, and it would scale to n input pages.

Thanks Mark!

On 2/14/06, Mark Lowe [EMAIL PROTECTED] wrote:
 You could use the referer header to create an action forward based on
 that value.

 String referer = request.getHeader(Referer);
 URL url = new URL(referer);
 String path = url.getPath();
 String contextPath = request.getContextPath();
 path = path.replaceFirst(contextPath,);

 return new ActionForward(path,true);

 You may have to append any parameters to the path, but i'm sure you
 can work that out..

--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader
http://www.jroller.com/page/certifieddanger

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



Re: Another struts design question

2006-02-14 Thread [EMAIL PROTECTED]

As long as you are arriving at the settings page via an action, can't you 
just call the getInputForward() -- the method that the validate stuff calls to 
return to the starting page if there were errors; this seems like it would 
easily work.  

If you aren't arriving at the settings page via an action, you can go ahead 
and route this through a ForwardAction -- this is suggested in several books.  
Probably for reasons such as this.

Hope this helps.  




 --- On Tue 02/14, Keith Sader  [EMAIL PROTECTED]  wrote:
From: Keith Sader [mailto: [EMAIL PROTECTED]
To: user@struts.apache.org
Date: Tue, 14 Feb 2006 08:04:15 -0600
Subject: Re: Another struts design question

That could work, and it would scale to n input pages.Thanks Mark!On 2/14/06, 
Mark Lowe [EMAIL PROTECTED] wrote: You could use the referer header to 
create an action forward based on that value. String referer = 
request.getHeader(Referer); URL url = new URL(referer); String path = 
url.getPath(); String contextPath = request.getContextPath(); path = 
path.replaceFirst(contextPath,); return new ActionForward(path,true); You 
may have to append any parameters to the path, but i'm sure you can work that 
out..--Keith [EMAIL 
PROTECTED]://www.saderfamily.org/roller/page/ksaderhttp://www.jroller.com/page/certifieddanger-To
 unsubscribe, e-mail: [EMAIL PROTECTED] additional commands, e-mail: [EMAIL 
PROTECTED]

___
Join Excite! - http://www.excite.com
The most personalized portal on the Web!



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



Re: Another struts design question

2006-02-14 Thread Dave Newton
[EMAIL PROTECTED] wrote:
 As long as you are arriving at the settings page via an action, can't you 
 just call the getInputForward() -- the method that the validate stuff calls 
 to return to the starting page if there were errors; this seems like it would 
 easily work.  

 If you aren't arriving at the settings page via an action, you can go ahead 
 and route this through a ForwardAction -- this is suggested in several books. 
  Probably for reasons such as this.
   
The OP wanted to know how to return to a previous page programatically.

I've only done this for security access (you do not have access to that
page so send them to login or denial page). In the past I've simply
added logic to my security filter to save the page in session and
redirect back to it after they've logged in. These days I guess you
could put that in a request processor or something.

Dave



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



Re: Another struts design question

2006-02-14 Thread Michael Jouravlev
On 2/14/06, Mark Lowe [EMAIL PROTECTED] wrote:
 You could use the referer header to create an action forward based on
 that value.

referer field is unreliable. Can fail depending on your mix or
forwarding/redirecting/reloading a page. It is also often removed by
proxies/firewalls. I would not recommend using referer field.

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



Re: Another struts design question

2006-02-14 Thread Mark Lowe
On 2/14/06, Michael Jouravlev [EMAIL PROTECTED] wrote:
 On 2/14/06, Mark Lowe [EMAIL PROTECTED] wrote:
  You could use the referer header to create an action forward based on
  that value.

 referer field is unreliable. Can fail depending on your mix or
 forwarding/redirecting/reloading a page. It is also often removed by
 proxies/firewalls. I would not recommend using referer field.

Fair enough, what do you suggest as an alternative? I've used this a
few times for forwarding back to the referer and found any huge
problems. I can see how if something removed the header that could
cause problems, but cant see what would be achieved by a firewall or
proxy messing around like this would achieve.

The only other suggestion i would make if this were an issue is use
separate action mappings for each point of entry..

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: Another struts design question

2006-02-14 Thread Rick Reumann

Mark Lowe wrote the following on 2/14/2006 2:32 PM:


The only other suggestion i would make if this were an issue is use
separate action mappings for each point of entry..


Actually that seems pretty clean to me. Even if he has a lot of points 
of entry it can't be that many. Or another option is to simply embed 
some param that gets passed when the Action is called and you can call 
different forwards based on that.  Simply define several forwards in the 
config...


action
path=/someAction
name=someForm
type=com.WhateverAction
scope=request
parameter=dispatch
forward name=fromFooPage path=/WEB-INF/jsp/someOtherPageA.jsp/
forward name=fromBarPage path=/WEB-INF/jsp/someOtherPageB.jsp/

Or they may even be global forwards.

In the action just look for some param like fromPage and key off of 
that for your return. (Of course a drawback is you'll need to remember 
to set this var on the pages that need it - of course there are ways you 
could simplify that even, if really necessary).




--
Rick

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



Re: Another struts design question

2006-02-14 Thread Michael Jouravlev
On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:
 In the action just look for some param like fromPage and key off of
 that for your return. (Of course a drawback is you'll need to remember
 to set this var on the pages that need it - of course there are ways you
 could simplify that even, if really necessary).

Using session is much simpler ;-)

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



Re: Another struts design question

2006-02-14 Thread Mark Lowe
On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:
 Mark Lowe wrote the following on 2/14/2006 2:32 PM:
 
  The only other suggestion i would make if this were an issue is use
  separate action mappings for each point of entry..

 Actually that seems pretty clean to me. Even if he has a lot of points
 of entry it can't be that many.

One occasion when i use the forward to referer was when i had a
basket/cart presented all over the place.. Rather than have a boring
old, go to basket page do some basket stuff, i wanted the user to be
able to maniuplate the cart with out going anywhere, on anypage.. I
guess there could be other ways, but sometimes you do have N amount of
entry points..

Or another option is to simply embed
 some param that gets passed when the Action is called and you can call
 different forwards based on that.  Simply define several forwards in the
 config...

 action
  path=/someAction
  name=someForm
  type=com.WhateverAction
  scope=request
  parameter=dispatch
 forward name=fromFooPage path=/WEB-INF/jsp/someOtherPageA.jsp/
 forward name=fromBarPage path=/WEB-INF/jsp/someOtherPageB.jsp/

 Or they may even be global forwards.

 In the action just look for some param like fromPage and key off of
 that for your return. (Of course a drawback is you'll need to remember
 to set this var on the pages that need it - of course there are ways you
 could simplify that even, if really necessary).



In the case of a few entry points I see how this could be okay.. But
if you've something thats present through out a load of pages, I'd
take my chances using the Referer header.

Mark


 --
 Rick

 -
 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: Another struts design question

2006-02-14 Thread Frank W. Zammetti

Michael Jouravlev wrote:

On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:
  

In the action just look for some param like fromPage and key off of
that for your return. (Of course a drawback is you'll need to remember
to set this var on the pages that need it - of course there are ways you
could simplify that even, if really necessary).



Using session is much simpler ;-)

  

This is one of those times I would agree :)

My suggestion would be to have a base Action in which you set a session 
attribute to tell which page was server.  Actually, you would store two, 
the current and the previous.


Here's my concern... let's say you have page A and page B, from which 
you can go to page C.  From page C you want to return to page A or B as 
appropriate.  You could do this a number of ways, but what if you are 
using the common paradigm of a setup Action for a screen, and then a 
collection of Actions which really can be though of as event handlers 
for a given screen (could be a DispatchAction just as well, that 
wouldn't change anything).


If you want to go back to page A from page C, and you got to page C by 
maybe submitting a form, then the problem is that you got to page C via 
an event handler in essence.  But, when you return to page A, you really 
want the setup Action to fire again.  So, just recording the last 
request isn't sufficient.


If you have a base Action that sets that session attribute, then you can 
have only your setup Actions extend that base class.  Then, when you 
want to return to the last page from any other page, you look up that 
value and you now know which SETUP Action you need to call.  More 
precisely, you would look at the second value in session (think of it as 
a stack) because every time a setup Action is called you really need to 
push a value on the stack so that the second value on the stack is truly 
the last page, not the current pages' setup Action.


Does that make any sense to anyone but me?? :)

Frank

-
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: Another struts design question

2006-02-14 Thread Lixin Chu
ok, I let page A or B pass a returnURL to page C who keeps it in the session
scoped actionForm.

On 2/15/06, Frank W. Zammetti [EMAIL PROTECTED] wrote:

 Michael Jouravlev wrote:
  On 2/14/06, Rick Reumann [EMAIL PROTECTED] wrote:
 
  In the action just look for some param like fromPage and key off of
  that for your return. (Of course a drawback is you'll need to remember
  to set this var on the pages that need it - of course there are ways
 you
  could simplify that even, if really necessary).
 
 
  Using session is much simpler ;-)
 
 
 This is one of those times I would agree :)

 My suggestion would be to have a base Action in which you set a session
 attribute to tell which page was server.  Actually, you would store two,
 the current and the previous.

 Here's my concern... let's say you have page A and page B, from which
 you can go to page C.  From page C you want to return to page A or B as
 appropriate.  You could do this a number of ways, but what if you are
 using the common paradigm of a setup Action for a screen, and then a
 collection of Actions which really can be though of as event handlers
 for a given screen (could be a DispatchAction just as well, that
 wouldn't change anything).

 If you want to go back to page A from page C, and you got to page C by
 maybe submitting a form, then the problem is that you got to page C via
 an event handler in essence.  But, when you return to page A, you really
 want the setup Action to fire again.  So, just recording the last
 request isn't sufficient.

 If you have a base Action that sets that session attribute, then you can
 have only your setup Actions extend that base class.  Then, when you
 want to return to the last page from any other page, you look up that
 value and you now know which SETUP Action you need to call.  More
 precisely, you would look at the second value in session (think of it as
 a stack) because every time a setup Action is called you really need to
 push a value on the stack so that the second value on the stack is truly
 the last page, not the current pages' setup Action.

 Does that make any sense to anyone but me?? :)

 Frank
  -
  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: design question

2006-01-31 Thread Myatluk Andrey
Hi!

From here:
http://displaytag.sourceforge.net/11/tut_sources.html

--- cut ---

From a db?

Displaytag will never support retrieving data from a db directly. Displaytag is 
here to help you in displaying data, not to retrieve them.

Anyway, there are a couple of easy methods to get records from a db and display 
them using displaytag:

--- cut ---

-Original Message-
From: fea jabi [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 30, 2006 7:29 PM
To: user@struts.apache.org
Subject: RE: design question

can anyone help me understand this? Thanks.


From: fea jabi [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: user@struts.apache.org
Subject: design question
Date: Fri, 27 Jan 2006 11:40:20 -0500

For all the tables in the JSP, I am using displaytag.


For each row in the table I created an Object.

I am creating instances of this Object and making a List which is getting 
displayed in the JSP.

I was told that instead of creating Object and creating instances, one can 
directly use the result set got from the DB and iterate thru it to fill the 
tables.

Which one is more efficient way to do? Is the second approach better? if so 
why?

Thanks.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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


_
Don▓t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/


-
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: [OT] Re: design question

2006-01-31 Thread fea jabi

you have mentioned that

You're going to have an object in memory no matter what

If we are using Resultset how/when is the Object getting created? I was 
under the impression that it will get the data directly from the DB.


what are these DTO, GC and IMO?

I do remember reading somewhere that if this approach is used then we'll be 
breaking the MVC architecture.


any reference links for this?

Thanks.



From: Dave Newton [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: [OT] Re: design question
Date: Mon, 30 Jan 2006 15:56:31 -0500

fea jabi wrote:
 But as I mentioned earliar I am creating an object which I am planning
 to instanciate for each row of data. When I told about this to my team
 they were concerned about the objects being in memory and advised to
 use the resultset directly. In the sessionbean probably we can create
 these rowobjects before it's sent to the webserver.
You're going to have an object in memory no matter what. In most cases
DB connections are a more limited resource than memory. Besides, once
the ResultSet is translated into a DTO, it is free for GC anyway, so
you've really only lost the conversion time, which is worth it IMO.

I think that using a POJO (or POJO+) for the DTO more than pays for the
conversion time with easier code, generally more robust code, etc.

Dave



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



_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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



Re: [OT] Re: design question

2006-01-31 Thread Dave Newton
fea jabi wrote:
 you have mentioned that

 You're going to have an object in memory no matter what

 If we are using Resultset how/when is the Object getting created? I
 was under the impression that it will get the data directly from the DB.
Uh... a ResultSet is an object.
 You're going to have an object in memory no matter what. In most cases
 DB connections are a more limited resource than memory. Besides, once
 the ResultSet is translated into a DTO, it is free for GC anyway, so
 you've really only lost the conversion time, which is worth it IMO.
 what are these DTO, GC and IMO?
Data Transfer Object, Garbage Collection, In My Opinion.
 I do remember reading somewhere that if this approach is used then
 we'll be breaking the MVC architecture.
 any reference links for this?
Nope. I'd bet Google could help you out here, though.

I'm not sure I'd say using a ResultSet directly breaks MVC... while I'm
not sure I'd call a ResultSet a real DTO, that aspect of it doesn't
relly enter into the MVC equation. MVC has more to do with separation of
responsibilities between the business model, presentation model, and how
control is delegated. (That was _not_ a good explanation.)

Dave



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



RE: design question

2006-01-30 Thread fea jabi

can anyone help me understand this? Thanks.



From: fea jabi [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: user@struts.apache.org
Subject: design question
Date: Fri, 27 Jan 2006 11:40:20 -0500

For all the tables in the JSP, I am using displaytag.


For each row in the table I created an Object.

I am creating instances of this Object and making a List which is getting 
displayed in the JSP.


I was told that instead of creating Object and creating instances, one can 
directly use the result set got from the DB and iterate thru it to fill the 
tables.


Which one is more efficient way to do? Is the second approach better? if so 
why?


Thanks.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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



[OT] Re: design question

2006-01-30 Thread Dave Newton
fea jabi wrote:
 can anyone help me understand this? 
Don't know.
 I am creating instances of this Object and making a List which is
 getting displayed in the JSP.

 I was told that instead of creating Object and creating instances,
 one can directly use the result set got from the DB and iterate thru
 it to fill the tables.

 Which one is more efficient way to do? Is the second approach better?
 if so why?
Efficiency-wise? Depends on where you want your efficiency. You can use
a ResultSet directly, but you must keep the statement (and connection?)
open while using it, which might lead to number-of-connection issues.

In general, I have pretty strong feelings against using raw ResultSets
despite the overhead of copying data... anything other than raw JDBC
will see the same behavior whether it's a full ORM or something as
simple as a RowSetDynaClass (from Jakarta BeanUtils).

Of course, I have no idea how you're currently interacting with the DB,
so it's hard to say.

Dave



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



RE: [OT] Re: design question

2006-01-30 Thread George.Dinwiddie
Dave Newton replied:
 In general, I have pretty strong feelings against using raw 
 ResultSets despite the overhead of copying data... anything 
 other than raw JDBC will see the same behavior whether it's a 
 full ORM or something as simple as a RowSetDynaClass (from 
 Jakarta BeanUtils).

Yeah, I agree.  I have pretty strong feeling against worrying about the
efficiency of object creation in the context of a http transaction and a
database transaction.  The in-memory data copy is the least of the
concerns.

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



RE: [OT] Re: design question

2006-01-30 Thread fea jabi

Thanks for your responses.

I am currently not interacting with DB. Will ofcourse be soon.

But as I mentioned earliar I am creating an object which I am planning to 
instanciate for each row of data. When I told about this to my team they 
were concerned about the objects being in memory and advised to use the 
resultset directly. In the sessionbean probably we can create these 
rowobjects before it's sent to the webserver.


from your advise using resultset is not a good idea. I was looking for these 
kind of answers.


Thanks again.



From: Dave Newton [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: Struts Users Mailing List user@struts.apache.org
Subject: [OT] Re: design question
Date: Mon, 30 Jan 2006 11:42:10 -0500

fea jabi wrote:
 can anyone help me understand this?
Don't know.
 I am creating instances of this Object and making a List which is
 getting displayed in the JSP.

 I was told that instead of creating Object and creating instances,
 one can directly use the result set got from the DB and iterate thru
 it to fill the tables.

 Which one is more efficient way to do? Is the second approach better?
 if so why?
Efficiency-wise? Depends on where you want your efficiency. You can use
a ResultSet directly, but you must keep the statement (and connection?)
open while using it, which might lead to number-of-connection issues.

In general, I have pretty strong feelings against using raw ResultSets
despite the overhead of copying data... anything other than raw JDBC
will see the same behavior whether it's a full ORM or something as
simple as a RowSetDynaClass (from Jakarta BeanUtils).

Of course, I have no idea how you're currently interacting with the DB,
so it's hard to say.

Dave



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



_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



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



design question

2006-01-27 Thread fea jabi

For all the tables in the JSP, I am using displaytag.


For each row in the table I created an Object.

I am creating instances of this Object and making a List which is getting 
displayed in the JSP.


I was told that instead of creating Object and creating instances, one can 
directly use the result set got from the DB and iterate thru it to fill the 
tables.


Which one is more efficient way to do? Is the second approach better? if so 
why?


Thanks.

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



ActionForm design question

2005-12-20 Thread Scott Vickery
I know this is a bit open-ended, but, here is goes.  I have a somewhat
complicated form.  It is the classic Order / OrderLine problem.  I have
an order, within it, there is 1 order lines.  The order lines are
arranged as a tree so that they can be grouped together by the user.
For each order line, there is a list of options that are different based
on what is being ordered.  I have all this populating via hibernate.
The orderlines and their list of options are stored as java.util.Map's.
I am displaying this information on a form directly from the hibernate
beans.  Now, it is time to allow the user to edit the information.  

 

I think that I should be populating a form bean from the hibernate bean
instead of using the hibernate bean directly.  Correct?  If so, what
should the bean look like?  The same as the hibernate bean?  Seems like
I am writing things down in 2 places.  Is there an easier way to do
this?  Should I be looking at DynaForms instead?

 

Thanks,

Scott

 

 

Virtual Systems International, Inc.
1400 Crescent Green / ste. 215
Cary, NC  27511

Phone:  (919) 319-0888
Fax: (919) 319-0884
[EMAIL PROTECTED]
www.virtual-systems.com http://www.virtual-systems.com/ 

 



Re: ActionForm design question

2005-12-20 Thread Laurie Harper

Scott Vickery wrote:

I know this is a bit open-ended, but, here is goes.  I have a somewhat
complicated form.  It is the classic Order / OrderLine problem.  I have
an order, within it, there is 1 order lines.  The order lines are
arranged as a tree so that they can be grouped together by the user.
For each order line, there is a list of options that are different based
on what is being ordered.  I have all this populating via hibernate.
The orderlines and their list of options are stored as java.util.Map's.
I am displaying this information on a form directly from the hibernate
beans.  Now, it is time to allow the user to edit the information.  


I think that I should be populating a form bean from the hibernate bean
instead of using the hibernate bean directly.  Correct?  If so, what
should the bean look like?  The same as the hibernate bean?  Seems like
I am writing things down in 2 places.  Is there an easier way to do
this?  Should I be looking at DynaForms instead?


There was a long thread on this kind of stuff a day or two ago. 
Basically, yes, you need a form bean that has String properties for each 
input datum. You may want to make it look similar to the hibernate bean, 
but there's no need to do so. The form bean is modeling the set of 
inputs from an HTML form, so as long as it provides a slot for each 
datum (input item) it can be structured however you want.


DynaForms are a way of setting up form beans without having to write any 
code -- i.e. they're a declarative way of constructing form beans. 
They're definitely worth a look. While you're at it, have a look at 
LazyDynaActionForm and the FormDef project for other tools you may find 
useful in this context.


L.


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



Re: Struts Design Question

2005-12-08 Thread Ted Husted
It sounds like WildCard mappings (since Struts 1.2) might help. You
would probably only need one set of mappings for any number of
catagories.

You would probably only need one ActionForm too. If some of the
categories don't use some of the properties, then they just travel
null. Just give the base form a different name (or extend it) to add
different validations.

If you are using DynaActionForms, and the categories share some
properties, in the upcoming Struts 1.3, you can use the new extend
attribute  to create a base DynaActionForm, and then add properties as
needed. To get a head start on Struts 1.3, see the nightly build.

For the server page, a popular technique would be to use a
DispatchAction and represent each product with its own dispatch
method. If the products share some fields, you could set a ActionForm
property to the dispatch method, and then use logic tags to include or
exclude fields for a particular product.

-- HTH, Ted.
http://www.husted.com/poe/

On 12/7/05, bill [EMAIL PROTECTED] wrote:
 A bit of a struts newbie here. I have an application with the following page
 flow:
 choose Product Category -- choose Product Model -- create/edit chosen model

 Currently we only have one ActionForm\JSP Edit Form, but we need to expand
 this to support different Product Categories. Each would be a differnet set of
 attributes, so, probably, a differnt ActionForm\JSP combo.

 Should we have a Forward per ProductCategory with a Product Category specific
 ActionForm and corresponding jsp?

 Seems like there should be a better/more generic way. Any ideas?

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



Struts Design Question

2005-12-07 Thread bill
A bit of a struts newbie here. I have an application with the following page 
flow:
choose Product Category -- choose Product Model -- create/edit chosen model

Currently we only have one ActionForm\JSP Edit Form, but we need to expand 
this to support different Product Categories. Each would be a differnet set of 
attributes, so, probably, a differnt ActionForm\JSP combo.

Should we have a Forward per ProductCategory with a Product Category specific 
ActionForm and corresponding jsp?

Seems like there should be a better/more generic way. Any ideas?


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



RE: design question --- struts displaytag

2005-12-01 Thread fea jabi

can someone help me with this please?

Thanks.



From: fea jabi [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: user@struts.apache.org
Subject: design question --- struts  displaytag
Date: Wed, 30 Nov 2005 16:02:26 -0500

Have a table as below -- will be using displaytag for this.

 Hrs
Loans  3
deposit5


For this I created a DynaValidatorForm with
loans, deposits as it's form properties.

form-bean name=HoursForm 
type=org.apache.struts.validator.DynaValidatorForm dynamic=true

form-property name=loans type=java.lang.Integer/
form-property name=deposits type=java.lang.Integer/
   /form-bean

action
   path=/PrepareHoursAction
   type=com.actions.PrepareHoursAction
   name=HoursForm
   scope=session
   forward name=success path=/Hours.jsp redirect=false/
/action

In action

public ActionForward execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws ServletException, IOException {

   DynaValidatorForm hrsForm = (DynaValidatorForm) form;
  request.setAttribute(hrs, gethrs(hrsForm) );
   return mapping.findForward(success);
   }

private ArrayList getAdminHrs(DynaValidatorForm hrsForm) {
   hrsForm.set(loans,3);
   hrsForm.set(deposits,5);


   ArrayList hrs = new ArrayList();

   hrs .add(hrsForm.get(loans));
   hrs.add(hrsForm.get(deposits));

   return hrs;
   }

In Jsp
...
...

  display:table name=hrs 
   display:column property= / -- not sure 
how to get this value

 /display:table

.



IS this the right way of doing this? I am stuck here in jsp not knowing 
what to do.


Thanks.

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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



_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



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



Re: design question --- struts displaytag

2005-12-01 Thread Matt Morton
You will place the name of the properties asscoiated with hrs bean, 
So if it has a property called name then place name in there.  You
can also break open the tag a bit and use the follwing syntax
display:column${hrs.name}/display:column

Then you can manipulate the value like you want.  This is off the top
of my head so double check it with the displaytag docs.

Matt Morton

On 12/1/05, fea jabi [EMAIL PROTECTED] wrote:
 can someone help me with this please?

 Thanks.


 From: fea jabi [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 To: user@struts.apache.org
 Subject: design question --- struts  displaytag
 Date: Wed, 30 Nov 2005 16:02:26 -0500
 
 Have a table as below -- will be using displaytag for this.
 
   Hrs
 Loans  3
 deposit5
 
 
 For this I created a DynaValidatorForm with
 loans, deposits as it's form properties.
 
 form-bean name=HoursForm
 type=org.apache.struts.validator.DynaValidatorForm dynamic=true
  form-property name=loans type=java.lang.Integer/
  form-property name=deposits type=java.lang.Integer/
 /form-bean
 
 action
 path=/PrepareHoursAction
 type=com.actions.PrepareHoursAction
 name=HoursForm
 scope=session
 forward name=success path=/Hours.jsp redirect=false/
  /action
 
 In action
 
 public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
 
 DynaValidatorForm hrsForm = (DynaValidatorForm) form;
request.setAttribute(hrs, gethrs(hrsForm) );
 return mapping.findForward(success);
 }
 
 private ArrayList getAdminHrs(DynaValidatorForm hrsForm) {
 hrsForm.set(loans,3);
 hrsForm.set(deposits,5);
 
 
 ArrayList hrs = new ArrayList();
 
 hrs .add(hrsForm.get(loans));
 hrs.add(hrsForm.get(deposits));
 
 return hrs;
 }
 
 In Jsp
 ...
 ...
 
display:table name=hrs 
 display:column property= / -- not sure
 how to get this value
   /display:table
 
 .
 
 
 
 IS this the right way of doing this? I am stuck here in jsp not knowing
 what to do.
 
 Thanks.
 
 _
 Don't just search. Find. Check out the new MSN Search!
 http://search.msn.click-url.com/go/onm00200636ave/direct/01/
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

 _
 Express yourself instantly with MSN Messenger! Download today - it's FREE!
 http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


 -
 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: design question --- struts displaytag

2005-12-01 Thread Dave Newton

fea jabi wrote:


can someone help me with this please?


What are you doing this for? In other words, is this for your job, 
school work, etc.?


For displaytag questions you'll want to look at the displaytag docs or 
utilize their mailing list.


Dave



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



Re: design question --- struts displaytag

2005-12-01 Thread fea jabi

thankyou for your responses.



From: Dave Newton [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
To: Struts Users Mailing List user@struts.apache.org
Subject: Re: design question --- struts  displaytag
Date: Thu, 01 Dec 2005 09:44:38 -0500

fea jabi wrote:


can someone help me with this please?


What are you doing this for? In other words, is this for your job, school 
work, etc.?


For displaytag questions you'll want to look at the displaytag docs or 
utilize their mailing list.


Dave



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



_
Is your PC infected? Get a FREE online computer virus scan from McAfee® 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



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



design question --- struts displaytag

2005-11-30 Thread fea jabi

Have a table as below -- will be using displaytag for this.

 Hrs
Loans  3
deposit5


For this I created a DynaValidatorForm with
loans, deposits as it's form properties.

form-bean name=HoursForm 
type=org.apache.struts.validator.DynaValidatorForm dynamic=true

form-property name=loans type=java.lang.Integer/
form-property name=deposits type=java.lang.Integer/
   /form-bean

action
   path=/PrepareHoursAction
   type=com.actions.PrepareHoursAction
   name=HoursForm
   scope=session
   forward name=success path=/Hours.jsp redirect=false/
/action

In action

public ActionForward execute(ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws ServletException, IOException {

   DynaValidatorForm hrsForm = (DynaValidatorForm) form;
  request.setAttribute(hrs, gethrs(hrsForm) );
   return mapping.findForward(success);
   }

private ArrayList getAdminHrs(DynaValidatorForm hrsForm) {
   hrsForm.set(loans,3);
   hrsForm.set(deposits,5);


   ArrayList hrs = new ArrayList();

   hrs .add(hrsForm.get(loans));
   hrs.add(hrsForm.get(deposits));

   return hrs;
   }

In Jsp
...
...

  display:table name=hrs 
   display:column property= / -- not sure 
how to get this value

 /display:table

.



IS this the right way of doing this? I am stuck here in jsp not knowing what 
to do.


Thanks.

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/



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



Tiles/Action design question

2005-11-16 Thread Keith Sader
I've got a form that will be included in one of three pages. 
Essentially this form captures the same data at different levels in an
inventory of rolling stock.  The grouping is as follows:

1.) Inventory Defaults - applies to all inventory
2.) Fleet level defaults  - applies to a group of inventory items
3.) Equipment defaults - applies to one piece of rolling stock.

The order of precedence is 3, 2, 1 i.e. attribute data at the
equipment level over-rides defaults set at the fleet level, defaults
set at the fleet level over-ride inventory defaults.

I've got a tile defined that captures the common data, and I was
wondering if it was advisable to pass in the action to call on submit
as a tile parameter?  What I'd like ideally is polymorphism off of a
submit.  Is there an object friendly-way to do this?

Can anyone point me in the right direction?

thanks,
--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader
http://www.jroller.com/page/certifieddanger

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



Re: Tiles/Action design question

2005-11-16 Thread Laurie Harper

Keith Sader wrote:
I've got a form that will be included in one of three pages. 
Essentially this form captures the same data at different levels in an

inventory of rolling stock.  The grouping is as follows:

1.) Inventory Defaults - applies to all inventory
2.) Fleet level defaults  - applies to a group of inventory items
3.) Equipment defaults - applies to one piece of rolling stock.

The order of precedence is 3, 2, 1 i.e. attribute data at the
equipment level over-rides defaults set at the fleet level, defaults
set at the fleet level over-ride inventory defaults.

I've got a tile defined that captures the common data, and I was
wondering if it was advisable to pass in the action to call on submit
as a tile parameter?  What I'd like ideally is polymorphism off of a
submit.  Is there an object friendly-way to do this?


I'm not sure exactly what you meant by 'polymorphism off of a submit' so 
this might be completely off-base but... Passing the action into the 
tile definition may be one option, depending on how your tiles and 
actions are set up. Another option may be to wait for the Struts 1.3 
release that's coming up. 1.3 lets you have 'extends' relationships 
between various configuration elements. I'm not sure, but I think this 
includes tiles definitions, in which case you can have a tile for each 
of your 'precedence levels' with each extending the higer-level one.


If that doesn't sound like it might be useful, I probably haven't 
understood what you want to achieve properly.


L.


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



Re: Tiles/Action design question

2005-11-16 Thread Greg Reddin


On Nov 16, 2005, at 4:31 PM, Laurie Harper wrote:

I'm not sure exactly what you meant by 'polymorphism off of a  
submit' so this might be completely off-base but... Passing the  
action into the tile definition may be one option, depending on how  
your tiles and actions are set up. Another option may be to wait  
for the Struts 1.3 release that's coming up. 1.3 lets you have  
'extends' relationships between various configuration elements. I'm  
not sure, but I think this includes tiles definitions, in which  
case you can have a tile for each of your 'precedence levels' with  
each extending the higer-level one.


Tiles definitions are already extendable in this manner in 1.2.x if I  
understand what you are saying correctly.


Greg


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



Re: Tiles/Action design question

2005-11-16 Thread Laurie Harper

Greg Reddin wrote:

On Nov 16, 2005, at 4:31 PM, Laurie Harper wrote:
I'm not sure exactly what you meant by 'polymorphism off of a  submit' 
so this might be completely off-base but... Passing the  action into 
the tile definition may be one option, depending on how  your tiles 
and actions are set up. Another option may be to wait  for the Struts 
1.3 release that's coming up. 1.3 lets you have  'extends' 
relationships between various configuration elements. I'm  not sure, 
but I think this includes tiles definitions, in which  case you can 
have a tile for each of your 'precedence levels' with  each extending 
the higer-level one.


Tiles definitions are already extendable in this manner in 1.2.x if I  
understand what you are saying correctly.


I think you're right; I was thinking about validations and got my wires 
crossed. Plus I tend to get confused about exactly which 'dimensions' 
the Tiles extends mechanism works across ;-)


L.


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



Re: Tiles/Action design question

2005-11-16 Thread Keith Sader
On 11/16/05, Laurie Harper [EMAIL PROTECTED] wrote:
 Keith Sader wrote:

 I'm not sure exactly what you meant by 'polymorphism off of a submit' so
 this might be completely off-base but... Passing the action into the
 tile definition may be one option, depending on how your tiles and
 actions are set up. Another option may be to wait for the Struts 1.3
 release that's coming up. 1.3 lets you have 'extends' relationships
 between various configuration elements. I'm not sure, but I think this
 includes tiles definitions, in which case you can have a tile for each
 of your 'precedence levels' with each extending the higer-level one.

 If that doesn't sound like it might be useful, I probably haven't
 understood what you want to achieve properly.

Thanks for your input, but (as usual) I've found out what my real
issue is.  I was defining the form element inside of the tile when
the containing page needs to contain the form instead of the tile. 
I'm going to refactor the tile to be just the html elements and inputs
that are common to all these pages and put the form in the containing
page.

What I was working on at first was
other inputs
tile form

but this wouldn't have worked on a submit so what I'll put in now is:

form
other inputs
tile inputs
/form

Now I just need to eliminate some action duplication.

thanks,
--
Keith Sader
[EMAIL PROTECTED]
http://www.saderfamily.org/roller/page/ksader
http://www.jroller.com/page/certifieddanger

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



RE: Struts-Tiles Design question

2005-09-06 Thread Dharmendra . Sharan
Hi,

   Just a follow question to a similar scenario, what's the recomended approach 
with Struts-Tiles to handle the different modes in which a JSP may be 
displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple 
sections.

   e.g. Dish.jsp which can be composed of multiple sections, such as 
summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp 

   Here are the approaches I can think of:-

   1. Tile Definition say dish.content which has all the JSPs inserts for the 
dish.jsp page, and each section's 
(summary/picture/ingredients/preparation/cost) JSP expectinig some request 
attribute say mode to determine how to display that individual section in Add 
or Edit or View mode.

definition name=main.dish path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish.jsp/
put name=body value=dish.content/
/definition

definition name=dish.content path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary.jsp /
add value=/jsp/dish/picture.jsp /
add value=/jsp/dish/ingredients.jsp /
add value=/jsp/dish/preparation.jsp /
add value=/jsp/dish/cost.jsp /
  /putList
/definition

And say in the DishAction class doing the forward to the tiles definition 
say main.dish and passing the request attribute say mode having value 
edit, view and so on...

   2. Having the JSP pages for each section split further as separate JSPs for 
each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using 
multiple tile definitions having the same layout!!! such as below:-

definition name=main.dish.edit path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_edit.jsp/
put name=body value=dish.content.edit/
/definition

definition name=main.dish.view path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_view.jsp/
put name=body value=dish.content.view/
/definition

definition name=dish.content.edit path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_edit.jsp /
add value=/jsp/dish/picture_edit.jsp /
add value=/jsp/dish/ingredients_edit.jsp /
add value=/jsp/dish/preparation_edit.jsp /
add value=/jsp/dish/cost_edit.jsp /
  /putList
/definition

definition name=dish.content.view path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_view.jsp /
add value=/jsp/dish/picture_view.jsp /
add value=/jsp/dish/ingredients_view.jsp /
add value=/jsp/dish/preparation_view.jsp /
add value=/jsp/dish/cost_view.jsp /
  /putList
/definition

And the having the DishAction class forward to appropriate tiles 
definition main.dish.edit or main.dish.view..but in this case we are 
duplicating the Tile definitions even though the page layout is exactly the 
same!!!

Any thoughts/comments/suggestions are most welcome. Thanks in advance!,

Regards,

Dharmendra
ps: have a good day!
-Original Message-
From: Michael Rasmussen [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:37 AM
To: Struts Users Mailing List
Subject: Re: Struts-Tiles Design question


Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook [EMAIL PROTECTED] wrote:
 If you put the business logic in the JSPs, then it seems to me that you're
 essentially mixing the business and presentation layers. I would put the
 business login in an action and figure out which tile to forward to from
 there. Of course, I haven't used the Tiles Controller that Greg suggested...
 
 Nels
 
 On 8/25/05, Dilip Ladhani [EMAIL PROTECTED] wrote:
 
  I have an application built on struts and tiles. I have a design question
  and would like some of your valuable opinions.
 
  I have a huge jsp, which is broken into many includes, say abc.jsp and
  includes one.jsp, two.jsp etc.
  As, I mentioned I use tiles so in the config file, I have a forward
  element,
  which is like this
  forward name=abc path=abc contextRelative=true/
 
  The abc is defined in the tiles as
  put name=body-content value=/abc.jsp /
 
  Now for the design question...
  I am going to have to switch the includes (one.jsp, two.jsp etc) based on
  some business rules like

Re: Struts-Tiles Design question

2005-09-06 Thread Greg Reddin
=dish.content.edit/
/definition

definition name=main.dish.view path=/jsp/layout/ 
classicLayout.jsp

  put name=header value=/jsp/dish/header_dish_view.jsp/
put name=body value=dish.content.view/
/definition

definition name=dish.content.edit path=/jsp/layout/ 
columnsLayout.jsp

  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_edit.jsp /
add value=/jsp/dish/picture_edit.jsp /
add value=/jsp/dish/ingredients_edit.jsp /
add value=/jsp/dish/preparation_edit.jsp /
add value=/jsp/dish/cost_edit.jsp /
  /putList
/definition

definition name=dish.content.view path=/jsp/layout/ 
columnsLayout.jsp

  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_view.jsp /
add value=/jsp/dish/picture_view.jsp /
add value=/jsp/dish/ingredients_view.jsp /
add value=/jsp/dish/preparation_view.jsp /
add value=/jsp/dish/cost_view.jsp /
  /putList
/definition

And the having the DishAction class forward to appropriate  
tiles definition main.dish.edit or main.dish.view..but in this  
case we are duplicating the Tile definitions even though the page  
layout is exactly the same!!!


Any thoughts/comments/suggestions are most welcome. Thanks in  
advance!,


Regards,

Dharmendra
ps: have a good day!
-Original Message-
From: Michael Rasmussen [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:37 AM
To: Struts Users Mailing List
Subject: Re: Struts-Tiles Design question


Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook [EMAIL PROTECTED] wrote:

If you put the business logic in the JSPs, then it seems to me  
that you're
essentially mixing the business and presentation layers. I would  
put the
business login in an action and figure out which tile to forward  
to from
there. Of course, I haven't used the Tiles Controller that Greg  
suggested...


Nels

On 8/25/05, Dilip Ladhani [EMAIL PROTECTED] wrote:



I have an application built on struts and tiles. I have a design  
question

and would like some of your valuable opinions.

I have a huge jsp, which is broken into many includes, say  
abc.jsp and

includes one.jsp, two.jsp etc.
As, I mentioned I use tiles so in the config file, I have a forward
element,
which is like this
forward name=abc path=abc contextRelative=true/

The abc is defined in the tiles as
put name=body-content value=/abc.jsp /

Now for the design question...
I am going to have to switch the includes (one.jsp, two.jsp etc)  
based on

some business rules like the geographical area, app type etc.

1) Should I just put this logic in the jsp (using if statements  
like :if

apptype = A use one.jsp else use one-next.jsp etc) or
2)Should I use tiles by having different action mappings based on
different
business parameters(say app type) and have each mapping forward to a
different forward defined in tiles-def.

Also the business parameters (based on which jsp is selected) may  
change

in
the future.

Thanks for your input



 
-

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]


Visit our website at http://www.ubs.com

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.


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

RE: Struts-Tiles Design question

2005-09-02 Thread Dharmendra . Sharan
Hi,

   Just a follow question to a similar scenario, what's the recomended approach 
with Struts-Tiles to handle the different modes in which a JSP may be 
displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple 
sections.

   e.g. Dish.jsp which can be composed of multiple sections, such as 
summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp 

   Here are the approaches I can think of:-

   1. Tile Definition say dish.content which has all the JSPs inserts for the 
dish.jsp page, and each section's 
(summary/picture/ingredients/preparation/cost) JSP expectinig some request 
attribute say mode to determine how to display that individual section in Add 
or Edit or View mode.

definition name=main.dish path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish.jsp/
put name=body value=dish.content/
/definition

definition name=dish.content path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary.jsp /
add value=/jsp/dish/picture.jsp /
add value=/jsp/dish/ingredients.jsp /
add value=/jsp/dish/preparation.jsp /
add value=/jsp/dish/cost.jsp /
  /putList
/definition

And say in the DishAction class doing the forward to the tiles definition 
say main.dish and passing the request attribute say mode having value 
edit, view and so on...

   2. Having the JSP pages for each section split further as separate JSPs for 
each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using 
multiple tile definitions having the same layout!!! such as below:-

definition name=main.dish.edit path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_edit.jsp/
put name=body value=dish.content.edit/
/definition

definition name=main.dish.view path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_view.jsp/
put name=body value=dish.content.view/
/definition

definition name=dish.content.edit path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_edit.jsp /
add value=/jsp/dish/picture_edit.jsp /
add value=/jsp/dish/ingredients_edit.jsp /
add value=/jsp/dish/preparation_edit.jsp /
add value=/jsp/dish/cost_edit.jsp /
  /putList
/definition

definition name=dish.content.view path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_view.jsp /
add value=/jsp/dish/picture_view.jsp /
add value=/jsp/dish/ingredients_view.jsp /
add value=/jsp/dish/preparation_view.jsp /
add value=/jsp/dish/cost_view.jsp /
  /putList
/definition

And the having the DishAction class forward to appropriate tiles 
definition main.dish.edit or main.dish.view..but in this case we are 
duplicating the Tile definitions even though the page layout is exactly the 
same!!!

Any thoughts/comments/suggestions are most welcome. Thanks in advance!,

Regards,

Dharmendra
ps: have a good day!
-Original Message-
From: Michael Rasmussen [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:37 AM
To: Struts Users Mailing List
Subject: Re: Struts-Tiles Design question


Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook [EMAIL PROTECTED] wrote:
 If you put the business logic in the JSPs, then it seems to me that you're
 essentially mixing the business and presentation layers. I would put the
 business login in an action and figure out which tile to forward to from
 there. Of course, I haven't used the Tiles Controller that Greg suggested...
 
 Nels
 
 On 8/25/05, Dilip Ladhani [EMAIL PROTECTED] wrote:
 
  I have an application built on struts and tiles. I have a design question
  and would like some of your valuable opinions.
 
  I have a huge jsp, which is broken into many includes, say abc.jsp and
  includes one.jsp, two.jsp etc.
  As, I mentioned I use tiles so in the config file, I have a forward
  element,
  which is like this
  forward name=abc path=abc contextRelative=true/
 
  The abc is defined in the tiles as
  put name=body-content value=/abc.jsp /
 
  Now for the design question...
  I am going to have to switch the includes (one.jsp, two.jsp etc) based on
  some business rules like

RE: Struts-Tiles Design question

2005-09-01 Thread Dharmendra . Sharan
Hi,

   Just a follow question to a similar scenario, what's the recomended approach 
with Struts-Tiles to handle the different modes in which a JSP may be 
displayed. i.e. Add/Edit/View especially for say a JSP page which has multiple 
sections.

   e.g. Dish.jsp which can be composed of multiple sections, such as 
summary.jsp, picture.jsp, ingredients.jsp, preparation.jsp, cost.jsp 

   Here are the approaches I can think of:-

   1. Tile Definition say dish.content which has all the JSPs inserts for the 
dish.jsp page, and each section's 
(summary/picture/ingredients/preparation/cost) JSP expectinig some request 
attribute say mode to determine how to display that individual section in Add 
or Edit or View mode.

definition name=main.dish path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish.jsp/
put name=body value=dish.content/
/definition

definition name=dish.content path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary.jsp /
add value=/jsp/dish/picture.jsp /
add value=/jsp/dish/ingredients.jsp /
add value=/jsp/dish/preparation.jsp /
add value=/jsp/dish/cost.jsp /
  /putList
/definition

And say in the DishAction class doing the forward to the tiles definition 
say main.dish and passing the request attribute say mode having value 
edit, view and so on...

   2. Having the JSP pages for each section split further as separate JSPs for 
each mode say summary_add.jsp, summary_edit.jsp, summary_view.jsp and using 
multiple tile definitions having the same layout!!! such as below:-

definition name=main.dish.edit path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_edit.jsp/
put name=body value=dish.content.edit/
/definition

definition name=main.dish.view path=/jsp/layout/classicLayout.jsp
  put name=header value=/jsp/dish/header_dish_view.jsp/
put name=body value=dish.content.view/
/definition

definition name=dish.content.edit path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_edit.jsp /
add value=/jsp/dish/picture_edit.jsp /
add value=/jsp/dish/ingredients_edit.jsp /
add value=/jsp/dish/preparation_edit.jsp /
add value=/jsp/dish/cost_edit.jsp /
  /putList
/definition

definition name=dish.content.view path=/jsp/layout/columnsLayout.jsp
  put name=numCols value=1 /
  putList name=list0 
add value=/jsp/dish/summary_view.jsp /
add value=/jsp/dish/picture_view.jsp /
add value=/jsp/dish/ingredients_view.jsp /
add value=/jsp/dish/preparation_view.jsp /
add value=/jsp/dish/cost_view.jsp /
  /putList
/definition

And the having the DishAction class forward to appropriate tiles 
definition main.dish.edit or main.dish.view..but in this case we are 
duplicating the Tile definitions even though the page layout is exactly the 
same!!!

Any thoughts/comments/suggestions are most welcome. Thanks in advance!,

Regards,

Dharmendra
ps: have a good day!
-Original Message-
From: Michael Rasmussen [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:37 AM
To: Struts Users Mailing List
Subject: Re: Struts-Tiles Design question


Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook [EMAIL PROTECTED] wrote:
 If you put the business logic in the JSPs, then it seems to me that you're
 essentially mixing the business and presentation layers. I would put the
 business login in an action and figure out which tile to forward to from
 there. Of course, I haven't used the Tiles Controller that Greg suggested...
 
 Nels
 
 On 8/25/05, Dilip Ladhani [EMAIL PROTECTED] wrote:
 
  I have an application built on struts and tiles. I have a design question
  and would like some of your valuable opinions.
 
  I have a huge jsp, which is broken into many includes, say abc.jsp and
  includes one.jsp, two.jsp etc.
  As, I mentioned I use tiles so in the config file, I have a forward
  element,
  which is like this
  forward name=abc path=abc contextRelative=true/
 
  The abc is defined in the tiles as
  put name=body-content value=/abc.jsp /
 
  Now for the design question...
  I am going to have to switch the includes (one.jsp, two.jsp etc) based on
  some business rules like

Re: Struts-Tiles Design question

2005-08-26 Thread Michael Rasmussen
Dilip,
The tiles controller sounds like an interesting way to do it, but I
have never used it.  I agree with Nels that you should stay away from
a JSP implementation of this.  I have stretched tiles pretty far as to
what it can do conditionally, and I have been very happy with it.  I
would suggest using an action to make decisions about where to go, and
use tiles templates to put the right fragments in the right places.

Michael

On 8/25/05, Nels Overgaard-Cook [EMAIL PROTECTED] wrote:
 If you put the business logic in the JSPs, then it seems to me that you're
 essentially mixing the business and presentation layers. I would put the
 business login in an action and figure out which tile to forward to from
 there. Of course, I haven't used the Tiles Controller that Greg suggested...
 
 Nels
 
 On 8/25/05, Dilip Ladhani [EMAIL PROTECTED] wrote:
 
  I have an application built on struts and tiles. I have a design question
  and would like some of your valuable opinions.
 
  I have a huge jsp, which is broken into many includes, say abc.jsp and
  includes one.jsp, two.jsp etc.
  As, I mentioned I use tiles so in the config file, I have a forward
  element,
  which is like this
  forward name=abc path=abc contextRelative=true/
 
  The abc is defined in the tiles as
  put name=body-content value=/abc.jsp /
 
  Now for the design question...
  I am going to have to switch the includes (one.jsp, two.jsp etc) based on
  some business rules like the geographical area, app type etc.
 
  1) Should I just put this logic in the jsp (using if statements like :if
  apptype = A use one.jsp else use one-next.jsp etc) or
  2)Should I use tiles by having different action mappings based on
  different
  business parameters(say app type) and have each mapping forward to a
  different forward defined in tiles-def.
 
  Also the business parameters (based on which jsp is selected) may change
  in
  the future.
 
  Thanks for your input
 
 
 
  -
  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]



  1   2   >