Re: [DESIGN] struts dialog / wizard

2007-02-25 Thread Madhav Bhargava

You can also have a look at easy wizard
http://superinterface.com/easywizard.htm

~madhav

On 2/26/07, Tom Schneider [EMAIL PROTECTED] wrote:


Mark Menard has done some work in this area for struts2:
http://www.vitarara.org/cms/node/84

For webwork I implemented something similar called a model repository.
The problem that's being solved is that when the domain model reaches a
certain complexity, using the null instantiation feature and reading the
model from the database again fail to work.  The basic idea of the model
repository was to save off the domain model somewhere (e.g. serial to a
hidden field on the client, in an ehcache cache, in the session) before
you go to the edit screen.  When the data is posted back, before the
parameter interceptor runs, you restore the model.  This allows you to
set the parameters back onto exactly the same model you edited.

I like the idea of expanding the model repository idea to include the
concept of conversation scope, but I don't want to loose simplicity of
model repository.  I'll probably create a plugin at some point to
provide this functionality.

Finally, there's also the scope interceptor that Don wrote that is still
in the sandbox.

Of course, all of this is for struts 2, so it doesn't do you any good
for 1.4.  :o)

Paul Benedict wrote:
 How often do people develop wizards with Struts? I have a custom
 form/action which allows me to do that. Perhaps I should think about
 putting it into Struts 1.4?

 Strachan, Paul wrote:
 Hi,

 I'm looking at implementing a struts wizard flow (of about 12 pages)
 into my struts-1.2.9 application.  The struts dialogue project seems
 to be along the lines of what I need (pattern-wise).  I have some
 extra quirements such as:

 1. A progress menu (synch with the wizard)

 2. Some pages have options (eg radio buttons) which alter the later
flow

 3. The usual next/previous buttons + ability for user to navigate
 directly to some pages

 4. A review page which allow user to 'amend' sections (eg button to
 navigate back to that page)

 5. Once the wizard is complete (ie submitted for processing), the
 user can still make changes to some pages while not others (actually
 this depends a bit on the current state of the internal processing) -
 I suspect each page needs to obtain its own state dynamically and
 present a read-only or update view.

 Can anyone advise there experience with struts-dialog (sourceforge)
 or some other wizard or workflow framework/model that would suit this
 requirement?

 Thanks,

 Paul

 **
 This message is intended for the addressee named and may contain
 privileged information or confidential information or both. If you
 are not the intended recipient please delete it and notify the sender.
 **

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





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: struts tiles and validator framework

2006-11-07 Thread Madhav Bhargava

Let me elaborate my problem and the reason i have posted this to this list:

I am using tiles with JSF. So i have just one layout.jsp. This file has the
form tag and other JSP's just get inserted into the respective place
holders.

All of this works just fine. The problem comes when i am trying to use
Struts client side validator framework along with the combination of tiles +
JSF. In the validator framework  - validation.xml file will require a form
name and then all the fields and their respective validations.

Will this mean that if there are 40 different forms that use the same layout
tile will need to have fields uniquely named? I thought this was a big ask
and therefore wanted to know how tiles and struts validator framework work
together.

Thanks for the reply.

~madhav

On 11/7/06, Antonio Petrelli [EMAIL PROTECTED] wrote:


Madhav Bhargava ha scritto:
 Since i am using struts tiles there is always going to be one form.
 How can
 i then use these 2 together?

Wait a moment, what's the connection between Tiles and the use of only
one form? That's not true.
Probably you wanted to say that you have one form and the fields of that
form is spread across different JSP pages, right?
In this case probably you have to create a big big ActionForm that
contains all fields, or create one ActionForm for each resulting page.
Anyway I don't know Validator very well, so maybe someone else can help
you more than me.

Ciao
Antonio

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





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


struts tiles and validator framework

2006-11-06 Thread Madhav Bhargava

Hi All,

I am using struts tiles for laying out all the pages. I am wondering how i
can use struts client validator framework with struts tiles.
The validation.xml file requires form name and then within the form tag we
define the individual fields along with the respective validations.

Since i am using struts tiles there is always going to be one form. How can
i then use these 2 together?

Any help/guidence will be appreciated.

~madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: How to make dropdown box editable.

2006-10-26 Thread Madhav Bhargava

Post the exact requirement.

On 10/27/06, Chris Pratt [EMAIL PROTECTED] wrote:


It's not possible in straight HTML.  There are some DHTML tricks that
combine text boxes with select boxes, but most that I've seen are ugly and
unworkable.  If you find a good solution to the problem, please post it
here.
  (*Chris*)

On 10/26/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


 Hi all,

 I have requirement where in I want drop down box to be editable. Is this
 possible using struts html tag lib.
 Please let me know how to go about making drop down box editable.

 Regards,
 Vinodh









 The information contained in this electronic message and any attachments
 to this message are intended for the exclusive use of the addressee(s)
and
 may contain proprietary, confidential or privileged information. If you
are
 not the intended recipient, you should not disseminate, distribute or
copy
 this e-mail. Please notify the sender immediately and destroy all copies
of
 this message and any attachments.

 WARNING: Computer viruses can be transmitted via email. The recipient
 should check this email and any attachments for the presence of viruses.
The
 company accepts no liability for any damage caused by any virus
transmitted
 by this email.

 www.wipro.com






--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


HttpSession facade

2006-08-29 Thread Madhav Bhargava

I was going thru the struts source code and was in particular reading the
way they have implemented the synchronizer token pattern for preventing
multiple submits on transacional pages.

I saw that they have synchronized on session ID attribute. Is it possible
that multiple session share the same session ID? There is noting in the
servlet API that mandates it.

~madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: [JAVA]Converting a string to date

2006-06-23 Thread Madhav Bhargava

There are many ways you can do it:

One way is using Apache BeanUtils with Converters registered to it. This way
automatic conversions can happen
Again it depends on what date you want to convert- current date, arbitrary
date.

You can just go ahead and use SimpleDateFormat's format/parse methods.

On 6/23/06, Daoud Abdelmonem Faleh [EMAIL PROTECTED] wrote:


I use this utility class:

package com.itCom.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
*
* @author Dao
*/
public class SQLDateConvertor {

/** Creates a new instance of SQLDateConvertor */
public SQLDateConvertor() {
}
public static String convertDateFormat(java.sql.Date date, String
format)

{
DateFormat df = new SimpleDateFormat(format);

   try {
   return df.format(date);
   } catch (Exception exp) {
   return null;
   }

}
public static java.sql.Date convertToSqlDateFormat(String
value,String format) {

   DateFormat df = new SimpleDateFormat(format);

   try {

   Date date = df.parse(value);
   return new java.sql.Date(date.getTime());

   } catch (Exception exp) {
   return null;
   }
   }
}

