Re: Xml based form validation not working

2010-04-20 Thread Lukasz Lenart
2010/4/19 Kartik Kumar krishnan.1...@gmail.com:
    action name=action_item_search
 class=gov.nasa.spacebook.ActionItemTrackingAction
 method=fetchByCriteria

XML file must have exactly the same name as action Class and method name, so

ActionItemTrackingAction-fetchByCriteria-validation.xml and must be in
the same package as action class.


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Counter question

2010-04-20 Thread Ganesh
Hello all,

I have a integer value and i have to show that many number of images. Could any 
one help me how to use the Counter tag.

Regards
Ganesh
Send instant messages to your online friends http://in.messenger.yahoo.com

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Custom types and select lists

2010-04-20 Thread Alex Rodriguez Lopez
How I do it with selects is having getter/setter for whatever you write 
in name= (in your case campus) as type Long (should be ListLong if 
select is multiple). In prepare() you put in campus the campus id of the 
campus that should be preselected (the one acording to the student id, 
right?), and when the select is displayed it should show the 
pre-selected campus. After, when the form is submited, you get the 
selected campus id back in the action with the getter for campus and 
do whatever you want with it (e.g. update student info).


I don't know if there is a more correct way to do things, but this way 
you don't need custom converters.


I believe, by the type of your error, you could still use that converter 
maybe just switching things from String to Long.


Regards.

Alex

Em 19-04-2010 15:38, Lance Hill escreveu:

I  am trying to find an example of how to populate a select list of objects,
show the correct item as selected, and if the selection is saved, properly
update the object containing the item. In the example below, I would want to
show a group of fields for Student information with a select list of
Campuses. If the Student is already stored with a specific Campus, that
should be selected. If the selection choice is changed, saving the Student
should update what Campus object is contained by the Student.



I have a custom TypeConverter  to convert between the Campus id string and
Campus objects and I can see the conversion code executes fine.
Unfortunately, saving a selection results in an invalid field value for
field 'campus' error and when I first call up the page, the selected Campus
is not the correct one.





public class Student {



   private Campus campus;



   public Campus getCampus() {return campus; }

   public void setCampus(Campus campus) {this.campus = campus; }

}



public class Campus {



   private Long id;

private String name;



   public Long getId() {return name; }

   public void setId(Long id) {this.id = id; )

   public String getName() {return name; }

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

}



public class StudentAction extends ActionSupport implements ModelDriven,
Preparable {



protected Object model;

private Student student;

   private Campus campus;

private ListCampus  campusList;

   private DB db;

   private long id;



   public void prepare() throws Exception {

 campusList = db.findAllCampuses();

 if (getId() == 0) {

student = db.createNewStudent();

 } else {

student = db.findByStudentId(getId());

 }

   }



   public String save() {

   try {

   db.save(getModel());

 } catch (Exception e) {

   return ERROR;

 }

   return SUCCESS;

 }

   public Student getModel() {return student; }

public long getId() {return id; }

public void getId() {return id; }



}



public class CampusConverter extends StrutsTypeConverter {



private DB db;



   public Object convertFromString(Map context, String[] values, Class
toClass) {

   Campus campus = null;

 if (values != null  values.length  0  values[0] != null
values[0].length()  0) {

 campus = db.findCampusById(new Long(values[0]));

 }

 return campus;

   }

   public String convertToString(Map context, Object o) {

 if (o instanceof Campus) {

 return ((Campus)o).getId().toString();

 }

 return ;

   }

}



body

   s:form action=student_save method=post

 s:select name=campus list=campusList listValue=name
listKey=id label=%{getText('label.campus')} /

 s:hidden name=id value=%{id} /

 s:submit value=%{getText('button.label.submit')}/

   /s:form

/body



Suggestions, corrections, pointers, or links to examples/tutorials of how to
do this properly would be greatly appreciated.





Regards,

Lance Hill





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Convention Plugin not being picked up.

2010-04-20 Thread jonathan doklovic

I would also look at your struts config for the following:

struts.convention.default.parent.package - should be the name of your 
default package declared in the config


struts.convention.action.includeJars - if your actions are in separate 
jars, you may need to add a pattern here so convention will scan them


- Jonathan

Miles, Chris wrote:
  



Hi,

I am using the convention plugin, not the older codebehind plugin. The
convention plugin exists in my lib directory. I am calling actions by

