Re: Can I have a nbsp; _not_ URL encoded?

2003-07-01 Thread Marco Maier
Hi Martin,

try to set the filter attribute of the bean:write tag to false
e.g.
bean:write name=someForm property=someProperty filter=false/
Marco

Martin Naskovski wrote:
I have a LabelValueBean, and the Label property contains spaces.
However, they do not get encoded into nbsp;'s. If I actually include
the nbsp; tag, I get a 'nbsp;' on the screen verbatim :), instead of
what I really wanted - a space.
Is this some catch-22 or is there really a way to specify a
nbsp; for a label property in a LabelValueBean? Can the ampersand be
escaped somehow??? Thanks :).
Martin

-
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: Can I have a nbsp; _not_ URL encoded?

2003-07-01 Thread Marco Maier
amp; nbsp; you get only if the the filter is set to true.
see implementation of filter (org.apache.struts.util.ResponseUtils)
public static String filter(String value) {

if (value == null)
return (null);
char content[] = new char[value.length()];
value.getChars(0, value.length(), content, 0);
StringBuffer result = new StringBuffer(content.length + 50);
for (int i = 0; i  content.length; i++) {
switch (content[i]) {
case '':
result.append(lt;);
break;
case '':
result.append(gt;);
break;
case '':
result.append(amp;);
break;
case '':
result.append(quot;);
break;
default:
result.append(content[i]);
}
}
return (result.toString());
}

if filter is set to false, it should be normally rendered as nbsp;

Marco

Martin Naskovski wrote:
Hallo Marco,

Here's my code:

html:select property=unitLocation
bean:define id=unitLocationOptions name=searchForm
property=unitLocationOptions
type=java.util.Collection/
html:option value=Select one.../html:option
html:options collection=unitLocationOptions
property=value
labelProperty=label filter =false/
  /html:select
The LabelValueBean's label property is set to nbsp;, and what I get
on the HTML rendered is: amp; nbsp;. I set filter to false as well.
So now I'm truly confused :)

Martin

Tuesday, July 1, 2003, 12:45:20 AM, you wrote:

MM Hi Martin,

MM try to set the filter attribute of the bean:write tag to false
MM e.g.
MM bean:write name=someForm property=someProperty filter=false/
MM Marco

MM Martin Naskovski wrote:

I have a LabelValueBean, and the Label property contains spachs.
However, they do not get encoded into nbsp;'s. If I actually include
the nbsp; tag, I get a 'nbsp;' on the screen verbatim :), instead of
what I really wanted - a space.
Is this some catch-22 or is there really a way to specify a
nbsp; for a label property in a LabelValueBean? Can the ampersand be
escaped somehow??? Thanks :).
Martin

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






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




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


Re: [newbie] Prepopulating a form

2003-03-19 Thread Marco Maier
Hi Johan,

try this...

DynaActionForm yourForm = (DynaActionForm) 	   	 
this.createDynaActionFormFromFormBeanConfig(yourFormName, mapping);

// prepopulate the form
httpSession.setAttribute(yourFormName, yourForm);
protected DynaActionForm 
createDynaActionFormFromFormBeanConfig(String 			name, ActionMapping 
mapping)
  	throws InstantiationException, IllegalAccessException
{
  FormBeanConfig config = (FormBeanConfig) 			  	 
mapping.getApplicationConfig().
	findFormBeanConfig(name);

  DynaActionFormClass dynaClass = DynaActionFormClass.
createDynaActionFormClass(config);
  return ((DynaActionForm) dynaClass.newInstance());
}
hope this helps.

Marco

Johan Wasserman wrote:
Hi,
I need to populate a form from a StateBean (session) before displaying
it.
I cannot find anything to do it when using a FormBean (request) since
the bean is initialised when loading the form and no methods are
available to read the StateBean from the session (or so I think), any
suggestions will be welcome.
 
Thanks in advance.
 
Johan Wasserman
 



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


