RE: urlencoding

2005-06-13 Thread Deb, Sujan
Hi there,

Try to use the following before you write anything to response:

response.setContentType(text/html; charset=UTF-8);

Make sure you use this before any call - response.getWriter();

Cheers
Sujan

-Original Message-
From: Franck [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 11:45 AM
To: struts-user@jakarta.apache.org
Subject: urlencoding


Hi,

in my webapp,  I have the following tag :

html:link action=folder paramName=folder  paramId=folder 
paramProperty=fullNamefolder/html:link

In some case, fullName has special chars
In the result source I can see :

a href=folder.do?folder=Courrier+ind%C%A9sirablefolder/a

The URL seems  to be correctly UTF-8 encoded

In the folder.do Action, if I SysOut the folder parameter, I just can 
see some other special chars in the String (a special A and a copyright)
an URLDecode.decode(myString, UTF-8) doesn't work.

Where is my mistake ?

Thanks
Bye 
 

 
 
 
Orange Caraibe 
IMPORTANT.  
CONFIDENTIEL : Les informations contenues dans ce message sont
confidentielles et peuvent etre protegees par la loi. Ce message est etabli
a l'intention exclusive de ses destinataires. Si vous recevez ce message par
erreur, toute lecture, exploitation ou transmission des informations
contenues dans ce message est interdite. Merci de prevenir l'expediteur et
de supprimer de votre ordinateur le message et tous les fichiers
eventuellement attaches.  
Tout message electronique est susceptible d'alteration. Orange Caraibe
decline toute responsabilite au titre de ce message s'il a ete altere,
deforme ou falsifie ; de meme, il appartient au destinataire de s'assurer de
l'absence de tout virus.http:/www.orangecaraibe.com 
IMPORTANT.  
CONFIDENTIALITY : this e-mail is confidential and meant for only the
intended recipients of the transmission, and may be a communication
privileged by law.  If you received this e-mail in error, any review, use,
dissemination, distribution or copying of this e-mail is strictly
prohibited. Please notify the sender immediately of the error by return
e-mail and please delete this message and any attachments from your system.
Thank you in advance for your cooperation.  
E-mails are susceptible to alteration. Orange Caraibe shall not be liable
for the message if altered, changed or falsified. the recipient should
ensure they are actually virus free. Orange Caraibe may monitor all incoming
and outgoing e-mails in line with current legislation.
http:/www.orangecaraibe.com 
 
 

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



RE: LookupDispatchAction : Cancel Button : html:cancel

2005-01-25 Thread Deb, Sujan
Hi Toll,

Your observation is correct. If you use LookupDispatchAction for creating
your own action class, and if you specify validate=true in your
struts-config.xml then Struts will always validate the input regardless
which method in your action class is invoked.

One of the solution is to set validate=true in the struts-config.xml and
ask Struts to perform or bypass the validation in your corresponding execute
methods in the action class. Like:

errors = form.validate(mapping, request);
if (!errors.isEmpty()) {
saveMessages(request, errors);
return new ActionForward(mapping.getInput());
}

I hope this will help you.

Moreover, try to avoid LookupDispatchAction because of the performance
issues in it because it creates a reverse map to lookup the method to
execute. Rather try to use the plain DispatchAction. It is just a suggestion
from my own experience.

Regards
Sujan
contact
nameSujan Deb/name
email[EMAIL PROTECTED]/email
address
20 Dundas Street W, 6th Floor
Toronto, ON, Canada
/address
tel416-861-5242/tel
extn2-5242/extn
/contact



-Original Message-
From: Toll, Marvin (M.) [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 25, 2005 11:01 AM
To: user@struts.apache.org
Subject: LookupDispatchAction : Cancel Button : html:cancel



It appears that extending LookupDispatchAction does *not* cause
validation to be bypassed when the following tag is used in a JSP:

html:cancel property=method
bean:message key=common.button.cancel /
/html:cancel


Two Questions

1) Are we incorrect in our observation?

2) Does anyone have a better solution than the attached?

// Message for cancel button.
public static final String CANCEL_BUTTON_RESOURCE =
common.button.cancel;
public static final String BACK_BUTTON_RESOURCE =
common.button.back;
// LookupDispatchAction parameter name.
public static final String LOOKUP_DISPATCH_ACTION_PARAMETER =
method;
 

/**
 * p This method is overridden to support page
 * submission without validating in three specific contexts
 * when the action class extends LookupDispatchAction.
 * (1) A drop-down list box submitted via JavaScript
 * whose selection is used to trigger initialization of other
attributes.
 * (2) A cancel button was used for submission.  (3) A back button
was
 * used for submission./p
 *
 * @param request The servlet request we are processing
 * @param response The servlet response we are creating
 * @param form The ActionForm instance we are populating
 * @param mapping The ActionMapping we are using
 *
 * @exception IOException if an input/output error occurs
 * @exception ServletException if a servlet exception occurs
 */
protected boolean processValidate(
HttpServletRequest request,
HttpServletResponse response,
ActionForm form,
ActionMapping mapping)
throws IOException, ServletException {

String METHOD_NAME = processValidate;
log.entering(CLASS_NAME, METHOD_NAME);

// Declaration.
boolean valid;

// Determine if LookupDispatchAction is being extended for this
request. 
if (mapping.getParameter() != null
 mapping.getParameter().equals(
Constants.LOOKUP_DISPATCH_ACTION_PARAMETER)) {

// Obtain the message resource bundle.
MessageResources messageResources =
this.getResources(request);

// Determine if a value has not been established in the
request object.
if (request
 
.getParameter(Constants.LOOKUP_DISPATCH_ACTION_PARAMETER)
== null) {

// Initialize the method name to be supported in a
LookupDispatchAction.
String[] methodName = { Constants.METHOD_RETURN_TO_PAGE
};

// Establish the default - supportable as a base class
method.
request.getParameterMap().put(
Constants.LOOKUP_DISPATCH_ACTION_PARAMETER,
methodName);

// Return without validating.
valid = true;

// Determine if the cancel or back button was selected.

} else if (
request.getParameter(
Constants.LOOKUP_DISPATCH_ACTION_PARAMETER).equals(
messageResources.getMessage(
Constants.CANCEL_BUTTON_RESOURCE))
|| request.getParameter(
 
Constants.LOOKUP_DISPATCH_ACTION_PARAMETER).equals(
messageResources.getMessage(
Constants.BACK_BUTTON_RESOURCE))) {

// Return without validating.
valid = true;

} else {
// Process validations.
valid = super.processValidate(request, response, form,
mapping);
}
} else {
// Process validations.
valid =