On 6/23/06, Niall Pemberton [EMAIL PROTECTED] wrote:
 Commons Validator 1.3.0 has a whole set of easy to use
 validation/conversion routines:

   http://tinyurl.com/g526k

   DateValidator validator = DateValidator.getInstance();
   java.util.Date utilDate= validator.validate(06-apr-07, dd-MMM-yy);
   java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());

 Niall

 On 6/22/06, Chris Cheshire [EMAIL PROTECTED] wrote:
  try {
 java.sql.Date d = new java.sql.Date(new
  SimpleDateFormat(dd-MMM-yy).parse(06-apr-07).getTime());
  }
  catch (ParseException ex) {
  }
 
  Chris
 
  On 6/22/06, temp temp [EMAIL PROTECTED] wrote:
   I have a string which I want to convert into a date .
 The string   06-APR-07
  
 How can I convert this date into sql date ?
  
 Thanks
  
  
  
  
   -
   Yahoo! Groups gets better. Check out the new email design. Plus
there's much more to come.
  
 
  -
  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]





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: [JAVA]Converting a string to date

2006-06-23 Thread Madhav Bhargava

For all these small things the best way is to google and find out. I am sure
you will get enough hits to suffice what you need.

On 6/24/06, Madhav Bhargava [EMAIL PROTECTED] wrote:


There are many ways you can do it:

One way is using Apache BeanUtils with Converters registered to it. This
way automatic conversions can happen
Again it depends on what date you want to convert- current date, arbitrary
date.

You can just go ahead and use SimpleDateFormat's format/parse methods.


On 6/23/06, Daoud Abdelmonem Faleh  [EMAIL PROTECTED] wrote:

 I use this utility class:

 package com.itCom.util ;

 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;

 /**
 *
 * @author Dao
 */
 public class SQLDateConvertor {

 /** Creates a new instance of SQLDateConvertor */
 public SQLDateConvertor() {
 }
 public static String convertDateFormat(java.sql.Date date, String
 format)

 {
 DateFormat df = new SimpleDateFormat(format);

try {
return df.format(date);
} catch (Exception exp) {
return null;
}

 }
 public static java.sql.Date convertToSqlDateFormat(String
 value,String format) {

DateFormat df = new SimpleDateFormat(format);

try {

Date date = df.parse(value);
return new java.sql.Date(date.getTime());

} catch (Exception exp) {
return null;
}
}
 }

 On 6/23/06, Niall Pemberton [EMAIL PROTECTED] wrote:
  Commons Validator 1.3.0 has a whole set of easy to use
  validation/conversion routines:
 
http://tinyurl.com/g526k
 
DateValidator validator = DateValidator.getInstance();
java.util.Date utilDate= validator.validate(06-apr-07,
 dd-MMM-yy);
java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
 
  Niall
 
  On 6/22/06, Chris Cheshire [EMAIL PROTECTED] wrote:
   try {
  java.sql.Date d = new java.sql.Date(new
   SimpleDateFormat(dd-MMM-yy).parse(06-apr-07).getTime());
   }
   catch (ParseException ex) {
   }
  
   Chris
  
   On 6/22/06, temp temp [EMAIL PROTECTED] wrote:
I have a string which I want to convert into a date .
  The string   06-APR-07
   
  How can I convert this date into sql date ?
   
  Thanks
   
   
   
   
-
Yahoo! Groups gets better. Check out the new email design. Plus
 there's much more to come.
   
  
  
 -
   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]




--
When I tell the truth, it is not for the sake of convincing those who do
not know it, but for the sake of defending those that do





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: Communicate between two struts apps

2006-06-23 Thread Madhav Bhargava

From your original mail the entire concept of having 2 war files bundled in

one EAR file is a bit strange. You can totally avoid this by using different
struts-config files and SwitchActions in struts.

The two different teams can have their own set of actions, form beans,
action mapping and whole lot of other stuff and still you can easily
integrate the two into just one war file and package it in ear file.

I would really like to know the benefit in having 2 war files.

On 6/23/06, Mukta [EMAIL PROTECTED] wrote:


I am developing an SSO application and we are using this kind of scenario
when one app calls some actions of the other app. We are picking those
URLs
from DB and simply providing links to them.


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, June 23, 2006 3:22 AM
To: Struts Users Mailing List
Subject: Re: Communicate between two struts apps

Hello All,

I believe Single Sign On will be able to share Session attributes between
applications. Single Sign On is supported by many application servers like
Oracle, BEA, IBM, etc

Thanks and regards,
Pazhanikanthan. P (Paz)

Consultant for AXA,
HCL Australia Services Pty. Ltd.
Off   : +61-3-9618-4085
Mob : +61-0411-354-838




Monkeyden [EMAIL PROTECTED]
23/06/2006 07:42 AM
Please respond to Struts Users Mailing List


To: Struts Users Mailing List user@struts.apache.org,
[EMAIL PROTECTED]
cc:
Subject:Re: Communicate between two struts apps


AFAIK, if the applications are in two separate contexts there is
no way to share data between them using a common session

Not to mention, some of the Struts tags (form, link) derive context at
runtime, so you don't have the ability to specify an external context.

You'll be forced to do something kludgy and authenticate to both systems
and maintain two sessions.

I don't know if I'd refer to SSO as something klugy





On 6/22/06, Eric Dahnke [EMAIL PROTECTED] wrote:


 AFAIK, if the applications are in two separate contexts there is
 no way to share data between them using a common session. You'll
 be forced to do something kludgy and authenticate to both systems
 and maintain two sessions.

 I would love to see a thread started about this because it is a
 big shortcoming I come up against frequently in Java. That is,
 different wars and contexts are a great way to separate and manage
 different large scale projects, but when it comes time to piece it
 back together as part of a large possibly modular application, yr
 fcked.

 Siteminder (a proprietary product) is a way to get around this and
 is Java friendly, but don't know how it works.



 On Thu Jun 22 13:10:18 EDT 2006, Wen-Jung Chen
 [EMAIL PROTECTED] wrote:

  Hello,
 
  We have two struts applications which are planning to be created
  as two war
  files and deployed as one ear file on application server. We
  develop one
  struts app and other team develops another one. The requirement
  for us is
  their struts application will call our action method to invoke a
  window on
  our side. Does anyone know how their struts app can invoke our
  action
  method? I was told that they can use url redirect by using url we
  provided
  so we can popup a window for them. Is this right way to do it? Is
  there any
  other better way to handle this since we are located in two
  different jvm?
  And also if we want to  pass data back so they can display
  message on their
  screen, are we still use same way such as url direct to pass data
  as request
  parameter to them?
 
  Please help.
 
  Thanks,
  Wen-Jung
 





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




_
This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning Services - powered by MessageLabs. For further information
visit http://www.mci.com