logic:equal with string arrays

2002-09-06 Thread Marco Maier

Hi All,

I would like to compare a element of an object array with the
logic:equal tag.
Something like that...

bean:define id=specialEvalRights name=loginForm 
property=view.specialEvalRights type=java.lang.String[]/

logic:equal name=specialEvalRights property=0 value=true
[...]
/logic:equal

but this doesn't work. I know that this works with HashMap's.
But how can I achieve this with string arrays?

TIA

Marco


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




Re: [VALIDATOR] Validating Date with DynaValidator

2002-09-04 Thread Marco Maier

Axel Stahlhut wrote:
 Sorry for posting this one again, but its a bit urgent and maybe i have a chance 
marking it as a post concerning [Validator].
 
 Validating a Date with the Struts-Validator Framework works fine, but if the field i 
want to validate is not a required field and may be empty, the validator always 
reports an error, even if if i remove the depends=required in the 
validation-rules.xml. 
 Do i have to implement the Validator-class in a way that it doesnt validate empty 
dates or is there any declarative way to solve this?
 Thanks for any help.
 
 Axel
 
 This is my validation-rules.xml:
 
   validator name=date
 classname=org.apache.struts.util.StrutsValidator
method=validateDate
  methodParams=java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionErrors,
javax.servlet.http.HttpServletRequest
msg=errors.date
jsFunctionName=DateValidations
 
 and the validation.xml:
 
 field property=beginEmployment depends=date
 arg0 key=personal.data.beginEmployment /
 var
 var-namedatePattern/var-name
 var-valuedd.MM./var-value
 /var
 /field
 
 
 

Hi Axel,

you can subclass the DynaValidatorForm to override the validator method.
There you can check if the date field is empty, something like that

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request)
{
   String date = null;

   if (((date = (String) this.get(yourDateField)) == null)
|| (date.length == 0))
   {
 // do no validation
 return null;
   }
   return super.validate(mapping, request);
}

Hope this helps.

Marco


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




Re: Switch Action example

2002-08-27 Thread Marco Maier

Hi Greg,

here is an example...

exception
key=global.error.httpSessionTimeout
path=/switch.do?prefix=amp;page=/login.jsp
scope=request
type=de.ics_software.rpk.struts.exception.HttpSessionTimeoutException/

action-mappings
action 
path=/switch type=org.apache.struts.actions.SwitchAction /
/action-mappings

The prefix request parameter specifies the application prefix.
In my example I switch to the default application.
If you want switch to the e.g. struts-cars-confix.xml sub-appplication, 
the prefix must be /cars.
BTW use amp; instead of  in your request past, since  confuses the
XML Parser.

Hope this helps.

Marco

Greg Hess wrote:
 Hi All,
 
 I am having trouble using the SwitchAction and all the threads in the
 Archives dont actualy provide an example of its use and claim that it may
 not work?
 
 Could anyone provide an example of its use.
 
 Thanks for your time,
 
 Greg
 




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




Validator problem!

2002-08-16 Thread Marco Maier

Hi,

Im using the struts validator to validate a date in an DynaValidatorForm.
In my JSP I have two radio buttons where the user can
choose between the current date and an input field that requires
an valid date.
The Struts validator always validates the date from the
input field. But I want that the validator doesn't
validate the date when the current date is selected.

How can I disable the validation when the
current date radio button is selected?

TIA
Marco





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




Re: Validator problem!

2002-08-16 Thread Marco Maier

I know about that, just like...

public ActionErrors validate(ActionMapping mapping, HttpServletRequest 
request)
{
ActionErrors errors = new ActionErrors();

// check only if the second radio button is selected
if(this.selected.equals(1)  !DateUtils.isDateValid(this.day,
 this.month, this.year))
{
  ActionError newError = new ActionError(global.error.invalid_date);
  errors.add(ActionErrors.GLOBAL_ERROR, newError);
}

return errors;
}