/namespace/actionName.action

Thanks

Chris

  

Good Afternoon Chris

best to look at the usage of the code behind plugin 
http://struts.apache.org/2.1.6/docs/codebehind-plugin.html


a few fundamentals:
did you copy the codebehind jar to WEB-INF/lib?
is your Action mapping adhering to the convention of
/NAMESPACE/ACTION.(jsp|vm|ftl)



  
I am using Glassfish 2.1 and deploying my application with the 
convention plugin, but none of my annotations are being processed 
which leads me to believe that the plugin is not being loaded. There 
is nothing in the server logs mentioning any messages or errors. The 
config browser plugin tells me anything I define in a config file, but



  

not through annotations.



  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: STRUTS2 + REST + SPRING Problem

2010-04-20 Thread jonathan doklovic

Are you using the struts-spring plugin?

If so, I found I had to include:
struts.objectFactory.spring.autoWire = name
struts.objectFactory.spring.autoWire.alwaysRespect = true

to get beans autowired by name.  autowiring using auto or type wasn't 
working in my app so I had to do it by name.


- Jonathan


mailtolouis2020-str...@yahoo.com wrote:

Hi All,
 
Our requirement is use to use STRUTS + REST + SPRING.
 
We are stuck with the below problem:
 
Rest controllers are not able to autowire the spring beans. So i am not able to inject the spring beans to the rest controllers that are created using convention plugin.
 
1) We configured the struts configuration as below:
 



bean type=org.apache.struts2.dispatcher.mapper.ActionMapper name=myMapper 
class=com.xxx.mapper.Struts2RestMapper /

constant name=struts.mapper.class value=myMapper/

constant name=struts.convention.action.suffix value=Controller/

constant name=struts.convention.action.mapAllMatches value=true/

constant name=struts.convention.default.parent.package value=rest-default/

constant name=struts.convention.package.locators value=rest/
2) Struts2RestMapper is a custom ActionMapper to invoke the struts mapper or 
Rest mapper based on the request url. This is working fine however, rest 
controller is not working correctly due to failed dependencies.
 
3) Rest controller is pasted below.


@Results
({

@Result(name=success, type=redirectAction, params = {actionName , 
userrest})

})

public
class UserrestController extends ValidationAwareSupport implements 
ModelDrivenObject, Validateable {

private UserDetails user = null;

private String userSignInId;

@Autowired

private UserDetailsService userService;

public void validate() {

//if (user.getClientName() == null || model.getClientName().length() ==0) {

// addFieldError(clientName, The client name is empty);

//}

System.
out.println(validate Method invoked);

}

// GET /userrest

public HttpHeaders index() {

//list = messagesService.getAll();

System.
out.println(Index method invoked);

return new DefaultHttpHeaders(index).disableCaching();

}

public Object getModel() {

return user;

}

// GET /userrest/1

public HttpHeaders show() {

System.
out.println(show Method invoked);

return new DefaultHttpHeaders(show);

}

public void setId(String id) {

System.
out.println(setID Method invoked);

if (id != null) {

this.user = userService.loadUserByUsername(id);

}

this.userSignInId = id;

}

}

Please can some one guide me on how to get the rest controller to pick the 
spring beans (ie., userService in the above example) correctly.

Kind Regards

LV
  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Convention Plugin not being picked up.

2010-04-20 Thread Miles, Chris
NOT PROTECTIVELY MARKED



Hi,

Thanks. My config only contains

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration
2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
package name=checkout extends=struts-default
namespace=/actions/ /struts

My actions are contained within the WAR file within the EAR. No JARs in
place. There is nothing in the setup documentation about setting the
package property?

Chris

-Original Message-
From: jonathan doklovic [mailto:list-rea...@sysbliss.com]
Sent: 20 April 2010 15:48
To: Struts Users Mailing List
Subject: Re: Convention Plugin not being picked up.

I would also look at your struts config for the following:

struts.convention.default.parent.package - should be the name of your
default package declared in the config

struts.convention.action.includeJars - if your actions are in separate
jars, you may need to add a pattern here so convention will scan them

- Jonathan