*
Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege.  If you are not
the intended recipient you must not use, distribute or copy this
email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of AXA.   Thank you.


**



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





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: Communicate between two struts apps

2006-06-23 Thread Madhav Bhargava

Could you please elaborate on the same. If there are several release
processes, will you still go ahead with the same approach.


On 6/24/06, Leon Rosenberg [EMAIL PROTECTED] wrote:


On 6/23/06, Madhav Bhargava [EMAIL PROTECTED] wrote:
 From your original mail the entire concept of having 2 war files bundled
in
 one EAR file is a bit strange. You can totally avoid this by using
different
 struts-config files and SwitchActions in struts.

 The two different teams can have their own set of actions, form beans,
 action mapping and whole lot of other stuff and still you can easily
 integrate the two into just one war file and package it in ear file.

 I would really like to know the benefit in having 2 war files.

Separate release processes?
Leon


 On 6/23/06, Mukta [EMAIL PROTECTED] wrote:
 
  I am developing an SSO application and we are using this kind of
scenario
  when one app calls some actions of the other app. We are picking those
  URLs
  from DB and simply providing links to them.
 
 
  -Original Message-
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 23, 2006 3:22 AM
  To: Struts Users Mailing List
  Subject: Re: Communicate between two struts apps
 
  Hello All,
 
  I believe Single Sign On will be able to share Session attributes
between
  applications. Single Sign On is supported by many application servers
like
  Oracle, BEA, IBM, etc
 
  Thanks and regards,
  Pazhanikanthan. P (Paz)
 
  Consultant for AXA,
  HCL Australia Services Pty. Ltd.
  Off   : +61-3-9618-4085
  Mob : +61-0411-354-838
 
 
 
 
  Monkeyden [EMAIL PROTECTED]
  23/06/2006 07:42 AM
  Please respond to Struts Users Mailing List
 
 
  To: Struts Users Mailing List user@struts.apache.org,
  [EMAIL PROTECTED]
  cc:
  Subject:Re: Communicate between two struts apps
 
 
  AFAIK, if the applications are in two separate contexts there is
  no way to share data between them using a common session
 
  Not to mention, some of the Struts tags (form, link) derive context at
  runtime, so you don't have the ability to specify an external context.
 
  You'll be forced to do something kludgy and authenticate to both
systems
  and maintain two sessions.
 
  I don't know if I'd refer to SSO as something klugy
 
 
 
 
 
  On 6/22/06, Eric Dahnke [EMAIL PROTECTED] wrote:
  
  
   AFAIK, if the applications are in two separate contexts there is
   no way to share data between them using a common session. You'll
   be forced to do something kludgy and authenticate to both systems
   and maintain two sessions.
  
   I would love to see a thread started about this because it is a
   big shortcoming I come up against frequently in Java. That is,
   different wars and contexts are a great way to separate and manage
   different large scale projects, but when it comes time to piece it
   back together as part of a large possibly modular application, yr
   fcked.
  
   Siteminder (a proprietary product) is a way to get around this and
   is Java friendly, but don't know how it works.
  
  
  
   On Thu Jun 22 13:10:18 EDT 2006, Wen-Jung Chen
   [EMAIL PROTECTED] wrote:
  
Hello,
   
We have two struts applications which are planning to be created
as two war
files and deployed as one ear file on application server. We
develop one
struts app and other team develops another one. The requirement
for us is
their struts application will call our action method to invoke a
window on
our side. Does anyone know how their struts app can invoke our
action
method? I was told that they can use url redirect by using url we
provided
so we can popup a window for them. Is this right way to do it? Is
there any
other better way to handle this since we are located in two
different jvm?
And also if we want to  pass data back so they can display
message on their
screen, are we still use same way such as url direct to pass data
as request
parameter to them?
   
Please help.
   
Thanks,
Wen-Jung
   
  
  
  
  
  
  
-
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
  _
  This e-mail has been scanned for viruses by MCI's Internet Managed
  Scanning Services - powered by MessageLabs. For further information
  visit http://www.mci.com
 
 
 
 

  *
  Important Note
  This email (including any attachments) contains information which is
  confidential and may be subject to legal privilege.  If you are not
  the intended recipient you must not use, distribute or copy this
  email.  If you have received this email in error please notify the
  sender immediately and delete this email. Any views expressed in this
  email are not necessarily

Re: ActionErrors not being displayed in jsp

2006-06-21 Thread Madhav Bhargava

Paste the complete code for action form, snippet in JSP where you are
fetching the messages.

~madhav

On 6/21/06, Medicherla Lakshmi [EMAIL PROTECTED] wrote:


Hi,

  am still not able to recieve any error messages in the jsp.  Is there
any way to print those messages in the action form with system.
out.printlns so that i will check in the console.  I dont understand
whether its checking or not, coz its not entering into the form even i run
in debug mode without values in username and password.

Madhav Bhargava [EMAIL PROTECTED] wrote:
  If you give validate=true then you need to give input parameter in the
struts-config as well. One more thing - in your JSP try using the
following
code:







If you have HTML tags as part of the messages in
ApplicationResources.properties then you will have to add - filter =
false
to the bean:write tag. This will allow the HTML to be rendered properly,
ie
it will not escape those HTML characters.

~madhav

On 6/21/06, Medicherla Lakshmi wrote:

 Yes, i have validate=true set in my struts-config.xml. Here's my code.

 public ActionErrors validate(ActionMapping mapping, HttpServletRequest
 request) {
 ActionErrors errors = new ActionErrors();
 if (getUsername() == null || getUsername().length()  1) {
 errors.add(username, new ActionMessage(error.name.required
 ));
 }
 if(getPassword() == null || getPassword().length() 1){
 errors.add(password, new ActionMessage(
 error.password.required));
 }
 return errors;
 }

 This is in ActionForm and the corresponding struts-config.xml is
  scope=request path=/login name=LookupForm validate=true




 In the jsp i specified as before .
 Please tel me if there is any error in my code.

 David Friedman wrote:
 Can you post a code snipper for your ActionForm? Do you invoked the
 form's
 validate() method directly in your Action or do you have the mapping set
 with validate=true ?

 Regards,
 David

 -Original Message-
 From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 21, 2006 12:19 AM
 To: Struts Users Mailing List
 Subject: Re: ActionErrors not being displayed in jsp


 Hi,

 Am not using validator.xml for validation. But just the Actionform
 validate method to validate the username and password submitted without
 values. I tried to use even ActionMessage in place of ActionError, but,