but I want use dynamic forms. One solution is to use javascript that 
detects when the current date is selected. Then get the current system
date an put it to the validator. But this isn't nice for me.

Marco


Zimmer, Robin (SSABSA) wrote:
 Once simple option is just to use a plain old ActionForm and override the
 validate method.
 
 -Original Message-
 From: Marco Maier [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 16 August 2002 5:48 PM
 To: Struts Users Mailing List
 Subject: Validator problem!
 
 
 Hi,
 
 Im using the struts validator to validate a date in an DynaValidatorForm.
 In my JSP I have two radio buttons where the user can
 choose between the current date and an input field that requires
 an valid date.
 The Struts validator always validates the date from the
 input field. But I want that the validator doesn't
 validate the date when the current date is selected.
 
 How can I disable the validation when the
 current date radio button is selected?
 
 TIA
 Marco
 
 
 
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 




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




Re: Two ActionForms in one action

2002-08-02 Thread Marco Maier

Hi Neethiraj,

thanks a lot for your answer.
But if i set my form to session scope it's much easier to retrieve the 
attributes in the next action.

Regards,
Marco



Neethiraj, Selvamohan wrote:
 If I understand your question correctly,  you want to set a FIXED value for an 
attribute in the FORM that is invoked by your next ACTION.
 Why can't you set this FORM2() object in your request by doing the following in your 
Action associated with the first FORM:
 
   FORM2  lNewFormTwo = new FORM2() ;
   lNewFormTwo.setAttribute(Value) ;# This is your method in FORM2 Object
   request.setAttribute(FORM2, lNewFormTwo) ;
 
 Then, the next view (JSP)  that takes the value from this Object  and place it as a 
Hidden variable or a Read-Only variable using the following code:
 
   % 
   FORM2  lForm = request.getAttribute(FORM2) ;
   If (  lForm != null )
   {
   %
   INPUT TYPE=hidden NAME=Attribute  VALUE=%= lForm.getAttribute() 
%
   %
   }
   %
   
 
 This way,  you are passing value to the next View and then, it gets passed to the 
Next action when the next view SUBMITS its form.
 
 Selva-
 
  -Original Message-
 From: Marco Maier [mailto:[EMAIL PROTECTED]] 
 Sent: Thursday, August 01, 2002 4:10 AM
 To:   [EMAIL PROTECTED]
 Subject:  Two ActionForms in one action
 
 Hi,
 
 is it possible to preset a form in an action that is associated with 
 another form.
 
 For example:
 I have the action Action1 with the name attribute Form1
 
 public class Action1 extends Action
 {
 [...]
 
 public ActionForward execute(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response
 ) 
 throws Exception
 {
// get values from form1
Form1 form1 = (Form1) form;
   
System.out.println(Day:  + form1.getDay());
System.out.println(Month:  + form1.getMonth());
System.out.println(Year:  + form1.getYear());
[...]
// put values to business layer
[...]
// get results from business layer
[...]
 
// set results to another form (for example Form2)
Form2 form2 = new Form2();
   
form2.setSomething(Hello);   
[...]
 
// forward to Action2 that is associated with Form2
return mapping.findForward(RPKConstants.SUCCESS_KEY);
 }
 }
 
 In Action2 I will get the preset values from Form2.
 How does my action-mapping looks like
 if this is possible?
 Are there any alternatives?
 
 TIA,
 Marco
 
 
 
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 


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




Two ActionForms in one action

2002-08-01 Thread Marco Maier

Hi,

is it possible to preset a form in an action that is associated with 
another form.

For example:
I have the action Action1 with the name attribute Form1

public class Action1 extends Action
{
[...]

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response
  ) 
throws Exception
{
   // get values from form1
   Form1 form1 = (Form1) form;

   System.out.println(Day:  + form1.getDay());
   System.out.println(Month:  + form1.getMonth());
   System.out.println(Year:  + form1.getYear());
   [...]
   // put values to business layer
   [...]
   // get results from business layer
   [...]

   // set results to another form (for example Form2)
   Form2 form2 = new Form2();

   form2.setSomething(Hello); 
   [...]

   // forward to Action2 that is associated with Form2
   return mapping.findForward(RPKConstants.SUCCESS_KEY);
}
}