Miles, Chris wrote:
   


 Hi,

 I am using the convention plugin, not the older codebehind plugin. The

 convention plugin exists in my lib directory. I am calling actions by

 /namespace/actionName.action

 Thanks

 Chris

   
 Good Afternoon Chris

 best to look at the usage of the code behind plugin 
 http://struts.apache.org/2.1.6/docs/codebehind-plugin.html

 a few fundamentals:
 did you copy the codebehind jar to WEB-INF/lib?
 is your Action mapping adhering to the convention of
 /NAMESPACE/ACTION.(jsp|vm|ftl)
 

   
 I am using Glassfish 2.1 and deploying my application with the 
 convention plugin, but none of my annotations are being processed 
 which leads me to believe that the plugin is not being loaded. There 
 is nothing in the server logs mentioning any messages or errors. The 
 config browser plugin tells me anything I define in a config file, 
 but
 

   
 not through annotations.
 

   


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org

   


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


NOT PROTECTIVELY MARKED


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Counter question

2010-04-20 Thread Dale Newfield

On 4/20/10 5:21 AM, Ganesh wrote:

I have a integer value and i have to show that many number of images.
Could any one help me how to use the Counter tag.


More recent struts2 versions have more useful iterator use cases, so now 
you can just use begin, end, and step 
http://struts.apache.org/2.x/docs/iterator.html


If you're using 2.0 for some reason you can use an OGNL trick to get the 
result you're after: 
http://www.opensymphony.com/ognl/html/LanguageGuide/coerceCollection.html 
says Members of java.lang.Number are walked by returning integers 
less than the given number starting with zero