my
 jsp is not showing the error message.
 Please Help.

 Thank and Regards,
 MSV Lakshmi.

 Pankaj Gupta
 wrote:
 Use ActionMessages in place of ActionErrors.
 See:
 http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

 regards,
 Pankaj

 [EMAIL PROTECTED] wrote:
  Hi,
 
  public ActionErrors validate(ActionMapping actionMapping,
  HttpServletRequest httpServletRequest) {
 
  ActionErrors errors = new ActionErrors();
 
 
  if ((username == null) || (username.length() == 0)) {
  errors.add(username, new
 
  org.apache.struts.action.ActionError(error.login.username));
  }
 
  if ((password == null) || (password.length() == 0)) {
  errors.add(password, new
 
  org.apache.struts.action.ActionError(error.login.password));
  }
 
 
  return errors;
  }
 
  Add this code in your formbean. Ur formbean should extend
ValidatorForm.
 
  In Jsp. Add this code in the jsp. It will be validation
  will be displayed.
 
 
  regards,
 
  Mansoor
 
 
 
 
 
 
  -Original Message-
  From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, June 20, 2006 6:16 PM
  To: Struts Users Mailing List
  Subject: ActionErrors not being displayed in jsp
 
 
 
  HI,
 
  Can anyone please explain me how to validate a login page using
  validate method of actionform. Am not able to display the errors in my
  jsp page though i wrote in my jsp. Please give any
  example of using ActionErrors.
 
  Thanks and Regards,
  MSV Lakshmi.
 
 
  -
  Yahoo! India Answers: Share what you know. Learn something new Click
  here
  Send free SMS to your Friends on Mobile from your Yahoo! Messenger
  Download now
 
 
  -
  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]




 -
 Yahoo! India Answers: Share what you know. Learn something new Click
here
 Send free SMS to your Friends on Mobile from your Yahoo! Messenger
 Download
 now


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




 -
 Yahoo! India Answers: Share what you know. Learn something new Click
 here
 Send free SMS to your Friends on Mobile from your Yahoo! Messenger
 Download now




--
When I tell the truth, it is not for the sake of convincing those who do
not
know it, but for the sake

Re: Stopping Double Submits via mutex

2006-06-21 Thread Madhav Bhargava

Consider a scenario of a clustered environment where there are multiple
servers handling requests from an application. On each of these servers
session object will be replicated. This means that the same request can go
more than once.

Shouldn't this solution fail then?

~madhav

On 6/21/06, Paul Benedict [EMAIL PROTECTED] wrote:


I've read many different techniques to stopping double submits, but one
technique unfamiliar to me was described inside the Spring Framework.


http://www.springframework.org/docs/api/org/springframework/web/util/HttpSessionMutexListener.html

It did not occur to me to lock the session to make sure that, within a
user's dialog with the server, only one request from a session makes it
through. Now read that carefully: not one user, but one request from one
user. So 1000 different threads can be running, but locking the session will
ensure each is from a unique session.

However, this class exists because some application servers do not
guarantee that the same HttpSession object instance is re-used between
requests. But the application server does need to guarantee the same object
instance with the session... So Spring provides this class (nothing but a
marker interface) if you want to head down this road.

What do people think of locking the session via a session object? I like
it, but I haven't implemented it -- but I want to use it if the feedback is
good. I have a few places in my application in which I want to make sure the
user progresses through my cattle chute in an orderly fashion.

Paul


-
Do you Yahoo!?
Everyone is raving about the  all-new Yahoo! Mail Beta.





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: ActionErrors not being displayed in jsp

2006-06-21 Thread Madhav Bhargava

Provide the following:
1. Action form code - complete
2. JSP snippet that you are using to print the messages

Alternatively postpone the validation till the action class. In the action
class check for user name and password and if there is a problem then set
the errors as:

ActionErrors errMessages = new ActionErrors();
errMessages.add(something, new ActionMessage(some.key);
saveErrors(request, errMessages);

and then forward the control to the same JSP where the error occurred.

~madhav

On 6/21/06, Medicherla Lakshmi [EMAIL PROTECTED] wrote:


Sorry, I could not get you.  Can u please be more clear with the
information.

Madhav Bhargava [EMAIL PROTECTED] wrote:  Paste the complete code for
action form, snippet in JSP where you are
fetching the messages.

~madhav

On 6/21/06, Medicherla Lakshmi wrote:

 Hi,

 am still not able to recieve any error messages in the jsp. Is there
 any way to print those messages in the action form with system.
 out.printlns so that i will check in the console. I dont understand
 whether its checking or not, coz its not entering into the form even i
run
 in debug mode without values in username and password.

 Madhav Bhargava wrote:
 If you give validate=true then you need to give input parameter in the
 struts-config as well. One more thing - in your JSP try using the
 following
 code:







 If you have HTML tags as part of the messages in
 ApplicationResources.properties then you will have to add - filter =
 false
 to the bean:write tag. This will allow the HTML to be rendered properly,
 ie
 it will not escape those HTML characters.

 ~madhav

 On 6/21/06, Medicherla Lakshmi wrote:
 
  Yes, i have validate=true set in my struts-config.xml. Here's my
code.
 
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest
  request) {
  ActionErrors errors = new ActionErrors();
  if (getUsername() == null || getUsername().length()  1) {
  errors.add(username, new ActionMessage(error.name.required
  ));
  }
  if(getPassword() == null || getPassword().length() 1){
  errors.add(password, new ActionMessage(
  error.password.required));
  }
  return errors;
  }
 
  This is in ActionForm and the corresponding struts-config.xml is
   scope=request path=/login name=LookupForm validate=true
 
 
 
 
  In the jsp i specified as before .
  Please tel me if there is any error in my code.
 
  David Friedman wrote:
  Can you post a code snipper for your ActionForm? Do you invoked the
  form's
  validate() method directly in your Action or do you have the mapping
set
  with validate=true ?
 
  Regards,
  David
 
  -Original Message-
  From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, June 21, 2006 12:19 AM
  To: Struts Users Mailing List
  Subject: Re: ActionErrors not being displayed in jsp
 
 
  Hi,
 
  Am not using validator.xml for validation. But just the Actionform
  validate method to validate the username and password submitted
without
  values. I tried to use even ActionMessage in place of ActionError,
but,
 my
  jsp is not showing the error message.
  Please Help.
 
  Thank and Regards,
  MSV Lakshmi.
 
  Pankaj Gupta
  wrote:
  Use ActionMessages in place of ActionErrors.
  See:
  http://wiki.apache.org/struts/StrutsUpgradeNotes11to124
 
  regards,
  Pankaj
 
  [EMAIL PROTECTED] wrote:
   Hi,
  
   public ActionErrors validate(ActionMapping actionMapping,
   HttpServletRequest httpServletRequest) {
  
   ActionErrors errors = new ActionErrors();
  
  
   if ((username == null) || (username.length() == 0)) {
   errors.add(username, new
  
   org.apache.struts.action.ActionError(error.login.username));
   }
  
   if ((password == null) || (password.length() == 0)) {
   errors.add(password, new
  
   org.apache.struts.action.ActionError(error.login.password));
   }
  
  
   return errors;
   }
  
   Add this code in your formbean. Ur formbean should extend
 ValidatorForm.
  
   In Jsp. Add this code in the jsp. It will be validation
   will be displayed.
  
  
   regards,
  
   Mansoor
  
  
  
  
  
  
   -Original Message-
   From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
   Sent: Tuesday, June 20, 2006 6:16 PM
   To: Struts Users Mailing List
   Subject: ActionErrors not being displayed in jsp
  
  
  
   HI,
  
   Can anyone please explain me how to validate a login page using
   validate method of actionform. Am not able to display the errors in
