[s2] SlashesInActionNames + wildcard mapping

2007-03-18 Thread zafer Mohamed
Hi There,

I have set the below property in my struts.properties

struts.enable.SlashesInActionNames = true

And in my struts.xml I have


  /view/{0}.jsp


Now when I try to access the url "/app/user/profile.zm/ where "app" is my 
namespace, I get the error

There is no Action mapped for action name user/profile. - [unknown location]

I have tried using "*/*" as wild card , but no luck. Is it a bug..?

Thanks
Zafer Mohamed




 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

Re: [s2] Autopopupation of fields fails with "enctype="multipart/form-data" in form

2007-02-04 Thread zafer Mohamed
Thanks Dariusz,

Adding the filter fixed the issue.

Z

- Original Message 
From: Dariusz Wojtas <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Sunday, February 4, 2007 1:20:02 PM
Subject: Re: [s2] Autopopupation of fields fails with 
"enctype="multipart/form-data" in form

Hi Zafer,

I would:

1) check the archives of this mailing list from the last 2 weeks,
there was a thread about fileupload issues (parameters are not always
set from such form). One of the hints was to use some magical filter
in front of the application. It is supposed to clear sth.

2) check if you have any custom filter in front of your action - the
multipart parser requires a 'virgin' request object, without accessing
any params in it prior to multiparse analysis. If you try to operate
on the request earlier - multiparser is not able to finish his task.

regards
Dariusz Wojtas

On 2/4/07, zafer Mohamed <[EMAIL PROTECTED]> wrote:
> I have a form with the enctype set to "enctype="multipart/form-data" as I am 
> uploading a file, the form also contains some other fields. On submission the 
> autopopulation of other fields fails, but it works correctly if I remove the 
> enctype="multipart/form-data". Any idea..?
>
> Thanks
> Zafer

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









 

Need Mail bonding?
Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users.
http://answers.yahoo.com/dir/?link=list&sid=396546091

[s2] Autopopupation of fields fails with "enctype="multipart/form-data" in form

2007-02-04 Thread zafer Mohamed
I have a form with the enctype set to "enctype="multipart/form-data" as I am 
uploading a file, the form also contains some other fields. On submission the 
autopopulation of other fields fails, but it works correctly if I remove the 
enctype="multipart/form-data". Any idea..?

Thanks
Zafer




 

Get your own web address.  
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL

Re: [S2] Re: Populating collection in struts 2 Action properties

2007-02-03 Thread zafer Mohamed
Thanks Dave,

Got it working atlast...!

Here is what I have, 

public class PersonAction extends ActionSupport {

private Person person;

public String execute() throws Exception {  return SUCCESS;   }

public Person getPerson() {return person;}
public void setPerson(Person person) { this.person = person; }
}

public class Person implements Serializable {
private String name;
private Integer age;

private List roles;
 
public void setName(String name) { this.name = name; }
public String getName() { return this.name; }

public void setAge(Integer age) { this.age = age; }
public Integer getAge() { return this.age; }
public List getRoles() { return roles; }
public void setRoles(List roles) { this.roles = roles; }
}

public class Role implements Serializable {
private String name;

public String getName() { return name;}
public void setName(String name) { this.name = name;}

}

Person-Conversion.properties [This should be in the same package as the Person 
class] with the below contents

CreateIfNull_roles=true
Element_roles=zm.junk.Role 

JSP is 



 
 

The key is the square brackets [] used for the index instead of the round 
ones...

Hope it helps others.

-Zafer   
- Original Message 
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Saturday, February 3, 2007 4:33:21 PM
Subject: Re: [S2] Re: Populating collection in struts 2 Action properties

--- zafer Mohamed <[EMAIL PROTECTED]> wrote:
> Initializing the collection also did not help. If
> possible can you please let me know what are the
> conversion-properties files u have and their
> location [should they be in the package of the class
> or in the classpath] and does it need any additional
> interceptor for this.

Oh, I missed your property file name/location.