So if you have an OGNL expression %{#foo} that contains/results in the 
value 7, then the OGNL expression %{#foo.{#this}} will result in the 
list {0, 1, 2, 3, 4, 5, 6} over which you can iterate.


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Using json in Struts 2.1.8.1

2010-04-20 Thread Dale Newfield

On 4/19/10 2:14 PM, sharath karnati wrote:

Can you please send me sample example using AJAX in struts 2.1.8, where
action method returns json list to a page.


Trying to catch up from being out of town all weekend (and Monday), so 
I'm just going to throw some results of searching google at you:


http://www.codeweblog.com/struts-2-in-the-use-of-json-ajax-support/
http://www.gmjjavadesigns.com/gmjd/entry/struts_2_x_and_json

-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Convention Plugin not being picked up.

2010-04-20 Thread jonathan doklovic

Try setting struts.convention.default.parent.package = checkout

The constant is documented under XWork in the convention plugin docs:
http://struts.apache.org/2.1.8.1/docs/convention-plugin.html#ConventionPlugin-XWorkpackages

Also, are your action classes in a package *.action.*?
They must be in a package path that contains struts, struts2, action, or 
actions as documented here:

http://struts.apache.org/2.1.8.1/docs/convention-plugin.html#ConventionPlugin-Codebehindhelloworld


- Jonathan


Miles, Chris wrote:

NOT PROTECTIVELY MARKED



Hi,

Thanks. My config only contains

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration
2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
package name=checkout extends=struts-default
namespace=/actions/ /struts

My actions are contained within the WAR file within the EAR. No JARs in
place. There is nothing in the setup documentation about setting the
package property?

Chris

-Original Message-
From: jonathan doklovic [mailto:list-rea...@sysbliss.com]
Sent: 20 April 2010 15:48
To: Struts Users Mailing List
Subject: Re: Convention Plugin not being picked up.

I would also look at your struts config for the following:

struts.convention.default.parent.package - should be the name of your
default package declared in the config

struts.convention.action.includeJars - if your actions are in separate
jars, you may need to add a pattern here so convention will scan them

- Jonathan

Miles, Chris wrote:
  
  



Hi,

I am using the convention plugin, not the older codebehind plugin. The



  

convention plugin exists in my lib directory. I am calling actions by

/namespace/actionName.action

Thanks

Chris

  


Good Afternoon Chris

best to look at the usage of the code behind plugin 
http://struts.apache.org/2.1.6/docs/codebehind-plugin.html


a few fundamentals:
did you copy the codebehind jar to WEB-INF/lib?
is your Action mapping adhering to the convention of
/NAMESPACE/ACTION.(jsp|vm|ftl)

  
  

I am using Glassfish 2.1 and deploying my application with the 
convention plugin, but none of my annotations are being processed 
which leads me to believe that the plugin is not being loaded. There 
is nothing in the server logs mentioning any messages or errors. The 
config browser plugin tells me anything I define in a config file, 
but

  
  


not through annotations.

  
  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

  




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


NOT PROTECTIVELY MARKED


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Using json in Struts 2.1.8.1

2010-04-20 Thread sharath karnati
Hi All,
 
   Added below lines in struts.xml file
 
 
package name=admin extends=struts-default,json-default  
result-types
   result-type name=json class=org.apache.struts2.json.JSONResult /
/result-types
 
action name=Autocomplete!* class=gov.admin.action.ManageAction 
method={1}
  result type=jsonparam name=rootjson/param/result

/action 

 
/package
 
Added following lines .jsp file
 
bSearch JSON:nbsp;/b
s:url id=url action=Autocomplete method=getNames /

sx:autocompleter href=%{url} loadOnTextChange=true loadMinimumCount=3 /
 
 
even included %@ taglib prefix=sx uri=/struts-dojo-tags% and 
head
sx:head /
/head
 
When it builds the page it is showing below lines
 
input dojoType=struts:ComboBox  
dataUrl=/admin/Autocomplete!getNames.action id=manageForm_ 
keyName=nullKey loadOnType=true loadMinimum=3 visibleDownArrow=true /
script language=JavaScript 
type=text/javascriptdjConfig.searchIds.push(manageForm_);/script
 
after entering 3 or more characters it supposed to invoke 'getNames' method but 
it is not even starting invocation of this method
 
Can anyone please let me know where I'm wrong.
 
Thanks in advance.
 
Regards,
Sharath.
 

 
 
 
 
 


--- On Fri, 4/16/10, Dale Newfield d...@newfield.org wrote:


From: Dale Newfield d...@newfield.org
Subject: Re: Using json in Struts 2.1.8.1
To: Struts Users Mailing List user@struts.apache.org
Date: Friday, April 16, 2010, 10:39 AM


 package name=package_name extends=struts-default
 namespace=/namespace_name
         result-types
             result-type name=json 
class=com.googlecode.jsonplugin.JSONResult /
         /result-types

Or just

package name=package-name extends=json-default

-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




  

Code examples gone from wiki

2010-04-20 Thread jonathan doklovic

I've noticed that in the 2.1.8.1 wiki docs, all the code snippets are blank.
They seem to be ok in the 2.1.6 docs.

are the 2.1.8.1 docs using a different confluence code plugin or something?

- Jonathan

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Using json in Struts 2.1.8.1

2010-04-20 Thread Frans Thamura
hi all

just want to share

can we make Struts2 become like a SOA Middlerware, using JSON, so we can use
like mule, the plugins become transfport

is it possible?


-- 
Frans Thamura
Meruvian.
Experiential Tempation of Java and Enterprise OpenSource

Meruvian jTechnopreneur Program (S1) telah hadir, Dapatkan benefit bagi SMK
yang melakukan mapping SKKD, dg program beasiswa dari Gunadarma

Mobile: +6287885901958
Blog  Profile: http://frans.thamura.info

We provide services to migrate your apps to Java (web), in amazing fast and
reliable.


On Tue, Apr 20, 2010 at 10:34 PM, sharath karnati karna...@yahoo.comwrote:

 Hi All,

Added below lines in struts.xml file


 package name=admin extends=struts-default,json-default
 result-types
result-type name=json class=org.apache.struts2.json.JSONResult
 /
 /result-types

 action name=Autocomplete!* class=gov.admin.action.ManageAction
 method={1}
   result type=jsonparam name=rootjson/param/result

 /action


 /package

 Added following lines .jsp file

 bSearch JSON: /b
 s:url id=url action=Autocomplete method=getNames /

 sx:autocompleter href=%{url} loadOnTextChange=true
 loadMinimumCount=3 /


 even included %@ taglib prefix=sx uri=/struts-dojo-tags% and
 head
 sx:head /
 /head

 When it builds the page it is showing below lines

 input dojoType=struts:ComboBox
 dataUrl=/admin/Autocomplete!getNames.action id=manageForm_
 keyName=nullKey loadOnType=true loadMinimum=3 visibleDownArrow=true
 /
 script language=JavaScript
 type=text/javascriptdjConfig.searchIds.push(manageForm_);/script

 after entering 3 or more characters it supposed to invoke 'getNames' method
 but it is not even starting invocation of this method

 Can anyone please let me know where I'm wrong.

 Thanks in advance.

 Regards,
 Sharath.









 --- On Fri, 4/16/10, Dale Newfield d...@newfield.org wrote:


 From: Dale Newfield d...@newfield.org
 Subject: Re: Using json in Struts 2.1.8.1
 To: Struts Users Mailing List user@struts.apache.org
 Date: Friday, April 16, 2010, 10:39 AM


  package name=package_name extends=struts-default
  namespace=/namespace_name
  result-types
  result-type name=json
 class=com.googlecode.jsonplugin.JSONResult /
  /result-types

 Or just

 package name=package-name extends=json-default

 -Dale

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org








Re: Convention Plugin not being picked up.

2010-04-20 Thread jonathan doklovic

Also, you can add:

log4j.category.org.apache.struts2.convention=TRACE

to your log4j.properties to get exhaustive logging about convention 
wiring up actions.


- Jonathan

Miles, Chris wrote:

NOT PROTECTIVELY MARKED



Hi,

Thanks. My config only contains

?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration
2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
package name=checkout extends=struts-default
namespace=/actions/ /struts

My actions are contained within the WAR file within the EAR. No JARs in
place. There is nothing in the setup documentation about setting the
package property?

Chris

-Original Message-
From: jonathan doklovic [mailto:list-rea...@sysbliss.com]
Sent: 20 April 2010 15:48
To: Struts Users Mailing List
Subject: Re: Convention Plugin not being picked up.

I would also look at your struts config for the following:

struts.convention.default.parent.package - should be the name of your
default package declared in the config

struts.convention.action.includeJars - if your actions are in separate
jars, you may need to add a pattern here so convention will scan them

- Jonathan

Miles, Chris wrote:
  
  



Hi,

I am using the convention plugin, not the older codebehind plugin. The



  

convention plugin exists in my lib directory. I am calling actions by

/namespace/actionName.action

Thanks

Chris

  


Good Afternoon Chris

best to look at the usage of the code behind plugin 
http://struts.apache.org/2.1.6/docs/codebehind-plugin.html


a few fundamentals:
did you copy the codebehind jar to WEB-INF/lib?
is your Action mapping adhering to the convention of
/NAMESPACE/ACTION.(jsp|vm|ftl)

  
  

I am using Glassfish 2.1 and deploying my application with the 
convention plugin, but none of my annotations are being processed 
which leads me to believe that the plugin is not being loaded. There 
is nothing in the server logs mentioning any messages or errors. The 
config browser plugin tells me anything I define in a config file, 
but

  
  


not through annotations.

  
  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

  




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


NOT PROTECTIVELY MARKED


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

  



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: programatically add configuration

2010-04-20 Thread Bhaarat Sharma
Is this not possible to do ?

can we not programmaitcally add/load struts.xml into the instance?

On Mon, Apr 19, 2010 at 2:48 PM, Bhaarat Sharma bhaara...@gmail.com wrote:

 ConfigurationManager (
 http://struts.apache.org/2.0.11.1/struts2-core/apidocs/com/opensymphony/xwork2/config/ConfigurationManager.html)
 API provides a reload method that will reload the configuration settings.

 There is also a setConfiguration(Configuration configuration) method in
 there.  Can this method be used to explicitly load the struts.xml file??

 The implementing class for Configuration is DefaultConfiguration (
 http://struts.apache.org/2.0.11.1/struts2-core/apidocs/com/opensymphony/xwork2/config/impl/DefaultConfiguration.html
 )

 I can't figure out how to explicitly load all the configurations that are
 in struts.xml.

 I want to do this because sometimes intermittently we notice that we get
 action name not found errors.  At that point we'd like to explicitly load
 the struts.xml file.

 Can someone assist in this?



Re: Using json in Struts 2.1.8.1

2010-04-20 Thread Dale Newfield

On 4/20/10 11:34 AM, sharath karnati wrote:

package name=admin extends=struts-default,json-default
result-types
result-type name=json class=org.apache.struts2.json.JSONResult /
/result-types


json-default extends struts-default, so no reason do list both (and I 
don't even know if that works).
json-default defines the result type json, so no reason to redefine it 
again.



action name=Autocomplete!* class=gov.admin.action.ManageAction 
method={1}
   result type=jsonparam name=rootjson/param/result

/action


I don't know if action names can include !.  Do you have 
struts.enable.DynamicMethodInvocation set to false and you're trying to 
emulate that behavior here?



input dojoType=struts:ComboBox
dataUrl=/admin/Autocomplete!getNames.action id=manageForm_
keyName=nullKey loadOnType=true loadMinimum=3
visibleDownArrow=true /
script language=JavaScript
type=text/javascriptdjConfig.searchIds.push(manageForm_);/script



after entering 3 or more characters it supposed to invoke 'getNames' method but 
it is not even starting invocation of this method


Sounds like you're having problems not with json but with dojo.  Note, 
the dojo plugin is old and deprecated.  I cannot help there.  Javascript 
errors on your page might be preventing other javascript from running. 
For debugging js I'd suggest the firebug plugin to firefox.


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Using json in Struts 2.1.8.1

2010-04-20 Thread sharath karnati
Hi Dale,
 
    Tried all the changes which you mentioned like keeping only 'json-default' 
and removing 'json' from result type but facing same problem...
 
   In struts.properties file having below line    
    struts.enable.DynamicMethodInvocation = true
 
  I'm using 'struts2-dojo-plugin-2.1.8.1.jar' plugin for doing AJAX, and you 
mentioned that dojo is deprecated.  Can you please tell me how to do AJAX in 
struts2.1.8?? what components(similar to dojo) we need to use to get AJAX 
functionality.
 
  Thanks for your help.
 
Regards,
Sharath.
   

--- On Tue, 4/20/10, Dale Newfield d...@newfield.org wrote:


From: Dale Newfield d...@newfield.org
Subject: Re: Using json in Struts 2.1.8.1
To: Struts Users Mailing List user@struts.apache.org
Date: Tuesday, April 20, 2010, 12:28 PM


On 4/20/10 11:34 AM, sharath karnati wrote:
 package name=admin extends=struts-default,json-default
 result-types
         result-type name=json class=org.apache.struts2.json.JSONResult /
 /result-types

json-default extends struts-default, so no reason do list both (and I don't 
even know if that works).
json-default defines the result type json, so no reason to redefine it again.

 action name=Autocomplete!* class=gov.admin.action.ManageAction 
 method={1}
            result type=jsonparam name=rootjson/param/result
 
 /action

I don't know if action names can include !.  Do you have 
struts.enable.DynamicMethodInvocation set to false and you're trying to emulate 
that behavior here?

 input dojoType=struts:ComboBox
 dataUrl=/admin/Autocomplete!getNames.action id=manageForm_
 keyName=nullKey loadOnType=true loadMinimum=3
 visibleDownArrow=true /
 script language=JavaScript
 type=text/javascriptdjConfig.searchIds.push(manageForm_);/script

 after entering 3 or more characters it supposed to invoke 'getNames' method 
 but it is not even starting invocation of this method

Sounds like you're having problems not with json but with dojo.  Note, the dojo 
plugin is old and deprecated.  I cannot help there.  Javascript errors on your 
page might be preventing other javascript from running. For debugging js I'd 
suggest the firebug plugin to firefox.

-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




  

Re: Using json in Struts 2.1.8.1

2010-04-20 Thread Dale Newfield

On 4/20/10 2:11 PM, sharath karnati wrote:

but facing same problem...


Because your problem doesn't appear to be a server-side one, but rather 
what's going on inside the browser.



In struts.properties file having below line
*struts.enable.DynamicMethodInvocation = **true*


If that's true, then your action configuration including the ! character 
may or may not work as you intend, as dynamic method invocation 
effectively does the same thing as your wildcarding there.



I'm using 'struts2-dojo-plugin-2.1.8.1.jar' plugin for doing AJAX, and
you mentioned that dojo is deprecated. Can you please tell me how to do
AJAX in struts2.1.8?? what components(similar to dojo) we need to use to
get AJAX functionality.


AJAX libraries run in the browser.  Struts2 runs on the server.  They're 
really orthogonal.  I'd advise picking a javascript library that you can 
get your head around and learning to use it separately from struts, then 
understanding the few small areas where requests sent/results parsed to 
understand how that'll work with a struts-based server.


DOJO (at least the ancient version in the struts plugin) is dog slow in 
the browser, so I'd avoid it if possible.  My current project is based 
on the prototype/scriptaculous libraries, but I've heard/seen good 
things regarding jquery.  Assuming that has components that do 
asynchronous requests, I'd look at jquery.


http://www.zulutown.com/blog/2009/07/12/ajax-dynamic-content-with-struts2-jquery-and-json-plugin/ 
details one example of doing this with jquery directly.


If that's all too much for you to figure out, I believe there is an 
effort at a jquery plugin (basically a sj taglib) that might be able to 
help you.  I had thought there was an effort to put that in the sandbox 
or even support it as part of the normal struts distribution, but I 
don't recall.  It appears that this plugin resides at: 
http://code.google.com/p/struts2-jquery/

not sure what relationship this one has to the former:
http://code.google.com/p/struts2-jquery-plugin/

All that said, if you just want to push forward with the deprecated dojo 
plugin, I'll again suggest using firebug within firefox to track down 
what's going wrong in the browser.


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Setter in action triggers twice. Bug?

2010-04-20 Thread Lukasz Lenart
2010/4/20 Francisco José Aquino García fj.aqu...@gmail.com:
 Where are the sources for xwork-core-2.1.6 then?

Here you have the latest version
svn.apache.org/viewvc/struts/struts2/trunk/

The old can be found here
http://svn.opensymphony.com/fisheye/browse/xwork


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



no action mapped for namespace

2010-04-20 Thread Bhaarat Sharma
in struts2 is there a way to detect when No action mapped for namespace
... error will come up??

What I mean is that can we write an if condition that checks whether or not
the the action name exists in struts.xml?

we can get the action name by: ActionContext.getInstance().getName()

So if the above line of code returns an action name...can it
be guaranteed that we will not get No action mapped for namespace...?

Thanks


Re: no action mapped for namespace

2010-04-20 Thread Luis Martín Canaval Sánchez
I am not an expert but what I would do for this is create an action with a
wildcard that should work like a default option in a switch/select case.

something like

action name=first class=go
  resultgo.jsp/result
/action
action name=second class=go2
  resultgo2.jsp/result
/action
!-- several actions later --
action name=* class=NoActionMappedAction
  resultNoActionMappedGO.jsp/result
/action
On Tue, Apr 20, 2010 at 15:19, Bhaarat Sharma bhaara...@gmail.com wrote:

 in struts2 is there a way to detect when No action mapped for namespace
 ... error will come up??

 What I mean is that can we write an if condition that checks whether or not
 the the action name exists in struts.xml?

 we can get the action name by: ActionContext.getInstance().getName()

 So if the above line of code returns an action name...can it
 be guaranteed that we will not get No action mapped for namespace...?

 Thanks




-- 
Ing. Luis Martín Canaval Sánchez
Keep it small and simple.


RE: no action mapped for namespace

2010-04-20 Thread Martin Gainty

populated by the ActionTag populateParams()
protected void populateParams() {
super.populateParams();
ActionComponent action = (ActionComponent) component;
action.setName(name);
action.setNamespace(namespace);

so in the case of this declaration
package name=actionTag extends=struts-default 
namespace=/tags/non-ui/actionTag

ActionContext.getContext().get(ACTION_MAPPING).getNamespace()
will yield
/tags/non-ui/actionTag

hth
Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Tue, 20 Apr 2010 16:19:39 -0400
 Subject: no action mapped for namespace
 From: bhaara...@gmail.com
 To: user@struts.apache.org
 
 in struts2 is there a way to detect when No action mapped for namespace
 ... error will come up??
 
 What I mean is that can we write an if condition that checks whether or not
 the the action name exists in struts.xml?
 
 we can get the action name by: ActionContext.getInstance().getName()
 
 So if the above line of code returns an action name...can it
 be guaranteed that we will not get No action mapped for namespace...?
 
 Thanks
  
_
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

Re: no action mapped for namespace

2010-04-20 Thread Bhaarat Sharma
@Luis: I don't think I understand what you are trying to do from that
example...how  will that help? I am trying to find out that if
ActionContext.getInstance().getName() returns an action name say test and
that is infact the action we want to land on...can it be So if the above
line of code returns an action name...can it be guaranteed that we will not
get No action mapped for namespace...?

@Martin: I don't understand where component comes from in your example.
 which super.populateParams() is your method pointing to? I am lost


On Tue, Apr 20, 2010 at 7:49 PM, Martin Gainty mgai...@hotmail.com wrote:


 populated by the ActionTag populateParams()
protected void populateParams() {
super.populateParams();
ActionComponent action = (ActionComponent) component;
action.setName(name);
action.setNamespace(namespace);

 so in the case of this declaration
 package name=actionTag extends=struts-default
 namespace=/tags/non-ui/actionTag

 ActionContext.getContext().get(ACTION_MAPPING).getNamespace()
 will yield
 /tags/non-ui/actionTag

 hth
 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
 Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
 Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
 dient lediglich dem Austausch von Informationen und entfaltet keine
 rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
 E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
 destinataire prévu, nous te demandons avec bonté que pour satisfaire
 informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
 de ceci est interdite. Ce message sert à l'information seulement et n'aura
 pas n'importe quel effet légalement obligatoire. Étant donné que les email
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
 aucune responsabilité pour le contenu fourni.




  Date: Tue, 20 Apr 2010 16:19:39 -0400
  Subject: no action mapped for namespace
  From: bhaara...@gmail.com
  To: user@struts.apache.org
 
  in struts2 is there a way to detect when No action mapped for namespace
  ... error will come up??
 
  What I mean is that can we write an if condition that checks whether or
 not
  the the action name exists in struts.xml?
 
  we can get the action name by: ActionContext.getInstance().getName()
 
  So if the above line of code returns an action name...can it
  be guaranteed that we will not get No action mapped for namespace...?
 
  Thanks

 _
 The New Busy is not the too busy. Combine all your e-mail accounts with
 Hotmail.

 http://www.windowslive.com/campaign/thenewbusy?tile=multiaccountocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4



RE: Using json in Struts 2.1.8.1

2010-04-20 Thread Martin Gainty

supply the fully qualified action name to the url
s:url var=url value=/admin/Autocomplete!getNames.action/

also make sure there is a result defined for that action in your declarator
action name=JSONList
result/ajax/JSONList.js/result
/action

anyone seen result type='json' ??

as far not getting there you should follow dales advice d/l and install 
firefox 
http://support.mozilla.com/en-US/kb/Firefox+exe+is+always+running

then install firebug plugin
http://getfirebug.com/downloads
you can view the entire DOM tree as well as interrogate request and resulting 
response

fill in the blank ..what name is at question mark
gov.?

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.






 Date: Tue, 20 Apr 2010 08:34:15 -0700
 From: karna...@yahoo.com
 Subject: Re: Using json in Struts 2.1.8.1
 To: user@struts.apache.org
 CC: d...@newfield.org
 
 Hi All,
  
Added below lines in struts.xml file
  
  
 package name=admin extends=struts-default,json-default  
 result-types
result-type name=json class=org.apache.struts2.json.JSONResult /
 /result-types
  
 action name=Autocomplete!* class=gov.admin.action.ManageAction 
 method={1}
   result type=jsonparam name=rootjson/param/result
 
 /action 
 
  
 /package
  
 Added following lines .jsp file
  
 bSearch JSON:nbsp;/b
 s:url id=url action=Autocomplete method=getNames /
 
 sx:autocompleter href=%{url} loadOnTextChange=true loadMinimumCount=3 
 /
  
  
 even included %@ taglib prefix=sx uri=/struts-dojo-tags% and 
 head
 sx:head /
 /head
  
 When it builds the page it is showing below lines
  
 input dojoType=struts:ComboBox  
 dataUrl=/admin/Autocomplete!getNames.action id=manageForm_ 
 keyName=nullKey loadOnType=true loadMinimum=3 visibleDownArrow=true /
 script language=JavaScript 
 type=text/javascriptdjConfig.searchIds.push(manageForm_);/script
  
 after entering 3 or more characters it supposed to invoke 'getNames' method 
 but it is not even starting invocation of this method
  
 Can anyone please let me know where I'm wrong.
  
 Thanks in advance.
  
 Regards,
 Sharath.
  
 
  
  
  
  
  
 
 
 --- On Fri, 4/16/10, Dale Newfield d...@newfield.org wrote:
 
 
 From: Dale Newfield d...@newfield.org
 Subject: Re: Using json in Struts 2.1.8.1
 To: Struts Users Mailing List user@struts.apache.org
 Date: Friday, April 16, 2010, 10:39 AM
 
 
  package name=package_name extends=struts-default
  namespace=/namespace_name
  result-types
  result-type name=json 
  class=com.googlecode.jsonplugin.JSONResult /
  /result-types
 
 Or just
 
 package name=package-name extends=json-default
 
 -Dale
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
   
  
_
The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with 
Hotmail. 
http://www.windowslive.com/campaign/thenewbusy?tile=multicalendarocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5