my
   jsp page though i wrote in my jsp. Please give any
   example of using ActionErrors.
  
   Thanks and Regards,
   MSV Lakshmi.
  
  
   -
   Yahoo! India Answers: Share what you know. Learn something new Click
   here
   Send free SMS to your Friends on Mobile from your Yahoo! Messenger
   Download now
  
  
  
-
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED

Re: Stopping Double Submits via mutex

2006-06-21 Thread Madhav Bhargava

For a single JVM this is a nice way to handle multipel submits. But then a
solution should never be limited to one JVM and if it has problems when
multiple JVM;s come into the picture then it should re-thought upon. I would
rather not go for such a solution even though it is a good solution for a
single JVM.

On 6/21/06, Paul Benedict [EMAIL PROTECTED] wrote:


Yes - of course it would. The solution is only for one JVM. You will need
another approach for a clustered environment.

Madhav Bhargava [EMAIL PROTECTED] wrote: Consider a scenario of a
clustered environment where there are multiple
servers handling requests from an application. On each of these servers
session object will be replicated. This means that the same request can go
more than once.

Shouldn't this solution fail then?

~madhav

On 6/21/06, Paul Benedict
wrote:

 I've read many different techniques to stopping double submits, but one
 technique unfamiliar to me was described inside the Spring Framework.



http://www.springframework.org/docs/api/org/springframework/web/util/HttpSessionMutexListener.html

 It did not occur to me to lock the session to make sure that, within a
 user's dialog with the server, only one request from a session makes it
 through. Now read that carefully: not one user, but one request from one
 user. So 1000 different threads can be running, but locking the session
will
 ensure each is from a unique session.

 However, this class exists because some application servers do not
 guarantee that the same HttpSession object instance is re-used between
 requests. But the application server does need to guarantee the same
object
 instance with the session... So Spring provides this class (nothing but
a
 marker interface) if you want to head down this road.

 What do people think of locking the session via a session object? I like
 it, but I haven't implemented it -- but I want to use it if the feedback
is
 good. I have a few places in my application in which I want to make sure
the
 user progresses through my cattle chute in an orderly fashion.

 Paul


 -
 Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.




--
When I tell the truth, it is not for the sake of convincing those who do
not
know it, but for the sake of defending those that do




-
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls.  Great
rates starting at 1¢/min.





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: ActionErrors not being displayed in jsp

2006-06-20 Thread Madhav Bhargava

If you give validate=true then you need to give input parameter in the
struts-config as well. One more thing - in your JSP try using the following
code:

logic:messagesPresent
  html:messages id=errorMess
  bean:write name=errorMess/
  /html:messages id=errorMess
/logic:messagesPresent

If you have HTML tags as part of the messages in
ApplicationResources.properties then you will have to add - filter = false
to the bean:write tag. This will allow the HTML to be rendered properly, ie
it will not escape those HTML characters.

~madhav

On 6/21/06, Medicherla Lakshmi [EMAIL PROTECTED] wrote:


Yes, i have validate=true set in my struts-config.xml.  Here's my code.

public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request) {
ActionErrors errors = new ActionErrors();
if (getUsername() == null || getUsername().length()  1) {
errors.add(username, new ActionMessage(error.name.required
));
}
if(getPassword() == null || getPassword().length() 1){
errors.add(password, new ActionMessage(
error.password.required));
}
return errors;
}

  This is in ActionForm and the corresponding struts-config.xml is
  action input=/Login.jsp type=com.myapp.struts.LookupAction
scope=request path=/login name=LookupForm validate=true
forward name=success path=/menuitems.jsp/
forward name=failure path=/Login.jsp/
  /action

  In the jsp i specified as html:errors/ before /html:form.
  Please tel me if there is any error in my code.

David Friedman [EMAIL PROTECTED] wrote:
  Can you post a code snipper for your ActionForm? Do you invoked the
form's
validate() method directly in your Action or do you have the mapping set
with validate=true ?

Regards,
David

-Original Message-
From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 21, 2006 12:19 AM
To: Struts Users Mailing List
Subject: Re: ActionErrors not being displayed in jsp


Hi,

Am not using validator.xml for validation. But just the Actionform
validate method to validate the username and password submitted without
values. I tried to use even ActionMessage in place of ActionError, but, my
jsp is not showing the error message.
Please Help.

Thank and Regards,
MSV Lakshmi.

Pankaj Gupta
wrote:
Use ActionMessages in place of ActionErrors.
See:
http://wiki.apache.org/struts/StrutsUpgradeNotes11to124

regards,
Pankaj

