Yes, I understand. But if you read my post, EVERYTHING works fine, but when I 
add namespace to package
in struts.xml (and in <s:form...) automatically "list" attribute of 
<s:select... doesn't recognize array anymore. I've tried
this many times and every time it works in the same way.

Here is excerpt of my code:

struts.xml:
--
<struts>
    <constant name="struts.objectFactory" value="spring" />
    <constant name="struts.devMode" value="true" />

<package name="administration" namespace="/administration" 
extends="struts-default">
        <action name="save" class="userAction" method="save">
            <result>/pages/administration/list.jsp</result>
            <result name="input">/pages/administration/list.jsp</result>
        </action>
</package>
<package name="register" namespace="/registers" extends="struts-default">
...
</struts>

UserAction.java:
--
public class UserAction extends ActionSupport implements Preparable {
 /**
  *
  */
 private static final long serialVersionUID = 7654885094460681178L;
 private UserService service;
 private List<User> users;
 private User user;
 private String username;
 private String [] allRoles;
 public UserAction(UserService service) {
  this.service = service;
 }
  public String execute() {
   users = service.findAllUsers();
   allRoles = service.getAllRoles(); <- this method works fine, it return an 
array of roles
 
         user = new User();
         return Action.SUCCESS;
     }
     
     public String save() {
      service.save(user);
     
      return execute();
 }
 
 public void prepare() throws Exception {
  if (username != null)
   if (!username.equals(""))
    user = servis.findUserByUsername(username);
 }
 
 public void setAllRoles(String [] allRoles) {
  this.allRoles = allRoles;
 }
 
 public String [] getAllRoles() {
  return allRoles;
 }
 
 // Other getters/setters
}

users.jsp:
--
<body>
...
<s:form action="save" namespace="/administration" validate="true" method="post">
 <s:textfield id="username" label="Username" name="user.username"/>
 <s:textfield id="password" label="Password" name="user.password"/>
 <s:select
  id = "roleChoose"
  label="Role"
  list="allRoles" <- THIS DOESN'T WORK WHEN I ADD NAMESPACE HERE IN FORM AND IN 
STRUTS.XML FOR CORRESPODING PACKAGE
  name="user.roles"
  emptyOption="false"
  value="user.roles"
  headerKey="None"
  multiple="true"/>
 <s:submit theme="ajax" value="Save" targets="users" notifyTopics="/save"/>
</s:form>
...
</body>

--
Thx in advance, Milan Milanovic

----- Original Message ----
From: Michael Gagnon <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Sent: Wednesday, April 16, 2008 3:38:38 PM
Subject: RE: Problem with Select tag

Can you show your struts xml, calling java action, and resulting jsp code?
I've noticed error messages like that whenever ANYTHING was wrong on a page
with a select box -- completely independent of anything to do with the
select box. So I think whatever you changed MAY have broken something else
and the message may be misleading you.

-----Original Message-----
From: Milan Milanovic [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 16, 2008 9:28 AM
To: Struts Users Mailing List
Subject: Re: Problem with Select tag

Nobody has an answer to this simple question ? 

As I asked, there is with select's tag "list" attribute, when namespace is
added to the package and to the form tag. It doesn't recognize given array
from the action class anymore. Do I miss something or this is a serious
error in Struts 2 ?

--
Thanks, Milan Milanovic



----- Original Message ----
From: Milan Milanovic <[EMAIL PROTECTED]>
To: user@struts.apache.org
Sent: Tuesday, April 15, 2008 11:21:37 PM
Subject: Problem with Select tag

Hi,

I'm using Struts 2.0.11.1, and I have wierd problem with select UI tag. It
works perfectly, but
when I added namespace to the package in struts.xml, which is used in form
where this select tag
is located, I get an error:

"tag 'select', field 'list', id 'roles', name 'user.roles': The requested
list key 'allRoles' could not be resolved as a
collection/array/map/enumeration/iterator type. Example: people or
people.{name} - [unkown location]"

I should note that I've added this namespace to the form tag too, where
select tag is located. 

How can I solve this problem ? It seems when namespace is added to package,
select's list attribute doesn't recognize correct value stack anymore.

___________________________
Thanks in advance, Milan Milanovic






____________________________________________________________________________
________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



____________________________________________________________________________
________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



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


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Reply via email to