The conversion files should be in the same package as
the *Action* class, and named
ActionName-conversion.properties, so if I have an
action called PersonInputAction then in the same
package I want a
PersonInputAction-conversion.properties. Conversions
are tied to Actions, not types.

The defaultStack of interceptors should work fine.

d.



 

The fish are biting. 
Get more visitors on your site using Yahoo! Search Marketing.
http://searchmarketing.yahoo.com/arp/sponsoredsearch_v2.php

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








 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

Re: will validation include custom error tag in the next releases?

2007-02-03 Thread zafer Mohamed
You should be able to do this, be writing your own theme. Look in the 
struts2-core-2.0.1.jar, all the themes are in "templates" folder, use them as 
reference. You should know freemarker to do this, but I should be easy..

Zafer

- Original Message 
From: Struts2 Fan <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Saturday, February 3, 2007 5:20:50 PM
Subject: will validation include custom error tag in the next releases?

Hi all,

I really don't like the position of the validation messages. And I
want to use theme="simple" tags always.
So I wonder if we can have the opportunity to have a validation
message such below.





I want to define a validation for Age field as it is an example on the site.
But if it is an invalid field I want the "ageerror" div to be visible
and if not invisible.

will there be such an option for validation?

If not, please show me a way where to start making such an
implementation :) Because i really want the validation messages
be this way.

Thanks all,







 

Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html 

Re: [S2] Re: Populating collection in struts 2 Action properties

2007-02-03 Thread zafer Mohamed
Thanks Dave,

Initializing the collection also did not help. If possible can you please let 
me know what are the conversion-properties files u have and their location 
[should they be in the package of the class or in the classpath] and does it 
need any additional interceptor for this.

Zafer

- Original Message 
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Saturday, February 3, 2007 3:38:03 PM
Subject: Re: [S2] Re: Populating collection in struts 2 Action properties

--- zafer Mohamed <[EMAIL PROTECTED]> wrote:
> I have Person-conversion.properties in the "zm.junk"
> package. It is the same package where I have the
> Person and Role class
> CreateIfNull_roles=true
> Element_roles=zm.junk.Role
> 
> And as for the other question I do not have the
> roles initialized.

Try having roles be initialized to an empty
collection, at least as a sanity check. All my
collections exist, they're just empty, and I have
gotten the type conversion working quite well with
fairly complex object graphs.

AFAICT the type conversion stuff will create objects
for you, but it will not create a collection to put
them in? (Not sure about that, but I know it works for
me if the collections are there but empty).

Dave



 

Food fight? Enjoy some healthy debate 
in the Yahoo! Answers Food & Drink Q&A.
http://answers.yahoo.com/dir/?link=list&sid=396545367

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








 

It's here! Your new message!  
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/

Re: [S2] Re: Populating collection in struts 2 Action properties

2007-02-03 Thread zafer Mohamed
Hi Dave,

I am getting the below errors

15:18:15,192 ERROR [xwork2.util.XWorkMethodAccessor] An unexpected exception 
occurred
ognl.OgnlException: Error getting property descriptor: null
at 
com.opensymphony.xwork2.util.XWorkCollectionPropertyAccessor.getProperty(XWorkCollectionPropertyAccessor.java:92)
at 
com.opensymphony.xwork2.util.XWorkMethodAccessor.callMethod(XWorkMethodAccessor.java:61)
at ognl.OgnlRuntime.callMethod(OgnlRuntime.java:819)


at java.lang.Thread.run(Thread.java:595)
15:18:15,202 ERROR [xwork2.util.OgnlValueStack] Error setting expr 
'person.roles(0).name' with value '[Ljava.lang.String;@1e001c8'
ognl.OgnlException: target is null for setProperty(null, "name", 
[Ljava.lang.String;@1e001c8)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1624)


I have Person-conversion.properties in the "zm.junk" package. It is the same 
package where I have the Person and Role class
CreateIfNull_roles=true
Element_roles=zm.junk.Role