[EMAIL PROTECTED] wrote:
 Hi,

 public ActionErrors validate(ActionMapping actionMapping,
 HttpServletRequest httpServletRequest) {

 ActionErrors errors = new ActionErrors();


 if ((username == null) || (username.length() == 0)) {
 errors.add(username, new

 org.apache.struts.action.ActionError(error.login.username));
 }

 if ((password == null) || (password.length() == 0)) {
 errors.add(password, new

 org.apache.struts.action.ActionError(error.login.password));
 }


 return errors;
 }

 Add this code in your formbean. Ur formbean should extend ValidatorForm.

 In Jsp. Add this code in the jsp. It will be validation
 will be displayed.


 regards,

 Mansoor






 -Original Message-
 From: Medicherla Lakshmi [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 20, 2006 6:16 PM
 To: Struts Users Mailing List
 Subject: ActionErrors not being displayed in jsp



 HI,

 Can anyone please explain me how to validate a login page using
 validate method of actionform. Am not able to display the errors in my
 jsp page though i wrote in my jsp. Please give any
 example of using ActionErrors.

 Thanks and Regards,
 MSV Lakshmi.


 -
 Yahoo! India Answers: Share what you know. Learn something new Click
 here
 Send free SMS to your Friends on Mobile from your Yahoo! Messenger
 Download now


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




-
Yahoo! India Answers: Share what you know. Learn something new Click here
Send free SMS to your Friends on Mobile from your Yahoo! Messenger
Download
now


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




-
  Yahoo! India Answers: Share what you know. Learn something new Click
here
Send free SMS to your Friends on Mobile from your Yahoo! Messenger
Download now





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: best way to send parameters through more requests

2006-06-09 Thread Madhav Bhargava

there is another option.

you can use apache JCS cache or open symphony's OScache for caching all
objects that are required during user interaction.

On 6/9/06, Emilia Ipate [EMAIL PROTECTED] wrote:


 Hello, all!

Is there a solution besides using session, to send some request parameters
from one request to another?
I would like to implement something like a shopping cart (a functionality
which needs about4-5 steps) and I do not want to store the objects in the
session (it is alread too big)!

So, do you have any ideas?


Kind regards,
Emilia

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





--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: struts validation problem

2006-04-10 Thread Madhav Bhargava
As a quick fix i changed the validator-rules.xml file. I added the
following:

*if (field == undefined) {*
*   isValid = true;*
} else if { 
}

I did this for required and mask rules. This solved the problem for me.

Thanks for your response. Moreover with the version of validator framework i
am using i doubt there is *validwhen* available. I need to double check
that.

~madhav



On 4/10/06, Laurie Harper [EMAIL PROTECTED] wrote:

 Madhav Bhargava wrote:
  Hi All,
 
  I am using Struts 1.0 and struts-validator 1.0.
  I have a JSP which has 3 tabs. Each tab body has a different input
 element
  inside it. I am using Ajax to dynamically generate the tab body content.
 
  Let me take an example and explain it. Assume there are 2 tabs - Tab1
 and
  Tab2.
  *Controls in Tab1: *a text field - t1
  *Controls in Tab2:* a single select drop down - s1
  At any time either the text field is present on the form or a single
 select
  drop down.
 
  In my validation.xml i have validation rules specified for both of these
  controls.
  *Extract from validation.xml*
 
  ?xml version=1.0 encoding=ISO-8859-1 ?
 
  !DOCTYPE form-validation PUBLIC
-//Apache Software Foundation//DTD Commons Validator Rules
  Configuration 1.0//EN
/WEB-INF/config/dtd/validator_1_0.dtd
 
  form-validation
  formset
  form name=fseSearchForm
  field property=t1
 depends=required,minlength
  arg0 key=fsesearchform.t1 /
  arg1 key=${var:minlength} name=
  minlength resource=false /
  var
  var-nameminlength/var-name
  var-value2/var-value
  /var
  /field
  field property=s1 depends=mask
  msg key=fsesearchform.mask
 name=mask /
  arg0 key=fsesearchform.s1 /
  var
  var-namemask/var-name
  var-value^[0-9]+$/var-value
  /var
  /field
  /form
  /formset
  /form-validation
  When the form is submitted then client side validation occurs using
  validation.xml and An error on page comes up on the botton left corner
 of
  the web page indicating that there has been an error. The processing
 does
  not stop but the error is displayed.
 
  The problem is that i am unable to create a rule in validation.xml which
  will only validate a control if it is present on the generated web page.
 
  *Question:*  Is there any way in which it can be specified that only if
 the
  control is there then validate it else ignore the rule? I guess this
 problem
  must be faced by other people as well.
 
  One option will be: Do client side validations using Javascript
 functions
  and do server side validations using validation.xml/defer till you hit
  action and do it explicitely there. But if i have to use
 struts-validator
  framework for client side validations as well then what will the
 solution?

 The validation framework has no way to know the difference between 'the
 control wasn't present on the page' and 'no value was submitted for the
 control' so no, there's no way to tell it to only apply a validation
 when the control is 'there'.

 One possibility would be to express your validation constraints with
 validwhen and use a hidden input or something to decide what rules to
 apply.

 But a better approach may be to leverage the validation framework's
 'wizard' support. That allows you to specify a 'page' key on each
 validation rule to control when it's applied. You would need to figure
 out how to map the currently displayed tab to a page key for the
 validator to look at, but that would probably give you a fairly clean
 solution.

 L.


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




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


struts validation problem

2006-04-07 Thread Madhav Bhargava
Hi All,

I am using Struts 1.0 and struts-validator 1.0.
I have a JSP which has 3 tabs. Each tab body has a different input element
inside it. I am using Ajax to dynamically generate the tab body content.

Let me take an example and explain it. Assume there are 2 tabs - Tab1 and
Tab2.
*Controls in Tab1: *a text field - t1
*Controls in Tab2:* a single select drop down - s1
At any time either the text field is present on the form or a single select
drop down.

In my validation.xml i have validation rules specified for both of these
controls.
*Extract from validation.xml*

?xml version=1.0 encoding=ISO-8859-1 ?

!DOCTYPE form-validation PUBLIC
  -//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.0//EN
  /WEB-INF/config/dtd/validator_1_0.dtd

form-validation
formset
form name=fseSearchForm
field property=t1 depends=required,minlength
arg0 key=fsesearchform.t1 /
arg1 key=${var:minlength} name=
minlength resource=false /
var
var-nameminlength/var-name
var-value2/var-value
/var
/field
field property=s1 depends=mask
msg key=fsesearchform.mask name=mask /
arg0 key=fsesearchform.s1 /
var
var-namemask/var-name
var-value^[0-9]+$/var-value
/var
/field
/form
/formset
/form-validation
When the form is submitted then client side validation occurs using
validation.xml and An error on page comes up on the botton left corner of
the web page indicating that there has been an error. The processing does
not stop but the error is displayed.

The problem is that i am unable to create a rule in validation.xml which
will only validate a control if it is present on the generated web page.

*Question:*  Is there any way in which it can be specified that only if the
control is there then validate it else ignore the rule? I guess this problem
must be faced by other people as well.

One option will be: Do client side validations using Javascript functions
and do server side validations using validation.xml/defer till you hit
action and do it explicitely there. But if i have to use struts-validator
framework for client side validations as well then what will the solution?

~Madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Struts and Ajax

2006-04-06 Thread Madhav Bhargava
Hi All,

I have 2 drop downs in my JSP. One drop down gets populated based on the
value selected in the other drop down. At present this is done using a Tag
handler call. The control goes to a rendering action which then forwards the
call to the JSP. From within the JSP the tag handler is invoked passing all
the necessary arguments. This all works fine except that now the client
wants to introduce Ajax so that a page refresh is avoided.

I do not want to put any Html generating logic inside my action class. Is
there any other elegant way in which i can generate the HTML for the drop
down.

I can very well write different methods to generate the HTML code and then
call these methods from within my action class. But somehow this does not
look very elegant to me.

Any help will be appreciated.

--Madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: forwarding vs redirecting issue

2006-03-28 Thread Madhav Bhargava
another approach to handle session scoped objects is to create a filter that
will be responsible to clean up any session scope objects when they are not
needed. Alternatively you can also overwrite the RequestProcessor
processPreprocess method and do session cleaning there as well.

If you want struts to clean it for you then as stated above u can for
session scoped form beans.

--Madhav


On 3/27/06, Michael Jouravlev [EMAIL PROTECTED] wrote:

 On 3/27/06, Chris Cheshire [EMAIL PROTECTED] wrote:
  Hi,
 
  I have a design issue based around form submission, protecting against
  resubmission etc.
 
  I have seen a couple of design guidelines that seem to conflict.
 
  1) Use the session as little as possible (memory issues etc)
  2) Use forwards where possible as requests can be passed along, with
  original information preserved, as well as speeding up communication.
 
  Now the only problem I face is after an action is complete, if I
  forward to a JSP, that action is open to resubmission when the user
  starts playing with the reload and back buttons on their browser.
  Redirects, because of the URL changing, can help protect against this.
 
  So the solution seems to be to place the beans required by the JSP
  page in displaying the result of the action in the session instead. So
  now there is an issue of when do the objects for the action that was
  just performed get removed from the session?
 
  Do I just put something in the start of each action to remove from the
  session all objects not associated with that action?

 I observe the common Struts pattern to front JSP pages with actions.
 I have a setup/render action that selects an appropriate JSP and
 forwards to it. I also have a submit action that handles the input.
 After submit action finished with input, it redirects to render
 action. So, I redirect from submit action to render action, but I
 forward from render action to a JSP page.

 You don't have to change URL in the address bar for redirect. Say, you
 have showItem.do?id=1234 action that forwards to JSP and shows item
 form. You update item and submit it to updateItem.do action. It
 updates the database or if errors found, it generates errors, sticks
 them into session and redirects to showItem.do?id=1234. Now you have
 the same URL in the browser again, with error messages in the form.
 Struts 1.2.6+ removes messages from session automatically after they
 were shown, but for anything else it is on you.

 Yes, controlling what is in session is a burden, and especially
 problematic if you allow a user to open several windows for one
 object. Then you cannot remove the object when the user returns to,
 say, a list of objects.

 This is a compromize. If you care about cleaner URLs and better user
 experience, use redirect and clean session yourself. Otherwise use
 Token object to prevent resubmits, but a user will still see POSTDATA
 message.

 Session-scoped data allows you to navigate to any action keeping
 application state, so you don't need to obey an artificial page flow.
 I think this is a benefit usage-wise.

 I prefer to use session-scoped ActionForms and to put everything
 related to an object into the form as nested properties. This seems
 easier to handle for me.

 Michael.

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




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: query parameters