In Action2 I will get the preset values from Form2.
How does my action-mapping looks like
if this is possible?
Are there any alternatives?

TIA,
Marco






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




Re: Switching the locale(language)

2002-07-10 Thread Marco Maier

see also

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg30863.html

Marco


Jon.Ridgway wrote:
 Hi All,
 
 Ok more info, I'v tried this and it's of the top of my head so...
 
 Add some JavaScript similar to this...
 
 script language=Javascript
 !-- //
   function setLocale (List)
   {
   var code = List.options[List.selectedIndex].value;
   window.location.href = 'html:rewrite forward=setLocale/'
 + 'code=' code+ ;
   }
 // --
 /script
 
 And an html:select like this...
 
 html:select property=code onchange=setLocale(this);
   html:options collection=locales property=value
 labelProperty=label/
 /html:select
 
 (note the locales collection above would have to be in scope and contain a
 Collection of Struts LabelValueBean beans).
 
 In your struts-config define a global forward called setLocale that maps to
 an action class. You action class would have code similar to this...
 
 Locale locale = new Locale (request.getParameter (code);
 setLocale (request, locale);
 
 Jon Ridgway
 
 
 -Original Message-
 From: cyril guszkiewicz [mailto:[EMAIL PROTECTED]] 
 Sent: 10 July 2002 11:43
 To: Struts Users Mailing List
 Subject: RE: Switching the locale(language)
 
 
  Thanks for your answer and in fact I'd like more details about the jsp side
 of things.
  
  Jon.Ridgway [EMAIL PROTECTED] a écrit : Hi Cyril,
 
 In your Action class call setLocale (HttpServletRequest request, Locale
 locale). Use your jsp to get the country code ie 'fr'. You can then use this
 code in your action to create the locale, ie Locale locale = new Locale
 (code). Once you have set the locale struts will take care of the rest; you
 just need to define a resource bundle for each locale.
 
 Hope this helps, let me know if you need help with the jsp side of things.
 
 Jon Ridgway
 
 
 -Original Message-
 From: cyril guszkiewicz [mailto:[EMAIL PROTECTED]] 
 Sent: 10 July 2002 11:23
 To: [EMAIL PROTECTED]
 Subject: Switching the locale(language)
 
 
 Hi everybody, I'am developping an application in three languages with STUTS
 1.0.2
 
 I'd like to know how can you change the locale of an application via a
 button on a web page.I don't want the user to have to change their language
 from the browser (e.g. Tools-Internet Options-Languages in IE) but I want
 the user to be able to toggle languages from a button.
 
 Thanks a lot for yours answers ( if you could give me an example it would be
 nice)
 
 Bye
 
 
 
 -
 Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !
 
 The contents of this email are intended only for the named addressees and
 may contain confidential and/or privileged material. If received in error
 please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
 e-mail from your system. Unauthorised review, distribution, disclosure or
 other use of this information could constitute a breach of confidence. Your
 co-operation in this matter is greatly appreciated. 
 
 --
 To unsubscribe, e-mail: 
 For additional commands, e-mail: 
 
 
 
 -
 Yahoo! Mail -- Une adresse @yahoo.fr gratuite et en français !
 
 The contents of this email are intended only for the named addressees and
 may contain confidential and/or privileged material. If received in error
 please contact UPCO on +44 (0) 113 201 0600 and then delete the entire
 e-mail from your system. Unauthorised review, distribution, disclosure or
 other use of this information could constitute a breach of confidence. Your
 co-operation in this matter is greatly appreciated. 
 
 --
 To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
 For additional commands, e-mail: mailto:[EMAIL PROTECTED]
 
 
 




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




Re: title and alt properties

2002-06-28 Thread Marco Maier

Hi,

I have exactly the same problem.

The output is always

textarea name=text1 title=???de.null??? alt=???de.null???some
text/textarea

I can't get rid of them. Even if I put an empty title and alt property.

Any ideas?
I'm using Struts 1.1-b1 with WSAD 4.0.3

TIA
Marco



Barbara Post wrote:

 Hi again,

 when I use html:password, html:text, html:img without setting title / alt to
 an empty string struts looks in my ApplicationResources.properties and
 doesn't find anything, but which key does it look for ?

 example :

 html:text property=userCompany ... /

 instead of :

 html:text property=userCompany title= alt= ... /

 because I forget to put these then have garbage in the resulting html source
 ;-)

 Thx a lot.

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


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




