Anton Pussep wrote:
  value="%{'/jsp/'+#parameters.file[0]}"

I thought I tried that one out already, but apparently I remembered
wrong, since it really works, which is great!

Anyway, for my part this is very inconvenient. Also I don't know a way
to pass an array to request parameters. Thus IMHO there should be a more
convenient way to concatenate strings here.

When you use the raw request parameters, the datatype is determined by the Servlet engine. It's a *array* of strings because HTML forms can have more than one value associated with a given field. Checkboxes are the typical example, but keep in mind that *most* form field types (select, text, etc.) can have more than one control with the same name which yields multiple values associated .

So when form data is submitted, the servlet engine has to handle that case. This is why the raw parameter data is a string array.

Now, for you this is "inconvenient", you almost probably have just one value submitted for the "file" parameter.

So my suggestion is do *not* access the raw parameters. That's sort of not the point of S2 anyway. The idea is to let S2 translate the raw input values submitted from the form into property values either on the action itself, or on an object/bean that the action makes available.

So instead of doing:

  value="%{'/jsp/'+#parameters.file[0]}"

You should probably be doing something like:

  In the form
  -----------
  <input type="foo" name="targetFileName" />

  In the Action
  -------------
  private String targetFilename
  public void setTargetFilename(tf){this.targetFilename = tf; }
  public String getTargetFilename(){retrun this.targetFilename; }

  In the View
  -----------
  value="%{'/jsp/' + targetFileName}"

The idea here is that you have an action property for the form field. As long as the names are the same (and you provide a setter) S2 will automatically get the value from the submitted form and get it into the action's property.

And as long as you have a getter, you can reference that value in the view by simply referencing the property name.

That way you don't deal with the fact that the raw request data is an array. S2 has done the translation for you from an array of Strings to a single string when it sets the property value.

- Gary

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

Reply via email to