2006-03-08 Thread Madhav Bhargava
Yup i realised that as soon as sent this mail. Thanks for the reply.

On 3/7/06, David Delbecq [EMAIL PROTECTED] wrote:

 Encoding and decoding of query parameters is the job of container
 (tomcat, jboss, websphere, what ever you are using). The only struts
 related exception is for multipart/form-data (used for file uploads).
 There it's common-fileupload library which does the decoding. Why would
 you want to do the decoding yourself? The decoding/encoding process is
 done according to rfc1630 specifications.

 Madhav Bhargava a écrit :

 Hi All,
 
 It is a common practice to encode special characters such as ' ', %, #,
 :, $
 etc.. when sending parameters in the query string along with the URL. We
 have a similar requirement. Some of the query parameters can contain
 special
 characters and therefore we went for UTf-8 encoding.
 
 Before using the encoded parameters we call request.getParameter() in the
 struts action class, decode these parameters and then do any further
 processing. The problem comes when % is a part of the parameter value.
 For
 instance the drugName parameter contains a value *pan% jon%. *This gets
 encoded into *pan%25+jon%25*. The problem comes when we say
 request.getParameter() in the action class. The value we get is already
 decoded to *pan% jon%. *So now when we run the decoder it throws an
 exception.
 
 *How do i stop the automatic decoding of query parameters and do decoding
 of
 all the query parameters explicitely? *
 
 
 Madhav
 
 
 --
 When I tell the truth, it is not for the sake of convincing those who do
 not
 know it, but for the sake of defending those that do
 
 
 


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




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


File download

2006-03-08 Thread Madhav Bhargava
Hi All,

I have a JSP where if a link is clicked then a Save As dialog box is
invoked. If the user chooses to save the file, then on the successful
completion of the file download i need to update a status in the database.
After the status is updated the page from which the Save As dialog box was
invoked has to be refreshed with the new status.

When i invoke a dialog box i use ServletOutputStream and context-disposition
to bring up the dialog box. At the end when i write to the servlet output
stream the response is commited. This means that i will not be able to
automatically refresh the page from which the dialog box was invoked.

Please help me with a solution where in i can capture the status of the
download and make a call to the action to referesh the JSP and the database
with the download status.

--madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: File download

2006-03-08 Thread Madhav Bhargava
Hmm... let me check that out. Will get back to you if this does not work.
The purpose however is to know when the download is complete and to refresh
a JSP.

--Madhav

On 3/8/06, David Delbecq [EMAIL PROTECTED] wrote:

 If i remember well there are special http header that can be used to
 tell client the response is split in several part. This is mainly used
 when you send a partial response to client (like a html with table
 containing 3 rows) and after process advanced you send a more complete
 response (like the same html but with table containing 10 rows) and so
 on. You could try a 'file then redirect'  construction.  That may be
 worth investigations. See HTTP rfc for informations.

 Madhav Bhargava a écrit :

 Hi All,
 
 I have a JSP where if a link is clicked then a Save As dialog box is
 invoked. If the user chooses to save the file, then on the successful
 completion of the file download i need to update a status in the
 database.
 After the status is updated the page from which the Save As dialog box
 was
 invoked has to be refreshed with the new status.
 
 When i invoke a dialog box i use ServletOutputStream and
 context-disposition
 to bring up the dialog box. At the end when i write to the servlet output
 stream the response is commited. This means that i will not be able to
 automatically refresh the page from which the dialog box was invoked.
 
 Please help me with a solution where in i can capture the status of the
 download and make a call to the action to referesh the JSP and the
 database
 with the download status.
 
 --madhav
 
 --
 When I tell the truth, it is not for the sake of convincing those who do
 not
 know it, but for the sake of defending those that do
 
 
 


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




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: File download

2006-03-08 Thread Madhav Bhargava
did not find anything that would be of help.