And as for the other question I do not have the roles initialized.

Thanks
Zafer 

- Original Message 
From: Dave Newton <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Saturday, February 3, 2007 1:24:58 PM
Subject: [S2] Re: Populating collection in struts 2 Action properties

--- zafer Mohamed <[EMAIL PROTECTED]> wrote:
> I am struggling to populate a collection in the
> struts action's attribute. 

You neglect to say what the problem actually is, so
helping is... tricky.

>  name="person.roles(0).name" />

As prev. poster said use [0], but this will only work
if you've actually initialize the Person's list of
Roles. Have you? There shouldn't be an issue with what
you're doing, and you do not need indexed get/sets in
S2. (Yaaay, S2/WW!)

d.



 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

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








 

8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

Re: Populating collection in struts 2 Action properties

2007-02-03 Thread zafer Mohamed
Hi Saul,

I tried as u said, but still getting error. I get the below error

15:10:57,583 ERROR [xwork2.util.OgnlValueStack] Error setting expr 
'person.roles[0].name' with value '[Ljava.lang.String;@121f4ef'
ognl.NoSuchPropertyException: zm.junk.Person.roles

I also added Person-conversion.properties with the below entries
CreateIfNull_roles=true
Element_roles=zm.junk.Role

Zafer
- Original Message 
From: Saul Qunming Yuan <[EMAIL PROTECTED]>
To: Struts Users Mailing List 
Sent: Saturday, February 3, 2007 1:14:43 PM
Subject: Re: Populating collection in struts 2 Action properties

Hi,

You may want to try the following:

1. add index-based getter and setter to your Person bean class, i.e.

public Role getRoles(int i) {
return (Role) getRoles().get(i);
}

public void setRoles(int i, Role role) {
getRoles().set(i, role);
}

2. use [0] rather than (0) for your name field, i.e




I didn't test it myself, so try it at your own risk :-)


Saul


zafer Mohamed wrote:
> I am struggling to populate a collection in the struts action's attribute. My 
> scenario is similiar to below
>
> public class PersonAction extends ActionSupport {
>
>  
>
> private Person person;
>
> public void setPerson(Person 
> person){  this.person = person}
> public Person getPerson(){  return person}
>  
>
>  public String submit() throws Exception {
>
>   return SUCCESS;
>
>  }
>
> }
>
>
> And my Person class is 
>
> public class Person
> {
> private List roles;
> public List getRoles() { return roles; }
>
> public void setRoles(List roles) { this.roles = roles; }
>
> }
>
> And from my JSP I am trying to populate as below
>
> 
>
> If someone has a working scenario like this, please send me the todo's to get 
> it working. I have searched the webwork forms and tried most the tricks 
> mentioned there with no luck.
>
> Thanks
> Zafer
>
>
>
>
>  
> 
> Sucker-punch spam with award-winning protection. 
> Try the free Yahoo! Mail Beta.
> http://advision.webevents.yahoo.com/mailbeta/features_spam.html
> 
> Spam/Virus scanning by CanIt Pro
>
> For more information see
> http://www.kgbinternet.com/SpamFilter.htm
>
> To control your spam filter, log in at
> http://filter.kgbinternet.com
>
>
>   


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








 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

Populating collection in struts 2 Action properties

2007-02-03 Thread zafer Mohamed
I am struggling to populate a collection in the struts action's attribute. My 
scenario is similiar to below

public class PersonAction extends ActionSupport {

 

private Person person;

public void setPerson(Person 
person){  this.person = person}
public Person getPerson(){  return person}
 

 public String submit() throws Exception {

  return SUCCESS;

 }

}


And my Person class is 

public class Person
{
private List roles;
public List getRoles() { return roles; }

public void setRoles(List roles) { this.roles = roles; }

}

And from my JSP I am trying to populate as below



If someone has a working scenario like this, please send me the todo's to get 
it working. I have searched the webwork forms and tried most the tricks 
mentioned there with no luck.

Thanks
Zafer




 

Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html