Re: title and alt properties

2002-06-28 Thread Marco Maier

Hi Barbara,

 so let's hardcode title = and alt= in the jsp ? I do this :-/

that doesn't work.
The output for

html:textarea property=text1 title= alt= /

is also

textarea name=text1 title=???de.null??? alt=???de.null???

Only if I set alt=something and title=something I get rid of the ugly
???de.null???.
But this isn't a nice solution, since this occurs on every html element and I
don't want
a alt and title property on every html element.

 By the way, if I have html:text property=myinput1 ... /, what do you
 think the key is ? the form is MyActionForm1 for example.

don't know.

regards
Marco


Barbara Post wrote:

 Hi Marco, so let's hardcode title = and alt= in the jsp ? I do this :-/

 Would be nice if not found string would return  instead of locale + null +
 garbage

 By the way, if I have html:text property=myinput1 ... /, what do you
 think the key is ? the form is MyActionForm1 for example.

 Barbara
 - Original Message -
 From: Marco Maier [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Friday, June 28, 2002 9:53 AM
 Subject: Re: title and alt properties

  Hi,
 
  I have exactly the same problem.
 
  The output is always
 
  textarea name=text1 title=???de.null??? alt=???de.null???some
  text/textarea
 
  I can't get rid of them. Even if I put an empty title and alt property.
 
  Any ideas?
  I'm using Struts 1.1-b1 with WSAD 4.0.3
 
  TIA
  Marco
 
 
 
  Barbara Post wrote:
 
   Hi again,
  
   when I use html:password, html:text, html:img without setting title /
 alt to
   an empty string struts looks in my ApplicationResources.properties and
   doesn't find anything, but which key does it look for ?
  
   example :
  
   html:text property=userCompany ... /
  
   instead of :
  
   html:text property=userCompany title= alt= ... /
  
   because I forget to put these then have garbage in the resulting html
 source
   ;-)
  
   Thx a lot.
  
   --
   To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
   For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 
  --
  To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
  For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 

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


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




Re: title and alt properties

2002-06-28 Thread Marco Maier

That's it!

If I set message-resources parameter=RpkMessageResources null=true/
then the problem disappears.
This could be a bug!

Thanks,
Marco

Struts Newsgroup (@Basebeans.com) wrote:

 Subject: Re: title and alt properties
 From: Torgeir Veimo [EMAIL PROTECTED]
  ===
 Marco Maier wrote:
  Hi Barbara,
 
 
 so let's hardcode title = and alt= in the jsp ? I do this :-/
 
 
  that doesn't work.
  The output for
 
  html:textarea property=text1 title= alt= /
 
  is also
 
  textarea name=text1 title=???de.null??? alt=???de.null???
 
  Only if I set alt=something and title=something I get rid of the ugly
  ???de.null???.
  But this isn't a nice solution, since this occurs on every html element and I
  don't want
  a alt and title property on every html element.

 I filed a bug, http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8460,
 but Craig seems to disagree its a problem.

 --
 -Torgeir

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


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