On 3/8/06, Madhav Bhargava [EMAIL PROTECTED] wrote:

  Hmm... let me check that out. Will get back to you if this does not work.
 The purpose however is to know when the download is complete and to
 refresh a JSP.

 --Madhav

  On 3/8/06, David Delbecq [EMAIL PROTECTED] wrote:
 
  If i remember well there are special http header that can be used to
  tell client the response is split in several part. This is mainly used
  when you send a partial response to client (like a html with table
  containing 3 rows) and after process advanced you send a more complete
  response (like the same html but with table containing 10 rows) and so
  on. You could try a 'file then redirect'  construction.  That may be
  worth investigations. See HTTP rfc for informations.
 
  Madhav Bhargava a écrit :
 
  Hi All,
  
  I have a JSP where if a link is clicked then a Save As dialog box is
  invoked. If the user chooses to save the file, then on the successful
  completion of the file download i need to update a status in the
  database.
  After the status is updated the page from which the Save As dialog box
  was
  invoked has to be refreshed with the new status.
  
  When i invoke a dialog box i use ServletOutputStream and
  context-disposition
  to bring up the dialog box. At the end when i write to the servlet
  output
  stream the response is commited. This means that i will not be able to
  automatically refresh the page from which the dialog box was invoked.
  
  Please help me with a solution where in i can capture the status of the
 
  download and make a call to the action to referesh the JSP and the
  database
  with the download status.
  
  --madhav
  
  --
  When I tell the truth, it is not for the sake of convincing those who
  do not
  know it, but for the sake of defending those that do
  
  
  
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --

 When I tell the truth, it is not for the sake of convincing those who do
 not know it, but for the sake of defending those that do




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


query parameters

2006-03-07 Thread Madhav Bhargava
Hi All,

It is a common practice to encode special characters such as ' ', %, #, :, $
etc.. when sending parameters in the query string along with the URL. We
have a similar requirement. Some of the query parameters can contain special
characters and therefore we went for UTf-8 encoding.

Before using the encoded parameters we call request.getParameter() in the
struts action class, decode these parameters and then do any further
processing. The problem comes when % is a part of the parameter value. For
instance the drugName parameter contains a value *pan% jon%. *This gets
encoded into *pan%25+jon%25*. The problem comes when we say
request.getParameter() in the action class. The value we get is already
decoded to *pan% jon%. *So now when we run the decoder it throws an
exception.

*How do i stop the automatic decoding of query parameters and do decoding of
all the query parameters explicitely? *


Madhav


--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Prevent validation of disabled JSP controls

2006-02-11 Thread Madhav Bhargava
Hi All,

I have a JSP page where on the select of a radio button some controls are
disabled/enabled. The form bean associated with this JSP extends
ValidatorForm. I have created rules in validation-xml for each of these
controls which are there on the screen. One rule that is common to all the
controls is -required.

Depending on the selection of the radio button different methods in a
DispatchAction class are called. If i need to do server side validations
then how can i prevent the validator framework to validate controls which
have been disabled.

For client side validations i can just do some slight modifications in
validation-rules.xml and get the behavior i want.

For server side validations of this kind i can think of the following:
1. Override the apache class that provides the required behavior, then
change validator-rules.xml to have the custom class instead.
2. override the validate method in the form bean and based on the request
attributes get only errors for the controls that are enabled. - Somehow this
method though simple fix does not appeal to me much.

What can be the best way in which this can be acheived.

One more thing:

Does struts provide you a way in which you can check in a form bean whether
a control was disabled. The behavior that i observed is that if the control
is disabled then the value in the form bean is null. Which is also the case
when the user does not enter anything in the control.

I am using:

Websphere 5.1.2
Struts 1.1
commons-validator 1.0
JDK 1.3

Regards,
madhav

--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


prevent validation of disabled fields on the JSP page

2006-02-10 Thread Madhav Bhargava
Hi All,

I have a JSP page where on the select of a radio button some controls are
disabled/enabled. The form bean associated with this JSP extends
ValidatorForm. I have created rules in validation-xml for each of these
controls which are there on the screen. One rule that is common to all the
controls is -required.

Depending on the selection of the radio button different methods in a
DispatchAction class are called. If i need to do server side validations
then how can i prevent the validator framework to validate controls which
have been disabled.

For client side validations i can just do some slight modifications in
validation-rules.xml and get the behavior i want.

For server side validations of this kind i can think of the following:
1. Override the apache class that provides the required behavior, then
change validator-rules.xml to have the custom class instead.
2. override the validate method in the form bean and based on the request
attributes get only errors for the controls that are enabled. - Somehow this
method though simple fix does not appeal to me much.

What can be the best way in which this can be acheived.

One more thing:

Does struts provide you a way in which you can check in a form bean whether
a control was disabled. The behavior that i observed is that if the control
is disabled then the value in the form bean is null. Which is also the case
when the user does not enter anything in the control.

Regards,
madhav



--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do


Re: prevent validation of disabled fields on the JSP page

2006-02-10 Thread Madhav Bhargava
Unfortunately i am using Struts 1.1 and commons-validator 1.0

On 2/10/06, Vladislav Pernin [EMAIL PROTECTED] wrote:

 Which version of commons-validator are you using.

 I'm using Struts 1.2.8 and commons-validator 1.2.0, it validate only the
 non disabled field.

 
 Extracted from commons-validator.jar :
 function validateRequired(form) {
var isValid = true;
var focusField = null;
var i = 0;
var fields = new Array();

oRequired = eval('new ' + retrieveFormName(form) +  '_required()');

for (x in oRequired) {
var field = form[oRequired[x][0]];

if (field == null) {
fields[i++] = oRequired[x][1];
isValid=false;
} else if ((field.type == 'hidden' ||
field.type == 'text' ||
field.type == 'textarea' ||
field.type == 'file' ||
field.type == 'radio' ||
field.type == 'checkbox' ||
field.type == 'select-one' ||
field.type == 'password') 
*field.disabled == false*) {
 


 Vlad
 Madhav Bhargava wrote:

 Hi All,
 
 I have a JSP page where on the select of a radio button some controls are
 disabled/enabled. The form bean associated with this JSP extends
 ValidatorForm. I have created rules in validation-xml for each of these
 controls which are there on the screen. One rule that is common to all
 the
 controls is -required.
 
 Depending on the selection of the radio button different methods in a
 DispatchAction class are called. If i need to do server side validations
 then how can i prevent the validator framework to validate controls which
 have been disabled.
 
 For client side validations i can just do some slight modifications in
 validation-rules.xml and get the behavior i want.
 
 For server side validations of this kind i can think of the following:
 1. Override the apache class that provides the required behavior, then
 change validator-rules.xml to have the custom class instead.
 2. override the validate method in the form bean and based on the request
 attributes get only errors for the controls that are enabled. - Somehow
 this
 method though simple fix does not appeal to me much.
 
 What can be the best way in which this can be acheived.
 
 One more thing:
 
 Does struts provide you a way in which you can check in a form bean
 whether
 a control was disabled. The behavior that i observed is that if the
 control
 is disabled then the value in the form bean is null. Which is also the
 case
 when the user does not enter anything in the control.
 
 Regards,
 madhav
 
 
 
 --
 When I tell the truth, it is not for the sake of convincing those who do
 not
 know it, but for the sake of defending those that do
 
 
 


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




--
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do