struts2 freemarker.template.TemplateNotFoundException

2018-04-15 Thread john lee
Please help
I use struts2 to handle file upload, i already configured the following
a. /WEB-INF/lib    contains     commons-fileupload-1.3.2.jar    
commons-io-2.2.jar     
b. /WEB-INF/classes/struts.xml     
   
  
c. /var/apache-tomcat-7.0.34/webapps/mytest/WEB-INF/classes/dream
    mytest    application name    dream     package name
    contains
    template          /* folder name */    System  give me the error message as 
the following

SEVERE: Servlet.service() for servlet jsp threw 
exceptionfreemarker.template.TemplateNotFoundException: Template not found for 
name "/template/away from cold/file.ftl".The name was interpreted by this 
TemplateLoader: 
org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader@1533de9.      
  at freemarker.template.Configuration.getTemplate(Configuration.java:1584)     
   at freemarker.template.Configuration.getTemplate(Configuration.java:1401)    
    at 
org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:97)
        at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:584)  
      at org.apache.struts2.components.UIBean.end(UIBean.java:538)        at 
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
        at 
org.apache.jsp.PropertyPhotoEdit_jsp._jspx_meth_s_005ffile_005f0(PropertyPhotoEdit_jsp.java:293)



Re: struts2 +rest service problem

2017-07-19 Thread john lee
I did add conventions plug-in, 

  From: Ken McWilliams <ken.mcwilli...@gmail.com>
 To: Struts Users Mailing List <user@struts.apache.org>; john lee 
<sh_thorn_b...@yahoo.com> 
 Sent: Wednesday, July 19, 2017 4:52 PM
 Subject: Re: struts2 +rest service problem
   
As mentioned in the other thread have you added the conventions plug-in? 

The indicated error indicates a failure of Struts2 to be able to find what it 
needs so your posted source should not be at issue. 

On Wed, Jul 19, 2017 at 3:13 PM, john lee <sh_thorn_b...@yahoo.com.invalid> 
wrote:


Please help for the struts2 + rest service 

http://beta-dev/ecommerce/ employee.xml




return the following error report

Struts Problem Report
Struts has detected an unhandled exception:
| Messages: |
   - com.thoughtworks.xstream. XStream
   - com/thoughtworks/xstream/ XStream
   - java.lang.reflect. InvocationTargetException
   - java.lang.RuntimeException: java.lang.reflect. InvocationTargetException
   - java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect. 
InvocationTargetException
   - java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.RuntimeException: java.lang.reflect. InvocationTargetException
 |
| File: | org/apache/catalina/loader/ WebappClassLoader.java |
| Line number: | 1,714 |


Stacktraces
java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect. 
InvocationTargetException    com.opensymphony.xwork2. inject.ContainerImpl$ 
MethodInjector.inject( ContainerImpl.java:301)
    com.opensymphony.xwork2. inject.ContainerImpl.inject( 
ContainerImpl.java:492)
    com.opensymphony.xwork2. inject.ContainerImpl$6.call( 
ContainerImpl.java:530)


source code:
cat Employee*.java
package xyz;
import xyz.*;
import java.util.Map;
import org.apache.struts2.rest. DefaultHttpHeaders;import 
org.apache.struts2.rest. HttpHeaders;import com.opensymphony.xwork2. 
ModelDriven;public class EmployeeController implements ModelDriven{     
   private static final long serialVersionUID = 1L;        private String id;   
     private Object model;        private EmployeeRepository employeeRepository 
= new EmployeeRepository();        private static Map<String,Employee> map;     
   {                map = employeeRepository. findAllEmployee();        }       
 public HttpHeaders index() {                model = map;                return 
new DefaultHttpHeaders("index"). disableCaching();        }        public 
String add(){                Integer empId = Integer.parseInt(id);              
  Employee emp = new Employee(empId,"Ramesh", "PQR");                model = 
emp;                return "SUCCESS";        }        public String getId() {   
             return id;        }        public void setId(String id) {          
      model = employeeRepository. getEmployeeById(id);                this.id = 
id;        }        @Override        public Object getModel() {                
return model;        }} 
package xyz;
import java.util.*;import xyz.*;

public class Employee {        private Integer id;        private String name;  
      private String company;        public Employee(Integer id, String name, 
String company){                this.id =id;                this.name = name;   
             this.company = company;        }        public Integer getId() {   
             return id;        }        public void setId(Integer id) {         
       this.id = id;        }        public String getName() {                
return name;        }        public void setName(String name) {                
this.name = name;        }        public String getCompany() {                
return company;        }        public void setCompany(String company) {        
        this.company = company;        }} package xyz;

import java.util.*;import java.sql.Timestamp;import xyz.*;
import java.util.HashMap;import java.util.Map;
public class EmployeeRepository {        private static Map<String,Employee> 
map = new HashMap<String,Employee>();         public EmployeeRepository(){      
          map.put("111", new Employee(111, "Ram", "ABC"));                
map.put("222", new Employee(222, "Shyam", "EFG"));                
map.put("333", new Employee(333, "Mohan", "XYZ"));        }        public  
Employee getEmployeeById(String id){                return map.get(id);        
}        public  Map<String,Employee> findAllEmployee(){                return 
map;        }} 

my configuration for struts.xml 




    

  




  




  

  

  

  

  

  








-- 
Sent from my C64 using a 300 baud modem


   

Re: struts2 with rest service

2017-07-19 Thread john lee
after i append, the problem is gone, but when i did test, have error message 
generated.
please see the thread.
thanks in advance.
john



  From: Ken McWilliams <ken.mcwilli...@gmail.com>
 To: Struts Users Mailing List <user@struts.apache.org>; john lee 
<sh_thorn_b...@yahoo.com> 
 Sent: Wednesday, July 19, 2017 4:11 PM
 Subject: Re: struts2 with rest service
   
Have you also included the struts2-conventions-plugin?

        
            org.apache.struts
            struts2-convention-plugin
            2.5.10.1
        

struts2-rest-plugin most definitely depends on struts2-conventions-plugin
but it isn't a declared dependency. I've thought that was strange for some
time. All the bean configurations such as struts.convention.action.suffix,
couldn't work otherwise.

On Wed, Jul 19, 2017 at 1:10 PM, john lee <sh_thorn_b...@yahoo.com.invalid>
wrote:

> To whom it may concern,
> my struts+spring+hibernate+mysql works fine, but try to embed the rest
> service in the application and failed to start.
> my adding/change is the following
> WEB-INF/lib  (add the following jar)    json-lib-2.3-jdk15.jar
>    struts2-rest-plugin-2.3.32.jar
>
> WEB-INF/classes/struts.xml (add the following line with red font)
> 
>  
>  
>    name="struts.mapper.prefixMapping" value="/rest:rest,:struts"/>
> 
> 
>  value="rest-default"/>   value="example"/>
>  value="org.apache.struts2.spring.StrutsSpringObjectFactory"
> />
>  
> after start application, but in catalina.out see the following error, i
> did copy struts-plugin.xml into WEB-INF/classes/.
> thanks in advance
> john
>
> ***
> SEVERE: Exception starting filter struts2Unable to load configuration. -
> bean - jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-
> INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
> at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:504)
>    at org.apache.struts2.dispatcher.ng.InitOperations.
> initDispatcher(InitOperations.java:74)        at
> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.
> init(StrutsPrepareAndExecuteFilter.java:57)        at
> org.apache.catalina.core.ApplicationFilterConfig.initFilter(
> ApplicationFilterConfig.java:278)        Caused by: Unable to load
> configuration. - bean - jar:file:/var/apache-tomcat-7.
> 0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.
> 3.32.jar!/struts-plugin.xml:30:130        at com.opensymphony.xwork2.
> config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
>      at 
>org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:978)
>      at org.apache.struts2.dispatcher.Dispatcher.init_
> PreloadConfiguration(Dispatcher.java:446)        at
> org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)
> ... 15 moreCaused by: Unable to load bean: 
> type:com.opensymphony.xwork2.ActionProxyFactory
> class:org.apache.struts2.rest.RestActionProxyFactory - bean -
> jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-
> INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
> at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.
> register(XmlConfigurationProvider.java:247)        at
> org.apache.struts2.config.StrutsXmlConfigurationProvider.register(
> StrutsXmlConfigurationProvider.java:102)        at
> com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(
> DefaultConfiguration.java:240)        at com.opensymphony.xwork2.
> config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
>      ... 18 moreCaused by: Bean type interface 
>com.opensymphony.xwork2.ActionProxyFactory
> with the name rest has already been loaded by bean -
> file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/
> classes/struts-plugin.xml:30:130 - bean - jar:file:/var/apache-tomcat-7.
> 0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.
> 3.32.jar!/struts-plugin.xml:30:130        at com.opensymphony.xwork2.
> config.providers.XmlConfigurationProvider.register(
> XmlConfigurationProvider.java:231)        ... 21 more
>



-- 
Sent from my C64 using a 300 baud modem


   

struts2 +rest service problem

2017-07-19 Thread john lee

Please help for the struts2 + rest service 

http://beta-dev/ecommerce/employee.xml




return the following error report

Struts Problem Report
Struts has detected an unhandled exception:
| Messages: |
   - com.thoughtworks.xstream.XStream
   - com/thoughtworks/xstream/XStream
   - java.lang.reflect.InvocationTargetException
   - java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   - java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
   - java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
 |
| File: | org/apache/catalina/loader/WebappClassLoader.java |
| Line number: | 1,714 |


Stacktraces
java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.RuntimeException: java.lang.RuntimeException: 
java.lang.reflect.InvocationTargetException
com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)
com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)
com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:530)


source code:
cat Employee*.java
package xyz;
import xyz.*;
import java.util.Map;
import org.apache.struts2.rest.DefaultHttpHeaders;import 
org.apache.struts2.rest.HttpHeaders;import 
com.opensymphony.xwork2.ModelDriven;public class EmployeeController implements 
ModelDriven{        private static final long serialVersionUID = 1L;    
    private String id;        private Object model;        private 
EmployeeRepository employeeRepository = new EmployeeRepository();        
private static Map map;        {                map = 
employeeRepository.findAllEmployee();        }        public HttpHeaders 
index() {                model = map;                return new 
DefaultHttpHeaders("index").disableCaching();        }        public String 
add(){                Integer empId = Integer.parseInt(id);                
Employee emp = new Employee(empId,"Ramesh", "PQR");                model = emp; 
               return "SUCCESS";        }        public String getId() {        
        return id;        }        public void setId(String id) {               
 model = employeeRepository.getEmployeeById(id);                this.id = id;   
     }        @Override        public Object getModel() {                return 
model;        }} 
package xyz;
import java.util.*;import xyz.*;

public class Employee {        private Integer id;        private String name;  
      private String company;        public Employee(Integer id, String name, 
String company){                this.id =id;                this.name = name;   
             this.company = company;        }        public Integer getId() {   
             return id;        }        public void setId(Integer id) {         
       this.id = id;        }        public String getName() {                
return name;        }        public void setName(String name) {                
this.name = name;        }        public String getCompany() {                
return company;        }        public void setCompany(String company) {        
        this.company = company;        }} package xyz;

import java.util.*;import java.sql.Timestamp;import xyz.*;
import java.util.HashMap;import java.util.Map;
public class EmployeeRepository {        private static Map 
map = new HashMap();         public EmployeeRepository(){      
          map.put("111", new Employee(111, "Ram", "ABC"));                
map.put("222", new Employee(222, "Shyam", "EFG"));                
map.put("333", new Employee(333, "Mohan", "XYZ"));        }        public  
Employee getEmployeeById(String id){                return map.get(id);        
}        public  Map findAllEmployee(){                return 
map;        }} 

my configuration for struts.xml 




    

  




  




  

  

  

  

  

  






struts2 with rest service

2017-07-19 Thread john lee
To whom it may concern, 
my struts+spring+hibernate+mysql works fine, but try to embed the rest service 
in the application and failed to start.
my adding/change is the following
WEB-INF/lib  (add the following jar)    json-lib-2.3-jdk15.jar
    struts2-rest-plugin-2.3.32.jar

WEB-INF/classes/struts.xml (add the following line with red font)

  
    
  
  
  
  
  

  
after start application, but in catalina.out see the following error, i did 
copy struts-plugin.xml into WEB-INF/classes/.
thanks in advance
john

***
SEVERE: Exception starting filter struts2Unable to load configuration. - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:504)   
     at 
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
        at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
        at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
        Caused by: Unable to load configuration. - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
        at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:70)
        at 
org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:978)      
  at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:446)
        at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:490)   
     ... 15 moreCaused by: Unable to load bean: 
type:com.opensymphony.xwork2.ActionProxyFactory 
class:org.apache.struts2.rest.RestActionProxyFactory - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
        at 
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
        at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:240)
        at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
        ... 18 moreCaused by: Bean type interface 
com.opensymphony.xwork2.ActionProxyFactory with the name rest has already been 
loaded by bean - 
file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes/struts-plugin.xml:30:130
 - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-rest-plugin-2.3.32.jar!/struts-plugin.xml:30:130
        at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:231)
        ... 21 more


struts2 json return to front

2014-10-28 Thread john lee
  After click the button,     the value of partid is passed to action class, 
and see the output '123' from the console.    the assigned value of dummymesg 
is displayed on the console as well.
 but the dummymesg never return to front javascript.    looks like success or 
error function call never be called, 
please advise
thanks in advance



Cart.jsp
script type=text/javascript$(function() {
  $(#deleteButton).click(function(){
    $.ajax({
   type: POST,
   url: cart-del!del.action,
   data: {'partid':'123'},
   dataType:json,
   success: function(json){
    console.log(return success);
    var obj = $.parseJSON(json);
    alert(dummey mesg=+obj.dummymesg);
    return false;
    },
    error: function(json){
 console.log(return error = +json);
 alert(json= + json);
 return false;
 }
    });
 });
    });/scriptbutton id=deleteButtondelete/button

struts.xmlpackage name=default extends=json-default ... action 
name=cart-del class=CartAction method=del
    result name=json-data type=json/result
    
 /action
/package
CartAction.java
  public class CartAction extends ActionSupport {
 private String partid;
 public void setPartid(String partid) { this.partid=partid.trim(); }
 public String getPartid() { return partid; }
 
 public void setDummymesg(String dummymesg) { this.dummymesg=dummymesg; }
 public String getDummymesg() { return dummymesg; }  
  public String del() throws Exception {  dummymesg=struts 
function reached;
  System.out.println(cart-del, partid=+partid+\n);
  System.out.println(cart-del, dummymesg=+dummymesg+\n);
  return json-data;
 }
}

Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread john lee
the delete itself has no problem if called it directly. 
  From: Lukasz Lenart lukaszlen...@apache.org
 To: Struts Users Mailing List user@struts.apache.org 
 Sent: Monday, October 27, 2014 2:46 AM
 Subject: Re: struts2 json return null if involve hibernate or spring
   
2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:


  is hibernate dao manipulation could affect struts 2 json return?
 or spring framework could affect struts2 json return?
 my program's struts2 json execution is success if not involve dao or spring 
 call.
 but if involve hibernate/spring/dao manipulation, then json return is null 
 and not returned.
 struts.xmlpackage name=default extends=json-default    ...    action 
 name=cart-del class=CartAction method=del
                    result name=json-data type=json/result

      /action
 /package
 Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/

  %@ taglib prefix=s uri=/struts-tags %
  %@ taglib prefix=sj uri=/struts-jquery-tags% script 
type=text/javascript
    function delItem(sn) {
                alert(here10, sn=+sn);
                $.post('cart-del.action', {partid: sn}, function(data) {
                        alert(here20, data.deleted=+data.deleted);
                        if (data.deleted) {
                                alert(here30 - deleted);
                                $('#tr_' + sn).remove();
                                }                              }
                        else
                                alert(here40 - not delete);
                });
        }
 /scipts:iterator value=#session.cartitems
    tr id=tr_${j_part_id}
        tdinput type=checkbox onclick=delItem('${j_part_id }') //td
        td${part.pid}input type=hidden name=partids 
value=${j_part_id} //td
    /tr
 /s:iterator
 CartAction.java
  public class AcctAction extends ActionSupport {
      private String partid;
      private boolean deleted;
      public void setPartid(String partid) { this.partid=partid.trim(); }
      public String getPartid() { return partid; }
      public boolean getDeleted() { return deleted; }    public String del() 
throws Exception {
              /* problem is:
                  if enable following business dao logic to delete item from 
database, the item is deleted,
                  and this is proved from querying database,
                  but deleted variable always 'not delete in the Cart.jsp 
alert statement.
                  without business logic, then deleted can always return true;

              */
              /*
                CartManagerImpl  cartmgr;
                cartmgr.dao_delete...
              */

              deleted=true;
              return json-data;
      }
 }
 CartManagerImpl.javaimport org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
 import 
 org.springframework.web.context.support.WebApplicationContextUtils;public 
 class CartManagerImpl  {
    dao_delete 
 }

Maybe you have some exception here or some other problem when deleting
that item?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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


  

Re: [struts-user] Re: struts2 json return null if involve hibernate or spring

2014-10-27 Thread john lee
What is the status of the Hibernate/JPA session at the time of the View 
rendering? 
i just use the following session approach       in the application.xml          
bean id=cartmgr class=CartManagerImpl scope=prototype                  
property name=cartDao ref=cartDao/          /bean
 in the CartManagerImpl.java  public class CartManagerImpl implements 
CartManager  {
    CartDao cartDao;    public void setCartDao(CartDao cartDao) { 
this.cartDao=cartDao; }           public void removeSingle(Cartitem item) 
throws Exception { cartDao.deleteSingle(item); }
  

  From: Jason Pyeron jpye...@pdinc.us
 To: 'Struts Users Mailing List' user@struts.apache.org 
 Sent: Monday, October 27, 2014 8:20 AM
 Subject: RE: [struts-user] Re: struts2 json return null if involve hibernate 
or spring
   
 -Original Message-
 From: john lee 
 Sent: Monday, October 27, 2014 9:06
 
 the delete itself has no problem if called it directly. 

(please try not to top post)

      From: Lukasz Lenart lukaszlen...@apache.org
  To: Struts Users Mailing List user@struts.apache.org 
  Sent: Monday, October 27, 2014 2:46 AM
  Subject: Re: struts2 json return null if involve hibernate or spring
    
 2014-10-27 3:55 GMT+01:00 john lee sh_thorn_b...@yahoo.com.invalid:
 
 
   is hibernate dao manipulation could affect struts 2 json return?

In my expereince yes, regarding lazy loading and caching. But your code sample 
does not give enough detail to say if that is likely. What is the status of the 
Hibernate/JPA session at the time of the View rendering? 

  or spring framework could affect struts2 json return?
  my program's struts2 json execution is success if not 
 involve dao or spring call.
  but if involve hibernate/spring/dao manipulation, then json 
 return is null and not returned.
  struts.xmlpackage name=default extends=json-default   
  ...    action name=cart-del class=CartAction method=del
                     result name=json-data type=json/result
 
       /action
  /package
  Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
 loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
 defaultIndicator=myDefaultIndicator/
 
   %@ taglib prefix=s uri=/struts-tags %
   %@ taglib prefix=sj uri=/struts-jquery-tags% script 
 type=text/javascript
     function delItem(sn) {
                 alert(here10, sn=+sn);
                 $.post('cart-del.action', {partid: sn}, 
 function(data) {
                         alert(here20, data.deleted=+data.deleted);
                         if (data.deleted) {
                                 alert(here30 - deleted);
                                 $('#tr_' + sn).remove();
                                 }                              }
                         else
                                 alert(here40 - not delete);
                 });
         }
  /scipts:iterator value=#session.cartitems
     tr id=tr_${j_part_id}
         tdinput type=checkbox 
 onclick=delItem('${j_part_id }') //td
         td${part.pid}input type=hidden name=partids 
 value=${j_part_id} //td
     /tr
  /s:iterator
  CartAction.java
   public class AcctAction extends ActionSupport {
       private String partid;
       private boolean deleted;
       public void setPartid(String partid) { 
 this.partid=partid.trim(); }
       public String getPartid() { return partid; }
       public boolean getDeleted() { return deleted; }    
 public String del() throws Exception {
               /* problem is:
                   if enable following business dao logic to 
 delete item from database, the item is deleted,
                   and this is proved from querying database,
                   but deleted variable always 'not delete in 
 the Cart.jsp alert statement.
                   without business logic, then deleted can 
 always return true;
 
               */
               /*
                 CartManagerImpl  cartmgr;
                 cartmgr.dao_delete...

What is the Hibernate code here?

Do you have the same problems in your JSP Views?

               */
 
               deleted=true;
               return json-data;
       }
  }
  CartManagerImpl.javaimport 
 org.apache.struts2.ServletActionContext;import 
 org.springframework.web.context.WebApplicationContext;
  import 
 org.springframework.web.context.support.WebApplicationContextU
 tils;public class CartManagerImpl  {
     dao_delete 
  }
 
 Maybe you have some exception here or some other problem when deleting
 that item?

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                              -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218  -
-                                                              -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00

struts2 json return null if involve hibernate or spring

2014-10-26 Thread john lee
 is hibernate dao manipulation could affect struts 2 json return?
or spring framework could affect struts2 json return?
my program's struts2 json execution is success if not involve dao or spring 
call.
but if involve hibernate/spring/dao manipulation, then json return is null and 
not returned.
struts.xmlpackage name=default extends=json-default ... action 
name=cart-del class=CartAction method=del
    result name=json-data type=json/result
    
 /action
/package
Cart.jsp sj:head jqueryui=true jquerytheme=%{theme} 
loadFromGoogle=%{google} ajaxhistory=%{ajaxhistory} 
defaultIndicator=myDefaultIndicator/
 
 %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=sj uri=/struts-jquery-tags% script 
type=text/javascript
    function delItem(sn) {
    alert(here10, sn=+sn);
    $.post('cart-del.action', {partid: sn}, function(data) {
    alert(here20, data.deleted=+data.deleted);
    if (data.deleted) {
    alert(here30 - deleted);
    $('#tr_' + sn).remove();
    }   }
    else
    alert(here40 - not delete);
    });
    }
/scipts:iterator value=#session.cartitems
   tr id=tr_${j_part_id}
   tdinput type=checkbox onclick=delItem('${j_part_id }') //td
   td${part.pid}input type=hidden name=partids value=${j_part_id} 
//td
   /tr
/s:iterator
CartAction.java
  public class AcctAction extends ActionSupport {
 private String partid;
 private boolean deleted;
 public void setPartid(String partid) { this.partid=partid.trim(); }
 public String getPartid() { return partid; }
 public boolean getDeleted() { return deleted; } public String del() 
throws Exception {
  /* problem is: 
  if enable following business dao logic to delete item from 
database, the item is deleted, 
  and this is proved from querying database, 
  but deleted variable always 'not delete in the Cart.jsp alert 
statement.
  without business logic, then deleted can always return true;  
   
    
  */
  /* 
   CartManagerImpl  cartmgr;
   cartmgr.dao_delete...
  */
   
  deleted=true;
  return json-data;
 }
}
CartManagerImpl.javaimport org.apache.struts2.ServletActionContext;import 
org.springframework.web.context.WebApplicationContext;
import 
org.springframework.web.context.support.WebApplicationContextUtils;public class 
CartManagerImpl  {
    dao_delete 
}


s:textfield jquery can not change placeholder

2014-07-25 Thread john lee
 
I can use jquery to change html input tag's placeholder for no problem, but no 
matter what method I use, impossible for me to change 
  s:textfield's placeholder.
I tried
$('#partid').attr('placeholder','XXX');
    and
    $('#partid').val('XXX');
    and
 $('#partid').text('XXX');
 
s:textfield's placeholder impossible for jquery to change, is struts2 limition 
or bugs? 
 
thanks in advance
 
john

*
 
 %@ taglib prefix=s uri=/struts-tags %
%@ taglib prefix=sj uri=/struts-jquery-tags%
sj:head jqueryui=true/
 
script language=javascript
  $(document).ready(function() {
    $('#searchchoice').change(function() {
 var ex = document.getElementById(searchchoice);
 var finalchoice = ex.options[ex.options.selectedIndex].text;
  if (finalchoice=='part#')
 $('#partid').attr('placeholder','input example: XXX');
 else if (finalchoice=='keyword')
  $('#partid').attr('placeholder','input example 2: XXX');
 else if (finalchoice=='model')
  $('#partid').attr('placeholder','input example 3: XXX');
 
  });
   });
/script
 
s:form class=nav-search action=PartsearchbothAction method=post 
theme=simple 
 s:select label=Part#
    id=searchchoice
    name=searchchoice
list=#{'part#':'part#', 'keyword':'keyword', 'model#':'model'}
    value=part#
    theme=simple
    required=true
 /
  s:textfield name=partid label=partid placeholder='default search is 
by Part#' required=true theme=simple/
    
 s:submit value=go
/s:form

Re: s:textfield jquery can not change placeholder

2014-07-25 Thread john lee
Thanks Chris.
 
It is solved after apply ID
 
  


On Friday, July 25, 2014 3:04 PM, Chris Pratt thechrispr...@gmail.com wrote:
  


Make sure you set the id attribute on the s:textfield if you're going to
refer to it that way using jQuery.
  (*Chris*)



On Fri, Jul 25, 2014 at 12:30 PM, john lee sh_thorn_b...@yahoo.com.invalid
wrote:


 I can use jquery to change html input tag's placeholder for no problem,
 but no matter what method I use, impossible for me to change
   s:textfield's placeholder.
 I tried
     $('#partid').attr('placeholder','XXX');
     and
     $('#partid').val('XXX');
     and
      $('#partid').text('XXX');

 s:textfield's placeholder impossible for jquery to change, is struts2
 limition or bugs?

 thanks in advance

 john

 *

  %@ taglib prefix=s uri=/struts-tags %
 %@ taglib prefix=sj uri=/struts-jquery-tags%
 sj:head jqueryui=true/

 script language=javascript
   $(document).ready(function() {
         $('#searchchoice').change(function() {
              var ex = document.getElementById(searchchoice);
              var finalchoice = ex.options[ex.options.selectedIndex].text;
               if (finalchoice=='part#')
                  $('#partid').attr('placeholder','input example: XXX');
              else if (finalchoice=='keyword')
                       $('#partid').attr('placeholder','input example 2:
 XXX');
              else if (finalchoice=='model')
                       $('#partid').attr('placeholder','input example 3:
 XXX');

               });
    });
 /script

 s:form class=nav-search action=PartsearchbothAction method=post
 theme=simple 
      s:select label=Part#
                 id=searchchoice
                 name=searchchoice
                 list=#{'part#':'part#', 'keyword':'keyword',
 'model#':'model'}
                 value=part#
                 theme=simple
                 required=true
          /
       s:textfield name=partid label=partid placeholder='default
 search is by Part#' required=true theme=simple/

      s:submit value=go
 /s:form

struts2 s:url call action method

2014-06-27 Thread john lee


I try to use s:url to call action's method, but not works, please advise

from the executed link, it shows 
http://omega3.neucoinc.com/ecommerce/CartAction.action!additem?partid=1508, but 
logfile no method shows executed.

i executed/tested manually by  
http://localhost/CartAction.action!add?partid=1508, shows no resource is 
available

so, what is the correct way/syntax to use s:url tag to call action's method ?

thanks in advnce

john

***

3 files  (  CartAction.java, Cart.jsp, Struts.xml )

Struts.xml
   action name=CartAction class=CartAction  method=add
result name=successSuccess.jsp/result
 /action 

CartAction.java
  public class CartAction extends ActionSupport {
 public String add() throws Exception {
    
  }

Cart.jsp
   s:url action=CartAction var=cartTag method=add escapeAmp=false
  s:param name=partid s:property value=partid/ /s:param
   /s:url
   s:a href=%{cartTag}Add to Cart/s:a

Re: struts2 s:url call action method

2014-06-27 Thread john lee


Hi Dave,

How to verify ?

thanks in advance

John 


On Friday, June 27, 2014 4:04 PM, Dave Newton davelnew...@gmail.com wrote:
  


Do you have dynamic method invocation turned on?



On Fri, Jun 27, 2014 at 4:34 PM, john lee sh_thorn_b...@yahoo.com.invalid
wrote:



 I try to use s:url to call action's method, but not works, please advise

 from the executed link, it shows
 http://omega3.neucoinc.com/ecommerce/CartAction.action!additem?partid=1508,
 but logfile no method shows executed.

 i executed/tested manually by
 http://localhost/CartAction.action!add?partid=1508,shows no resource is
 available

 so, what is the correct way/syntax to use s:url tag to call action's
 method ?

 thanks in advnce

 john

 ***

 3 files  (  CartAction.java, Cart.jsp, Struts.xml )

 Struts.xml
            action name=CartAction class=CartAction  method=add
                     result name=successSuccess.jsp/result
              /action

 CartAction.java
       public class CartAction extends ActionSupport {
                      public String add() throws Exception {
             
       }

 Cart.jsp
        s:url action=CartAction var=cartTag method=add
 escapeAmp=false
               s:param name=partid s:property value=partid/
 /s:param
        /s:url
        s:a href=%{cartTag}Add to Cart/s:a




-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton https://twitter.com/dave_newton
b: Bucky Bits http://buckybits.blogspot.com/
g: davelnewton https://github.com/davelnewton
so: Dave Newton http://stackoverflow.com/users/438992/dave-newton


struts2 jquery sj:tabbedpanel remoteurl

2013-11-19 Thread john lee


I use sturs2 jquery  sj:tabbedpanel with remoteurl feature, it works fine.

But, the remote url is called when did initiala load, how can I disable initial 
load for remote url?

i just want to load(tab1 with remote URL) when i click it.

thanks in advance

John

*

s:url var=remoteurl1 action=PartdetailAction.action 
    s:param name=partid s:property value=detailpart.id/ /s:param 
/s:url


div id=why

sj:tabbedpanel id=partmoreinfo onChangeTopics=tabchange
       sj:tab id=tab1 href=%{remoteurl1} label=Promotion 
loadingText=Promotion here/
       sj:tab id=tab2 target=Lotprice label=Lot Price/
/sj:tabbedpanel 
/div

s:if iterator session problem

2013-11-18 Thread john lee
 
from the following output,
   we can tell sell_price=36.97, display_price=1
 
why
   none of test statement works ? 
 
 
please advise, thanks in advance
 
john
  
 
 
Class Part {
float sell_price;
    int display_price;
    ./*..get set here */
 
Action.java 
 Part part=new Part();
 ./* doing some calculation */
 session.put(detailpart,part);
 
JSP file
    s:iterator id=part value=#session.detailpart
     whys:property value=sell_price/- s:property 
value=display_price/why

 s:if test='%{#part.display_price==1}'
 9s:property value=sell_price/9
 /s:if
 
    s:if test='#part.display_price==1'
    8s:property value=sell_price/8
  /s:if
   
  s:if test='part.display_price==1'
 7s:property value=sell_price/7
  /s:if
  
   s:if test='%{#display_price==1}'
    6s:property value=sell_price/6
   /s:if 
   
   s:if test='#display_price==1'
 5s:property value=sell_price/5
   /s:if
  end
    /s:iterator
 
OutPut
   
 
why 36.97- 1 why

end

Struts 2, session, s:iterator s:if not working, please help (this is revised)

2013-11-18 Thread john lee


from the following output,
   we can tell sell_price=36.97, display_price=1

why
   none of test statement works ? 


please advise, thanks in advance

john
  


Class Part {
float sell_price;
    int display_price;
    ./*..get set here */

Action.java 
 ArrayListPart parts=new ArrayListPart();
 ./* doing some calculation for multiple part*/
 session.put(detailpart,parts);

JSP file
    s:iterator id=part value=#session.detailpart
     whys:property value=sell_price/- s:property 
value=display_price/why

 s:if test='%{#part.display_price==1}'
 9s:property value=sell_price/9
 /s:if
 
    s:if test='#part.display_price==1'
    8s:property value=sell_price/8
  /s:if
   
  s:if test='part.display_price==1'
 7s:property value=sell_price/7
  /s:if
  
   s:if test='%{#display_price==1}'
    6s:property value=sell_price/6
   /s:if 
   
   s:if test='#display_price==1'
 5s:property value=sell_price/5
   /s:if
  end
    /s:iterator

OutPut
   

why 36.97- 1 why

end

sj:tabbedpanel javascript

2013-08-09 Thread john lee
 
try to using javascript to set sj:tabbedpanel's attribute, but not working
 
what is the correct format for access attribute sj:tabbedpanel's atrtribute in 
javascript?
 
thanks in advance
 
John
 
 
 
script language=javascript
 
function setpartmoreinfo(id) {
    $(#Cross).tabs( option, partmoreinfo_id, id); 
  }
/script
 
a href=# onclick=javascript:setpartmoreinfo(2)change displaya
 
 sj:tabbedpanel id=partmoreinfo selectedTab=%{partmoreinfo_id}
   sj:tab id=tab1 target=Accessories label=Accessories/
   sj:tab id=tab2 target=Replacement label=Replacement Parts/
   sj:tab id=tab3 target=Cross label=Cross Reference/
   div id=Accessories Accessories here /div
   div id=Replacement Replacement Parts here /div
   div id=Cross Cross Reference here /div
  /sj:tabbedpanel

Re: sj:tabbedpanel javascript

2013-08-09 Thread john lee
thanks for reply,
 
i did view source before ask question here, but sj:tabbedpanel convert into 
jquery, even view source, still not match.
 
john
 


 From: Chris Pratt thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Friday, August 9, 2013 12:43 PM
Subject: Re: sj:tabbedpanel javascript
  


Use the View Source feature in your browser to see what's being generated, 
then you should be able to see for yourself how to use JavaScript to interact 
with the on-screen components.
  (*Chris*) 



On Fri, Aug 9, 2013 at 10:25 AM, john lee sh_thorn_b...@yahoo.com wrote:

 
try to using javascript to set sj:tabbedpanel's attribute, but not working
 
what is the correct format for access attribute sj:tabbedpanel's atrtribute in 
javascript?
 
thanks in advance
 
John
 
 
 
script language=javascript
 
function setpartmoreinfo(id) {
    $(#Cross).tabs( option, partmoreinfo_id, id); 
  }
/script
 
a href=# onclick=javascript:setpartmoreinfo(2)change displaya
 
 sj:tabbedpanel id=partmoreinfo selectedTab=%{partmoreinfo_id}
   sj:tab id=tab1 target=Accessories label=Accessories/
   sj:tab id=tab2 target=Replacement label=Replacement Parts/
   sj:tab id=tab3 target=Cross label=Cross Reference/
   div id=Accessories Accessories here /div
   div id=Replacement Replacement Parts here /div
   div id=Cross Cross Reference here /div
  /sj:tabbedpanel

Re: sj:tabbedpanel javascript

2013-08-09 Thread john lee
view source
 
the related option for jquery(after sj_query convert into jquery), it shows 
following  
script type='text/javascript' 
 jQuery(document).ready(function () {  
 var options_partmoreinfo = {}; 
 options_partmoreinfo.jqueryaction = tabbedpanel;  
 options_partmoreinfo.id = partmoreinfo;  
 options_partmoreinfo.oncom = tabcomplete;  
 options_partmoreinfo.oncha = tabchange;
 jQuery.struts2_jquery_ui.bind(jQuery('#partmoreinfo'),options_partmoreinfo);   
 
 }); 
script type='text/javascript'jQuery(document).ready(function () {  var 
options_partmoreinfo = {};  options_partmoreinfo.jqueryaction = tabbedpanel;  
options_partmoreinfo.id = partmoreinfo;  options_partmoreinfo.oncom = 
tabcomplete;  options_partmoreinfo.oncha = tabchange;  
jQuery.struts2_jquery_ui.bind(jQuery('#partmoreinfo'),options_partmoreinfo);   
}); /script
  
that is why i use the following
 
    $('#partmoreinfo').tabs(selectedTab, partmoreinfo_id, 3);
 or 
   $(#partmoreinfo).tabs( taboptions, partmoreinfo_id, 3);
 
to access the attribute selectedTab of sj:tabbedpanel's attrubte selectedTab, 
but not working.
 
sj:tabbedpanel id=partmoreinfo selectedTab=%{partmoreinfo_id}
        sj:tab id=tab1 target=Accessories label=Accessories/
        sj:tab id=tab2 target=Replacement label=Replacement Parts/
        sj:tab id=tab3 target=Cross label=Cross Reference/
        div id=Accessories Accessories here /div
        div id=Replacement Replacement Parts here /div
        div id=Cross Cross Reference here /div
   /sj:tabbedpanel
 
Please advise
 
thanks again
 
john
     
 


 From: Chris Pratt thechrispr...@gmail.com
To: john lee sh_thorn_b...@yahoo.com 
Cc: Struts Users Mailing List user@struts.apache.org 
Sent: Friday, August 9, 2013 1:27 PM
Subject: Re: sj:tabbedpanel javascript
  

I have no idea what you mean.  The sj:tabbedpanel generates HTML Elements
and some jQuery based JavaScript.  It'll all be there in the source.
What's not matching?
  (*Chris*)


On Fri, Aug 9, 2013 at 11:00 AM, john lee sh_thorn_b...@yahoo.com wrote:

 thanks for reply,

 i did view source before ask question here, but sj:tabbedpanel convert
 into jquery, even view source, still not match.

 john

    *From:* Chris Pratt thechrispr...@gmail.com
 *To:* Struts Users Mailing List user@struts.apache.org; john lee 
 sh_thorn_b...@yahoo.com
 *Sent:* Friday, August 9, 2013 12:43 PM
 *Subject:* Re: sj:tabbedpanel javascript

 Use the View Source feature in your browser to see what's being
 generated, then you should be able to see for yourself how to use
 JavaScript to interact with the on-screen components.
   (*Chris*)


 On Fri, Aug 9, 2013 at 10:25 AM, john lee sh_thorn_b...@yahoo.com wrote:


 try to using javascript to set sj:tabbedpanel's attribute, but not working

 what is the correct format for access attribute sj:tabbedpanel's
 atrtribute in javascript?

 thanks in advance

 John



 script language=javascript

 function setpartmoreinfo(id) {
         $(#Cross).tabs( option, partmoreinfo_id, id);
       }
 /script

 a href=# onclick=javascript:setpartmoreinfo(2)change displaya

  sj:tabbedpanel id=partmoreinfo selectedTab=%{partmoreinfo_id}
        sj:tab id=tab1 target=Accessories label=Accessories/
        sj:tab id=tab2 target=Replacement label=Replacement Parts/
        sj:tab id=tab3 target=Cross label=Cross Reference/
        div id=Accessories Accessories here /div
        div id=Replacement Replacement Parts here /div
        div id=Cross Cross Reference here /div
   /sj:tabbedpanel






sj:a json return result question

2013-08-06 Thread john lee
 
Question for Sjquery's   sj:a  tag as the following
 
s:url id=ajax value=ReportAction/
    sj:a id=ajaxlink 
    href=%{ajax} 
    targets=result 
     TOTAL # PARTS 
    /sj:a
div id=result s:property value=sum//div
 
public class ReportkeyAction extends extends ActionSupport {
  private int sum;
  public int getSum() { return sum; }
  public void setSum(int sum) { this.sum = sum; }
  public String execute() throws Exception {    sum=310;
    System.out.println(sum get fired for json, val=+sum);
    return success;
}
public String getJSON()  throws Exception
  {
    System.out.println(json get triggered for json, val=+sum);
    return execute();
  }
}
 
the render return result/display is the following
 
   TOTAL # PARTS  
{JSON:success,sum:310}
 
 
I only expect result of 310 get returned, why heading info also get returned?
obvioulsy, s:property value=sum/ even did not working.
 
how can i just display 310 only?
 
thanks in advance
 
john

Re: sj:a json return result question

2013-08-06 Thread john lee
Dave,
 
Thanks your very much, it works very well
 
brw, the book you wrote/published, i had it.
 
john
 
  


 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Tuesday, August 6, 2013 11:26 AM
Subject: Re: sj:a json return result question
  


Configure your result's `root` to be `sum`, otherwise it will serialize the 
entire action.




On Tue, Aug 6, 2013 at 10:31 AM, john lee sh_thorn_b...@yahoo.com wrote:

 
Question for Sjquery's   sj:a  tag as the following
 
s:url id=ajax value=ReportAction/
    sj:a id=ajaxlink
    href=%{ajax}
    targets=result
     TOTAL # PARTS 
    /sj:a
div id=result s:property value=sum//div
 
public class ReportkeyAction extends extends ActionSupport {
  private int sum;
  public int getSum() { return sum; }
  public void setSum(int sum) { this.sum = sum; }
  public String execute() throws Exception {    sum=310;
    System.out.println(sum get fired for json, val=+sum);
    return success;
}
public String getJSON()  throws Exception
  {
    System.out.println(json get triggered for json, val=+sum);
    return execute();
  }
}
 
the render return result/display is the following
 
   TOTAL # PARTS 
{JSON:success,sum:310}
 
 
I only expect result of 310 get returned, why heading info also get returned?
obvioulsy, s:property value=sum/ even did not working.
 
how can i just display 310 only?
 
thanks in advance
 
john


-- 

e: davelnew...@gmail.com
m: 908-380-8699 
s: davelnewton_skype
t: @dave_newton
b: Bucky Bits 
g: davelnewton
so: Dave Newton 

sj:select default value not load

2013-08-02 Thread john lee
 
For struts2 sj:select tag from google
 
s:url id=remoteurl action=KeywordcategoryAction/
    sj:select
    href=%{remoteurl}
    id=language
    onChangeTopics=reloadsecondlist
    name=language
    list=languageObjList
    listKey=myKey
    listValue=myValue
    emptyOption=true
    headerKey=-1
    headerValue=Select Category
    value=why
    /
 
for above jsp file, i can retrieve the data from KeywordcategoryAction for no 
problem
 
but, the default value(why) as defined from KeywordcategoryAction did not 
working at all
 
I try to change from value=why to value=%{why}, but still not working,
 
the setting inside  KeywordcategoryAction is the following
   ...
    public String getWhy(String why) { return why; }
    public void setWhy(String why) { this.why=why; }
    why=Temperature;
    return success;
 
 
please advise, thanks in advance
 
john

s:select detail question for preselected

2013-08-02 Thread john lee
for following jsp, i can retrieve the data from KeywordcategoryAction for no 
problem,
    the contents of retrieved list is
  Motor
  Electrical
  Temperature
 
s:url id=remoteurl action=KeywordcategoryAction/
    sj:select
    href=%{remoteurl}
    id=language
    onChangeTopics=reloadsecondlist
    name=language
    list=languageObjList
    listKey=myKey
    listValue=myValue
    emptyOption=true
    headerKey=-1
    headerValue=Select Category
    value=why
    /

but, the default value(why) as defined from KeywordcategoryAction did not 
working at all
i change from value=why to value=%{why}', but still not working,
 
the souce code is at following
 
public class ListValue {
  private String myKey;
  private String myValue;
  /* set/get here */
}
 
public class Keywordcategory0Action {
  
  private ListString    languageList;
  private ListListValue languageObjList;
  private MapString, String languageMap;
  private ListString    reloadList;
  private String  language;
 ArrayListString main_categorys;
 
  /* set/get here */
 
    main_categorys= .../* get return from databsse */
 
    languageList = new ArrayListString();
    languageObjList = new ArrayListListValue();
    languageMap = new HashMapString, String();

    for (String m: main_categorys) {
    languageList.add(m);
    languageMap.put(m,m);
    languageObjList.add(new ListValue(m, m));
    }
    reloadList = new ArrayListString();
 
    why=Temperature;
 
    return success;
    }
 
public String getJSON()  throws Exception  {    return execute();  }
 
please advise,
 
thanks in advance
 
john

s:property display INTERGER

2013-07-29 Thread john lee
 
I have class Part
 
  class Part {
  String pid, 
  Integer  qty;
}
 
how can I display object/convert inside JSP?
 
/* if define/set (Part detailpart)  before return */
 
s:property value=detailpart.pid/    /* this is no problem */
 
how about qty?
 
I tried the following, but show null
   s:property value=detailpart.qty/
 
I tried the following, but nothing either
    s:property value=getText('{0,number,#,##0.00}',{detailpart.qty})/
 
so, how to display/convert  object inside value ?
 
thanks in advance
 
john

Re: s:property display INTERGER

2013-07-29 Thread john lee
No, inside the action, before the return, I do
 
   detailpart.getQty().intValue(), return is 1, /* have value inside */
 
thanks for reply, any other thoughts?
 
john
 


 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Monday, July 29, 2013 9:59 PM
Subject: Re: s:property display INTERGER
  


If it's null, it's null. If there's a value, it will display.




On Mon, Jul 29, 2013 at 10:46 PM, john lee sh_thorn_b...@yahoo.com wrote:

 
I have class Part
 
  class Part {
  String pid,
  Integer  qty;
}
 
how can I display object/convert inside JSP?
 
/* if define/set (Part detailpart)  before return */
 
s:property value=detailpart.pid/    /* this is no problem */
 
how about qty?
 
I tried the following, but show null
   s:property value=detailpart.qty/
 
I tried the following, but nothing either
    s:property value=getText('{0,number,#,##0.00}',{detailpart.qty})/
 
so, how to display/convert  object inside value ?
 
thanks in advance
 
john


-- 

e: davelnew...@gmail.com
m: 908-380-8699 
s: davelnewton_skype
t: @dave_newton
b: Bucky Bits 
g: davelnewton
so: Dave Newton 

Re: s:property display INTERGER

2013-07-29 Thread john lee
SSCCE ? what u refer to?
 


 From: Dave Newton davelnew...@gmail.com
To: john lee sh_thorn_b...@yahoo.com 
Cc: Struts Users Mailing List user@struts.apache.org 
Sent: Monday, July 29, 2013 10:04 PM
Subject: Re: s:property display INTERGER
  


Please put an SSCCE on github/equivalent; I'm very skeptical.




On Mon, Jul 29, 2013 at 11:02 PM, john lee sh_thorn_b...@yahoo.com wrote:

No, inside the action, before the return, I do 
 
   detailpart.getQty().intValue(), return is 1, /* have value inside */
 
thanks for reply, any other thoughts?
  
john

 
 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Monday, July 29, 2013 9:59 PM
Subject: Re: s:property display INTERGER
 


If it's null, it's null. If there's a value, it will display.




On Mon, Jul 29, 2013 at 10:46 PM, john lee sh_thorn_b...@yahoo.com wrote:

 
I have class Part
 
  class Part {
  String pid,
  Integer  qty;
}
 
how can I display object/convert inside JSP?
 
/* if define/set (Part detailpart)  before return */
 
s:property value=detailpart.pid/    /* this is no problem */
 
how about qty?
 
I tried the following, but show null
   s:property value=detailpart.qty/
 
I tried the following, but nothing either
    s:property value=getText('{0,number,#,##0.00}',{detailpart.qty})/
 
so, how to display/convert  object inside value ?
 
thanks in advance
 
john


-- 

e: davelnew...@gmail.com 
m: 908-380-8699 
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits 
g: davelnewton
so: Dave Newton 

 

   


-- 

e: davelnew...@gmail.com 
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton 
b: Bucky Bits
g: davelnewton 
so: Dave Newton

struts2 action return to invoker jsp, but jsp value not change

2013-07-27 Thread john lee
 
I have an jsp, called Part.jsp
 
 
 s:property value=qty/
 s:form action=testAction
  ..
   s:submit
  /sform
 
in the testAction
 
 . have setter/geter method for qty
 
   ...
   qty=99 /* before return force qty=99 */
   ...
   return input
 
in struts.xml
action name=testAction class=testAction
    result name=inputPart.jsp/result
   /action
 
after back to same page,
   qty is null
 
do not understand at all. if I redirect to different page, and qty can retrieve 
for no problem at all.
 
does struts can not postback after reset the same variable ?
 
thanks in advance
 
john

s:interator s:div not working

2013-07-21 Thread john lee
 
 s:iterator id=part value=parts status=st
   s:property value=pid/br
   s:property value=detail/br
/s:iterator
 
works fine, but I need to use s:div inside the s:iterator, the nightmare happen
 
first of all, after I did research, in order to let DIV works inside 
s:iterator, have to use S:DIV
 
second,  I try to use s:property value='pid'/ inside S:DIV, value not 
trieved, and display:none not work at all
 
script language=javascript
function toggle(input) {
    var ele = document.getElementById(input);
    if(ele.style.display == block) 
    ele.style.display = none;
 else 
    ele.style.display = block;
 }
/script

s:iterator id=part value=parts status=st

   s:property value=pid/br
 
   a id=s:property value='pid'/ href=javascript:toggle(s:property 
value='pid'/)SHOW/a
 
   s:div id=s:property value='pid''/ style=display:none
 s:property value=detail/br
   /s:div   
 
/s:iterator
 
the purpose for using s:div inside s:iterator is hide/show detail
 
 
please help
 
thanks in advance
 
john

s:url pass arraylist object possible?

2013-07-19 Thread john lee


I have no problem to iterator the arrarylist

s:iterator id=part value=parts status=st

 s:property value=pid/br
/s:iterator

but if i want to pass arraylist parts back to action, can i do following?


s:url action=KeywordprocessAction.action var=keywordTag
                                s:param name=parts s:property 
value=parts / /s:param
 /s:url
             s:a href=%{keywordTag}Keyword Process/s:a

thanks in advance

john

Re: s:url pass arraylist object possible?

2013-07-19 Thread john lee
thanks
 
I think of the way to use session to carry over objects.
 


 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Friday, July 19, 2013 7:27 PM
Subject: Re: s:url pass arraylist object possible?
  

If you convert it yourself, sure. Otherwise you'd need to use the same
indexed format as form fields-all you can send from the browser are strings.
On Jul 19, 2013 5:11 PM, john lee sh_thorn_b...@yahoo.com wrote:



 I have no problem to iterator the arrarylist

 s:iterator id=part value=parts status=st

  s:property value=pid/br
 /s:iterator

 but if i want to pass arraylist parts back to action, can i do following?


 s:url action=KeywordprocessAction.action var=keywordTag
                                 s:param name=parts s:property
 value=parts / /s:param
  /s:url
              s:a href=%{keywordTag}Keyword Process/s:a

 thanks in advance

 john

struts2 jquery plugin

2013-07-12 Thread john lee


the following sample is from Struts2/Jquery plugin sample, and works perfect

in JSP, 
sj:accordion id=accordionlist list=accordion/ 
in Action

private MapString, String accordion; public String execute() throws Exception 
{ accordion = new HashMapString, String(); accordion.put(Section 1, sample 
1); accordion.put(Section 2, sample 2); accordion.put(Section 3, sample 
3); return SUCCESS; } public MapString, String getAccordion() { return 
accordion; }
The above sample for Struts2/Jquery works great.

but, 

how to escape the contents of 'Section 1 ?
i just try to use string Section 1, a href='http://www.google.com' 
google/a to replace Section 1, but render result only display text, but 
not link.
please advise
thanks in advance

john 

struts s:property br

2013-07-10 Thread john lee




in my application, the following br newline charactor never happen.


s:property value=Out of Stock BRAvg:2-5 days/  


how to let above BR take effect?

thanks

john

Re: struts s:property br

2013-07-10 Thread john lee


thanks, it works

the format is 

s:property value=Out of Stock BRAvg:2-5 days escape=false/




 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Wednesday, July 10, 2013 10:17 PM
Subject: Re: struts s:property br
 

Escape it. Check out the tag Docs.
On Jul 10, 2013 11:16 PM, john lee sh_thorn_b...@yahoo.com wrote:





 in my application, the following br newline charactor never happen.


 s:property value=Out of Stock BRAvg:2-5 days/


 how to let above BR take effect?

 thanks

 john

struts2 jquery s:div resize feature

2013-07-09 Thread john lee


I wrote an action class to return an image, and display perfect.

http://localhost/ecommerce/ImageAction?imageId=darksouls.jpg


but, when i use struts 2' jquery plugin div resize sample(just copy paste 
their demo code, but only change action at following.

s:url var=ajax value='ImageAction?imageId=darksouls.jpg' /

    sj:div href=%{ajax} indicator=indicator resizable=true 
resizableAnimate=true resizableGhost=true 
resizableHelper=ui-state-highlight resizableAspectRatio=true 
cssStyle=width: 250px; height: 180px; cssClass=ui-widget-content 
ui-corner-all
        img id=indicator src=images/indicator.gif alt=Loading... 
style=display:none/
    /sj:div

It return/display garbage char  from image, really have no idea why this 
happen, because regular call 
http://localhost/ecommerce/ImageAction?imageId=darksouls.jpg works perfect.
    
any trick to use s:j:div resize feature?


thanks in advance

john

Re: class has set member, how s:iterator to access it?

2013-07-02 Thread john lee


I use Lucas's suggestion, but still can not get value out

please advise how to get list member of an class from stack.

thanks in advance

john

    s:iterator id=partxref value=partxrefs
                          s:property value=xref_type_code/
     /s:iterator




 From: john lee sh_thorn_b...@yahoo.com
To: struts support user@struts.apache.org 
Sent: Friday, June 28, 2013 11:15 PM
Subject: class has set member,  how s:iterator to access it?
 

i have an the following 2 class

Part is just parts itself
Partxref is the accesary(component) of part.

    class Part {
                    String  manufacture;
                    String  pid;
                    private SetPartxref partxrefs=new HashSetPartxref();
                    /* set, get .here */        
            }
   
   Class Partxref {
                          Part  part;
                          int xref_type_code;
                          /* set, gethere */
                          }

  public class PartsearchAction  .. {
              ArrayListPart parts;
              public void setParts(ArrayListPart parts) { this.parts=parts; }
              public ArrayListPart getParts() { return parts; } 
               
   }

in my jsp,  the following works

              s:iterator id=part value=parts status=st
                 
                 s:property value=pid/

                 s:property value=manufacture.manu_name/
              /s:iterator

but, i try to access partxref  {component(subset) } of parts,  failed.
              s:iterator id=part value=parts status=st
                 s:property value=pid/

                 s:property value=manufacture.manu_name/

                          s:iterator id=partxref value=#part.partxrefs
                                  s:property value=#partxref.xref_type_code/
                          /s:iterator

              /s:iterator
                
Please advise how to make  set member (partxref) of Part  works, thanks in 
advance

john

how to acess sublist of list from s:iterator

2013-06-28 Thread john lee


i have an the following 2 class

Part is just parts itself
Partxref is the accesary(component) of part.

    class Part {
                    String  manufacture;
                    String  pid;
                    private SetPartxref partxrefs=new HashSetPartxref();
                    /* set, get .here */        
            }
   
   Class Partxref {
                          Part  part;
                          int xref_type_code;
                          /* set, gethere */
                          }

  public class PartsearchAction  .. {
              ArrayListPart parts;
              public void setParts(ArrayListPart parts) { this.parts=parts; }
              public ArrayListPart getParts() { return parts; } 
               
   }

in my jsp,  the following works

              s:iterator id=part value=parts status=st
                 
                 s:property value=pid/

                 s:property value=manufacture.manu_name/
              /s:iterator

but, i try to access partxref  {component(subset) } of parts,  failed.
              s:iterator id=part value=parts status=st
                 s:property value=pid/

                 s:property value=manufacture.manu_name/

                          s:subset source=parts
                                   s:iterator id=partxref value=partxrefs
                                   s:property  value=part.pid/
                                  /s:iterator
                          /s:subset

              /s:iterator
                
Please advise how to make s:set section works, thanks in advance

john


class has set member, how s:iterator to access it?

2013-06-28 Thread john lee
i have an the following 2 class

Part is just parts itself
Partxref is the accesary(component) of part.

    class Part {
                    String  manufacture;
                    String  pid;
                    private SetPartxref partxrefs=new HashSetPartxref();
                    /* set, get .here */        
            }
   
   Class Partxref {
                          Part  part;
                          int xref_type_code;
                          /* set, gethere */
                          }

  public class PartsearchAction  .. {
              ArrayListPart parts;
              public void setParts(ArrayListPart parts) { this.parts=parts; }
              public ArrayListPart getParts() { return parts; } 
               
   }

in my jsp,  the following works

              s:iterator id=part value=parts status=st
                 
                 s:property value=pid/

                 s:property value=manufacture.manu_name/
              /s:iterator

but, i try to access partxref  {component(subset) } of parts,  failed.
              s:iterator id=part value=parts status=st
                 s:property value=pid/

                 s:property value=manufacture.manu_name/

                          s:iterator id=partxref value=#part.partxrefs
                                  s:property value=#partxref.xref_type_code/
                          /s:iterator

              /s:iterator
                
Please advise how to make  set member (partxref) of Part  works, thanks in 
advance

john


OGNL s:interator index problem

2013-06-26 Thread john lee


an class

    class SearchInfo {

   String input_part;
   String search_part;
   int current_page=0;
   int total_find=0;
   int total_pages=0;
   int size=20;
   /* set, get  skip */
  }

after search, 

   session.put(searchinfo, searchinfo);

at jsp, 

   s:property value=#session.searchinfo.input_part/ returns xxx

   s:property value=#session.searchinfo.total_find/  returns 208

    s:property value=#session.searchinfo.total_pages/   returns 11

   s:property value=#session.searchinfo.current_page/    return 1 


at bottom of jsp, i need to provide the page link, such as following

  if current page is 1, the followign will display

    1,2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15,16,17,18,19

 if current page is 22, the following will display
    2139

so, i use the s:iterator to loop, but never works

    s:iterator value=%{#session.searchinfo.current_page} var=page 
begin=(#session.searchinfo.current_page/20)*20+1 
end=(#session.searchinfo.current_page/20)+20 status=status step=1
    s:property value=#stauts.index/
  /s:iterator

But, it never works

for sttut1, i used jsp to implement the above, it is straight forward, but 
struts2's OGNL looks like more complicate.

please advise

thanks in advance

john


Re: multiple form s:fielderror mesg cross over, how to solve?

2013-06-19 Thread john lee
Thanks Chester, 
   the  fieldName attribute is good remind,  that is what i am looking for.



 From: Chester Twomey chester.two...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Wednesday, June 19, 2013 9:02 AM
Subject: Re: multiple form s:fielderror mesg cross over, how to solve?
 

Are you setting the field name attribute for your s:fielderror tags?
Could you provide a sample of what you are doing in your jsp?

Another possibility is you need to short circuit your validators.

The official docs cover both these topics:
http://struts.apache.org/release/2.3.x/docs/validation.html#Validation-ShortCircuitingValidator
http://struts.apache.org/release/2.3.x/docs/fielderror.html

Please provide some code samples i can look at to help you more.

On Tue, Jun 18, 2013 at 8:56 PM, john lee sh_thorn_b...@yahoo.com wrote:
 i need to have multiple s:form on single web page,

 (at top panel, our site always provide parts search box/s:form)
 (at middle panel,  could have other form s:form such as checkout section, 
 login section, etc)

 when  any single form's validation triggered, then s:fielderror and 
 s:actionerror/ displayed at all form's textfields  place,

 how to solve it?

 or that is struts 2 bug?

 please help

 thanks in advance

 john



-- 
~Chester

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

multiple form s:fielderror mesg cross over, how to solve?

2013-06-18 Thread john lee
i need to have multiple s:form on single web page,

(at top panel, our site always provide parts search box/s:form)
(at middle panel,  could have other form s:form such as checkout section, 
login section, etc)

when  any single form's validation triggered, then s:fielderror and 
s:actionerror/ displayed at all form's textfields  place, 

how to solve it?

or that is struts 2 bug?

please help

thanks in advance

john

1 page multiple form's fields validation problem

2013-06-14 Thread john lee


for struts 2, 

    1 html page have 2 forms at different panel, each form have its own 
textfield for input and submit button as well.

the problem:
    when 1 form's textfield validation trigger, but error message display at 
both form's texfield place.
   in other words, 
      s:fielderror/
      s:actionerror/
  can not associate with its embed form, how to solve that?
  is that struts2 bug?

tks in advance

john

*

source code  

    s:form action=XAction 
       s:textfield name=name
         s:fielderror/
         s:actionerror/
       s:submit value=x_submit/
     /s:form
 
     s:form action=YAction 
       s:textfield name=age
         s:fielderror/
         s:actionerror/
       s:submit value=y_submit/
     /s:form

   for XAction-validation.xml
         validators 
     field name=name 
         field-validator type=requiredstring
           param name=trimtrue/param
           message key=errors.required / 
     /field-validator
    /field
     /validators

  for YAction-validation.xml
         validators 
     field name=age 
         field-validator type=requiredstring
           param name=trimtrue/param
           message key=errors.required / 
     /field-validator
    /field
     /validators 

multiple s:form cause validation not working, pls help

2013-06-14 Thread john lee


 i need to have multiple s:form on single web page,

when  any single form's validation triggered, then s:fielderror and 
s:actionerror/ displayed at multiple form's textfields  place, 

how to solve it?

or that is struts 2 bug?

please help

thanks in advance

john

how interceptor knowing invoke's class name?

2013-06-09 Thread john lee



in struts2 , defined an interceptor, it triggered by Action, my question is

  inside the interceptor class, what is the function call that can tell 
caller's name, because that interceptor could be triggered by different Action, 
we need to log the caller's name, but how?

thanks 

john

Re: how interceptor knowing invoke's class name?

2013-06-09 Thread john lee
tks chris, that is what i want to know



 From: Chris Pratt thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Sunday, June 9, 2013 9:55 PM
Subject: Re: how interceptor knowing invoke's class name?
 


The interceptor is called by Struts, not by the Action.  But, what I think you 
are really asking is How can I tell which Action is being processed when an 
Interceptor gets invoked?  If that's your real question, the answer is:

String name = invocation.getInvocationContext().getName();

  (*Chris*)




On Sun, Jun 9, 2013 at 7:29 PM, john lee sh_thorn_b...@yahoo.com wrote:




in struts2 , defined an interceptor, it triggered by Action, my question is

  inside the interceptor class, what is the function call that can tell 
caller's name, because that interceptor could be triggered by different 
Action, we need to log the caller's name, but how?

thanks 

john

struts2 s:button

2013-05-28 Thread john lee


%@ taglib prefix=s uri=/struts-tags%

table
trtd colspan=2
  s:if test='%{#session.PERSON != null}'
     s:button value=LogOff action=LogoffAction
     /s:button
  /s:if
  s:else if test='%{#session.PERSON ==null}'
     s:button value=Login action=LoginAction
     /s:button
  /s:else if
/td/tr
/table

but when test, in the logfile, giving the error

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /PageMenu.jsp (line: 7, column: 5) No tag 
button defined in tag library imported with prefix s
        at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
        at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
        at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:199)
        at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1215)

i check the reference, s:button is valid, if so, why not receive the error at 
above

please advise 

john

struts2 Intercepter Actioncontext

2013-05-24 Thread john lee


In an cutomized Struts2 Intercepter class, 

    public class SecurityVerifySessionIntercepter extends AbstractInterceptor
          ActionContext actionContext = invocation.getInvocationContext();
          HttpServletRequest request= (HttpServletRequest) 
actionContext.get(StrutsStatics.HTTP_REQUEST);
          Map session = actionContext.getSession();

the above program works without any problem

however,

   if i want to access WebApplicationContext, i have to get 
ServletActionContext first as the following
         WebApplicationContext 
context=WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
   the compile complain can not find ServletActionContext.

   for the regular Struts2 action class extends ActionSupport, then i have no 
problem to get ServletActionContext, but failed in Intercepter.

Question is:
 
    I already extends AbstractInterceptor for use interceptor, certainly i can 
not extends ActionSupport any more.
    then how can i access ServletActionContext in the interceptor?
    without extends Actionsupport, can i get ServletActionContext from 
ActionContext? how to convert?

please advise

john

Re: struts2 Intercepter Actioncontext

2013-05-24 Thread john lee
could you give more clue ? tks



 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Friday, May 24, 2013 2:46 PM
Subject: Re: struts2 Intercepter Actioncontext
 

It's a static class.

You may want to brush up on some Java and framework basics before
proceeding too much further-it'll save some time in the long run.

Also note that it's often faster to just try something.

Dave
On May 24, 2013 3:17 PM, john lee sh_thorn_b...@yahoo.com wrote:



 In an cutomized Struts2 Intercepter class,

     public class SecurityVerifySessionIntercepter extends
 AbstractInterceptor
           ActionContext actionContext = invocation.getInvocationContext();
           HttpServletRequest request= (HttpServletRequest)
 actionContext.get(StrutsStatics.HTTP_REQUEST);
           Map session = actionContext.getSession();

 the above program works without any problem

 however,

    if i want to access WebApplicationContext, i have to get
 ServletActionContext first as the following
          WebApplicationContext
 context=WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
    the compile complain can not find ServletActionContext.

    for the regular Struts2 action class extends ActionSupport, then i have
 no problem to get ServletActionContext, but failed in Intercepter.

 Question is:

     I already extends AbstractInterceptor for use interceptor, certainly i
 can not extends ActionSupport any more.
     then how can i access ServletActionContext in the interceptor?
     without extends Actionsupport, can i get ServletActionContext from
 ActionContext? how to convert?

 please advise

 john

struts 2 Intercepter ServletRequestAware

2013-05-23 Thread john lee
Please advise the following

for struts2, for an login action, an predefined interceptor is triggered for 
checking cookie , the code is the following

for  SecurityVerifySessionIntercepter, i implement the ServletRequestAware, but 
get null catached.

my question is:

for intercepter, Request object can not be implemented? if can, why i get null? 

thanks in advance

john 



public class SecurityVerifySessionIntercepter extends AbstractInterceptor 
implements ServletResponseAware, ServletRequestAware {

    
    protected HttpServletResponse servletResponse;
    public void setServletResponse(HttpServletResponse servletResponse)
              { this.servletResponse = servletResponse; }

    protected HttpServletRequest servletRequest;
    public void setServletRequest(HttpServletRequest servletRequest) { 
this.servletRequest = servletRequest; }

public String intercept(ActionInvocation invocation) throws Exception {

       ActionContext ctx=invocation.getInvocationContext();
      Map session= ctx.getContext().getSession();
      
         if (servletRequest==null)
             System.out.println( Request object is null catched);
          Cookie cookieList[]=servletRequest.getCookies();


Re: struts 2 Intercepter ServletRequestAware

2013-05-23 Thread john lee
it is interceptor, the following is struts.xml, (i just not include last time)

struts
 package name=default extends=struts-default

        interceptors
             interceptor name=securityverifysessionIntercepter 
class=SecurityVerifySessionIntercepter
             /interceptor
             interceptor-stack name=SecurityStack   
               interceptor-ref name=securityverifysessionIntercepter/
             /interceptor-stack
        /interceptors
        
          action name=LoginAction class=LoginAction
                    interceptor-ref name=SecurityStack/
                    result name=inputPageLogin.jsp/result
                    result name=successPageMain.jsp/result
       /package

/struts
                   



 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Thursday, May 23, 2013 4:31 PM
Subject: Re: struts 2 Intercepter ServletRequestAware
 

That interface is for actions, not interceptors.
On May 23, 2013 5:30 PM, john lee sh_thorn_b...@yahoo.com wrote:

 Please advise the following

 for struts2, for an login action, an predefined interceptor is triggered
 for checking cookie , the code is the following

 for  SecurityVerifySessionIntercepter, i implement the
 ServletRequestAware, but get null catached.

 my question is:

 for intercepter, Request object can not be implemented? if can, why i get
 null?

 thanks in advance

 john



 public class SecurityVerifySessionIntercepter extends AbstractInterceptor
 implements ServletResponseAware, ServletRequestAware {


     protected HttpServletResponse servletResponse;
     public void setServletResponse(HttpServletResponse servletResponse)
               { this.servletResponse = servletResponse; }

     protected HttpServletRequest servletRequest;
     public void setServletRequest(HttpServletRequest servletRequest) {
 this.servletRequest = servletRequest; }

 public String intercept(ActionInvocation invocation) throws Exception {

        ActionContext ctx=invocation.getInvocationContext();
       Map session= ctx.getContext().getSession();

          if (servletRequest==null)
              System.out.println( Request object is null catched);
           Cookie cookieList[]=servletRequest.getCookies();


Re: struts 2 Intercepter ServletRequestAware

2013-05-23 Thread john lee
please explain more, thanks in advance 



 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Thursday, May 23, 2013 4:53 PM
Subject: Re: struts 2 Intercepter ServletRequestAware
 

You may have misunderstood what I said.

those interfaces are for actions, not interceptors.
On May 23, 2013 5:51 PM, john lee sh_thorn_b...@yahoo.com wrote:

 it is interceptor, the following is struts.xml, (i just not include last
 time)

 struts
  package name=default extends=struts-default

         interceptors
              interceptor name=securityverifysessionIntercepter
 class=SecurityVerifySessionIntercepter
              /interceptor
              interceptor-stack name=SecurityStack
                interceptor-ref name=securityverifysessionIntercepter/
              /interceptor-stack
         /interceptors

           action name=LoginAction class=LoginAction
                     interceptor-ref name=SecurityStack/
                     result name=inputPageLogin.jsp/result
                     result name=successPageMain.jsp/result
        /package

 /struts



 
  From: Dave Newton davelnew...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Thursday, May 23, 2013 4:31 PM
 Subject: Re: struts 2 Intercepter ServletRequestAware


 That interface is for actions, not interceptors.
 On May 23, 2013 5:30 PM, john lee sh_thorn_b...@yahoo.com wrote:

  Please advise the following
 
  for struts2, for an login action, an predefined interceptor is triggered
  for checking cookie , the code is the following
 
  for  SecurityVerifySessionIntercepter, i implement the
  ServletRequestAware, but get null catached.
 
  my question is:
 
  for intercepter, Request object can not be implemented? if can, why i get
  null?
 
  thanks in advance
 
  john
 
 
 
  public class SecurityVerifySessionIntercepter extends AbstractInterceptor
  implements ServletResponseAware, ServletRequestAware {
 
 
      protected HttpServletResponse servletResponse;
      public void setServletResponse(HttpServletResponse servletResponse)
                { this.servletResponse = servletResponse; }
 
      protected HttpServletRequest servletRequest;
      public void setServletRequest(HttpServletRequest servletRequest) {
  this.servletRequest = servletRequest; }
 
  public String intercept(ActionInvocation invocation) throws Exception {
 
         ActionContext ctx=invocation.getInvocationContext();
        Map session= ctx.getContext().getSession();
 
           if (servletRequest==null)
               System.out.println( Request object is null catched);
            Cookie cookieList[]=servletRequest.getCookies();
 

Re: struts 2 Intercepter ServletRequestAware

2013-05-23 Thread john lee


thanks,

so, how can I access Cookie in the interceptor? as my knowledge, to access 
cookie, i have to get Servlet first, then get Request object, then access 
Cookie..

please advise 



john


 From: Chris Pratt thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Thursday, May 23, 2013 5:02 PM
Subject: Re: struts 2 Intercepter ServletRequestAware
 

You cannot use ServletRequestAware or ServletResponseAware in an
Interceptor.
  (*Chris*)


On Thu, May 23, 2013 at 2:58 PM, john lee sh_thorn_b...@yahoo.com wrote:

 please explain more, thanks in advance


 
  From: Dave Newton davelnew...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Thursday, May 23, 2013 4:53 PM
 Subject: Re: struts 2 Intercepter ServletRequestAware


 You may have misunderstood what I said.

 those interfaces are for actions, not interceptors.
 On May 23, 2013 5:51 PM, john lee sh_thorn_b...@yahoo.com wrote:

  it is interceptor, the following is struts.xml, (i just not include last
  time)
 
  struts
   package name=default extends=struts-default
 
          interceptors
               interceptor name=securityverifysessionIntercepter
  class=SecurityVerifySessionIntercepter
               /interceptor
               interceptor-stack name=SecurityStack
                 interceptor-ref name=securityverifysessionIntercepter/
               /interceptor-stack
          /interceptors
 
            action name=LoginAction class=LoginAction
                      interceptor-ref name=SecurityStack/
                      result name=inputPageLogin.jsp/result
                      result name=successPageMain.jsp/result
         /package
 
  /struts
 
 
 
  
   From: Dave Newton davelnew...@gmail.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Thursday, May 23, 2013 4:31 PM
  Subject: Re: struts 2 Intercepter ServletRequestAware
 
 
  That interface is for actions, not interceptors.
  On May 23, 2013 5:30 PM, john lee sh_thorn_b...@yahoo.com wrote:
 
   Please advise the following
  
   for struts2, for an login action, an predefined interceptor is
 triggered
   for checking cookie , the code is the following
  
   for  SecurityVerifySessionIntercepter, i implement the
   ServletRequestAware, but get null catached.
  
   my question is:
  
   for intercepter, Request object can not be implemented? if can, why i
 get
   null?
  
   thanks in advance
  
   john
  
  
  
   public class SecurityVerifySessionIntercepter extends
 AbstractInterceptor
   implements ServletResponseAware, ServletRequestAware {
  
  
       protected HttpServletResponse servletResponse;
       public void setServletResponse(HttpServletResponse servletResponse)
                 { this.servletResponse = servletResponse; }
  
       protected HttpServletRequest servletRequest;
       public void setServletRequest(HttpServletRequest servletRequest) {
   this.servletRequest = servletRequest; }
  
   public String intercept(ActionInvocation invocation) throws Exception {
  
          ActionContext ctx=invocation.getInvocationContext();
         Map session= ctx.getContext().getSession();
  
            if (servletRequest==null)
                System.out.println( Request object is null catched);
             Cookie cookieList[]=servletRequest.getCookies();
  


Re: struts 2 Intercepter ServletRequestAware

2013-05-23 Thread john lee
because if cookie exist, then interceptor can catch it and assign the session 
object if user open the new webpage.





 From: jlm...@gmail.com jlm...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Thursday, May 23, 2013 6:25 PM
Subject: Re: struts 2 Intercepter ServletRequestAware
 

You need to access the request directly. But why do you want to use a cookie in 
an interceptor?
Sent via BlackBerry from T-Mobile

-Original Message-
From: john lee sh_thorn_b...@yahoo.com
Date: Thu, 23 May 2013 16:20:08 
To: Struts Users Mailing Listuser@struts.apache.org
Reply-To: Struts Users Mailing List user@struts.apache.org
Subject: Re: struts 2 Intercepter ServletRequestAware



thanks,

so, how can I access Cookie in the interceptor? as my knowledge, to access 
cookie, i have to get Servlet first, then get Request object, then access 
Cookie..

please advise 



john


From: Chris Pratt thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Thursday, May 23, 2013 5:02 PM
Subject: Re: struts 2 Intercepter ServletRequestAware


You cannot use ServletRequestAware or ServletResponseAware in an
Interceptor.
  (*Chris*)


On Thu, May 23, 2013 at 2:58 PM, john lee sh_thorn_b...@yahoo.com wrote:

 please explain more, thanks in advance


 
  From: Dave Newton davelnew...@gmail.com
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Thursday, May 23, 2013 4:53 PM
 Subject: Re: struts 2 Intercepter ServletRequestAware


 You may have misunderstood what I said.

 those interfaces are for actions, not interceptors.
 On May 23, 2013 5:51 PM, john lee sh_thorn_b...@yahoo.com wrote:

  it is interceptor, the following is struts.xml, (i just not include last
  time)
 
  struts
   package name=default extends=struts-default
 
          interceptors
               interceptor name=securityverifysessionIntercepter
  class=SecurityVerifySessionIntercepter
               /interceptor
               interceptor-stack name=SecurityStack
                 interceptor-ref name=securityverifysessionIntercepter/
               /interceptor-stack
          /interceptors
 
            action name=LoginAction class=LoginAction
                      interceptor-ref name=SecurityStack/
                      result name=inputPageLogin.jsp/result
                      result name=successPageMain.jsp/result
         /package
 
  /struts
 
 
 
  
   From: Dave Newton davelnew...@gmail.com
  To: Struts Users Mailing List user@struts.apache.org
  Sent: Thursday, May 23, 2013 4:31 PM
  Subject: Re: struts 2 Intercepter ServletRequestAware
 
 
  That interface is for actions, not interceptors.
  On May 23, 2013 5:30 PM, john lee sh_thorn_b...@yahoo.com wrote:
 
   Please advise the following
  
   for struts2, for an login action, an predefined interceptor is
 triggered
   for checking cookie , the code is the following
  
   for  SecurityVerifySessionIntercepter, i implement the
   ServletRequestAware, but get null catached.
  
   my question is:
  
   for intercepter, Request object can not be implemented? if can, why i
 get
   null?
  
   thanks in advance
  
   john
  
  
  
   public class SecurityVerifySessionIntercepter extends
 AbstractInterceptor
   implements ServletResponseAware, ServletRequestAware {
  
  
       protected HttpServletResponse servletResponse;
       public void setServletResponse(HttpServletResponse servletResponse)
                 { this.servletResponse = servletResponse; }
  
       protected HttpServletRequest servletRequest;
       public void setServletRequest(HttpServletRequest servletRequest) {
   this.servletRequest = servletRequest; }
  
   public String intercept(ActionInvocation invocation) throws Exception {
  
          ActionContext ctx=invocation.getInvocationContext();
         Map session= ctx.getContext().getSession();
  
            if (servletRequest==null)
                System.out.println( Request object is null catched);
             Cookie cookieList[]=servletRequest.getCookies();
  


Cookie in struts2

2013-05-15 Thread john lee


I have no difficulty to handle cookie in struts 1, but have lots of error in 
struts 2

i have the following program


public class SecurityVerifySessionIntercepter extends AbstractInterceptor 
implements ServletResponseAware, ServletRequestAware {


Map session= ActionContext.getContext().getSession();


Cookie cookieList[]=HttpServletRequest.getCookies();

for above program, the compiler give so much error about cookie.


cannot find symbol
symbol  : class Cookie
location: class SecurityVerifySessionIntercepter
  Cookie cookieList[]=HttpServletRequest.getCookies();


non-static method getCookies() cannot be referenced from a static context
  Cookie cookieList[]=HttpServletRequest.getCookies();



please advise

thanks in advance

john

return Action.LoginAction;

2013-05-15 Thread john lee


for struts 2, 

  

   i follow the example from the web to use 'Action.x'  (xxx is actual 
action name), but the compile report the following error


cannot find symbol
symbol  : variable Action
location: class SecurityVerifySessionIntercepter
  return Action.LoginAction;  

which library i should include to use the global variable of Action ?

thanks in advance

john



import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import javax.servlet.http.Cookie;
import com.opensymphony.xwork2.ActionSupport;

public class SecurityVerifySessionIntercepter extends AbstractInterceptor 
implements ServletResponseAware, ServletRequestAware {
..

}

Re: Cookie in struts2

2013-05-15 Thread john lee
thanks, in my program, after i import it, the compile error is gone.




 From: Chris Pratt thechrispr...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Cc: john lee sh_thorn_b...@yahoo.com 
Sent: Wednesday, May 15, 2013 4:54 PM
Subject: Re: Cookie in struts2
 


Ah, my bad, you are correct, Dave.

John, like Dave pointed out, you should be using:

import javax.servlet.Cookie;

Cookie[] cookieList = ServletActionContext.getRequest().getCookies();

  (*Chris*)



On Wed, May 15, 2013 at 2:41 PM, Dave Newton davelnew...@gmail.com wrote:

(With the caveat that the interface is really for actions, while the OP
seems to be working inside an interceptor.)

Dave



On Wed, May 15, 2013 at 5:25 PM, Chris Pratt thechrispr...@gmail.comwrote:


 You might want to look into the CookiesAware interface.  It's a better way
 of accessing cookies.  Here's a good post on handling Cookies in Struts 2:
 http://omkarp.blogspot.com/2007/07/working-with-cookies-in-struts2.html
   (*Chris*)


 On Wed, May 15, 2013 at 2:14 PM, Dave Newton davelnew...@gmail.com
 wrote:

  Import the Cookie class, and get the cookies from the request, not the
  class of the request?
 
  Dave
 
 
 
  On Wed, May 15, 2013 at 4:56 PM, john lee sh_thorn_b...@yahoo.com
 wrote:
 
  
  
   I have no difficulty to handle cookie in struts 1, but have lots of
 error
   in struts 2
  
   i have the following program
  
  
   public class SecurityVerifySessionIntercepter extends
 AbstractInterceptor
   implements ServletResponseAware, ServletRequestAware {
   
  
   Map session= ActionContext.getContext().getSession();
  
  
   Cookie cookieList[]=HttpServletRequest.getCookies();
  
   for above program, the compiler give so much error about cookie.
  
  
   cannot find symbol
   symbol  : class Cookie
   location: class SecurityVerifySessionIntercepter
             Cookie cookieList[]=HttpServletRequest.getCookies();
  
  
   non-static method getCookies() cannot be referenced from a static
 context
             Cookie cookieList[]=HttpServletRequest.getCookies();
  
  
  
   please advise
  
   thanks in advance
  
   john
 
 
 
 
  --
  e: davelnew...@gmail.com
  m: 908-380-8699
  s: davelnewton_skype
  t: @dave_newton https://twitter.com/dave_newton
  b: Bucky Bits http://buckybits.blogspot.com/
  g: davelnewton https://github.com/davelnewton
  so: Dave Newton http://stackoverflow.com/users/438992/dave-newton
 




--
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton https://twitter.com/dave_newton
b: Bucky Bits http://buckybits.blogspot.com/
g: davelnewton https://github.com/davelnewton
so: Dave Newton http://stackoverflow.com/users/438992/dave-newton


struts 2 ajax choice

2013-05-13 Thread john lee


from the document,


Struts 2 support both DoJo plugin and JSON plugin, 


which one is easy to plugin and use?


which one is more powerful?

thanks in advance

john

Re: struts 2 ajax choice

2013-05-13 Thread john lee


So, JSON is the only choice ?

thanks

john




 From: Paul Benedict pbened...@apache.org
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Monday, May 13, 2013 4:43 PM
Subject: Re: struts 2 ajax choice
 

Please note the Dojo plugin is deprecated.


On Mon, May 13, 2013 at 4:42 PM, john lee sh_thorn_b...@yahoo.com wrote:



 from the document,


 Struts 2 support both DoJo plugin and JSON plugin,


 which one is easy to plugin and use?


 which one is more powerful?

 thanks in advance

 john

Re: struts 2 ajax choice

2013-05-13 Thread john lee
Dave,

so, as your experience, which one u recommend to use?

JSON or S2Jquery?

thanks in advance

john  




 From: Dave Newton davelnew...@gmail.com
To: Struts Users Mailing List user@struts.apache.org 
Cc: john lee sh_thorn_b...@yahoo.com 
Sent: Monday, May 13, 2013 5:03 PM
Subject: Re: struts 2 ajax choice
 







On Mon, May 13, 2013 at 5:56 PM, Mike Hao mike@gmail.com wrote:

Will the S2 jQuery plugin provide the similar functions as S2 dojo plugin?


The docs and examples are available on the site I linked to.
 

Is S2 jQuery plugin maintained by Struts 2 team?
 The S2 jQuery plugin I linked to is an independent project that happens to 
have at least one S2 team member on it.


It is *not* an official plugin, but it's quite a bit more recent, and better 
(IMO) than the deprecated Dojo plugin.


Could anyone give me explanation why
S2 Dojo plugin get deprecated?


Because it used a very old version of Dojo and nobody had the interest in 
upgrading and maintaining it.


Dave

struts 2 / sitemesh/ s: problem

2013-05-09 Thread john lee

 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

%@ taglib prefix=s uri=/struts-tags%

s:actionerror/
s:form action=partsearchinput
s:textfield name=partid label=partid/
s:submit value=search/
/s:form

the above code works, and verified by 
http://localhost/ecommerce/partsearchinput.jsp

but, after i start to use sitemesh, it has the problem as the following

The Struts dispatcher cannot be found.  This is usually caused by using Struts 
tags without the associated filter. Struts tags are only usable when the 
request has passed through its servlet filter, which initializes the Struts 
dispatcher needed for this tag. - [unknown location]

SEVERE: Unhandled exception occurred whilst decorating page
java.lang.RuntimeException: org.apache.jasper.JasperException: An exception 
occurred processing JSP page /partsearchinput.jsp at line 6
3:
4: %@ taglib prefix=s uri=/struts-tags%
5:
6: s:actionerror/
7: s:form action=partsearchinput
8: s:textfield name=partid label=partid/
9: s:submit value=search/



alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml

filter
filter-namestruts2/filter-name
  
filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
/filter
filter   
   filter-namesitemesh/filter-name 
  filter-classcom.opensymphony.sitemesh.webapp.SiteMeshFilter
   /filter-class 
/filter 
filter-mapping 
    filter-namesitemesh/filter-name 
 url-pattern/*/url-pattern
 dispatcherFORWARD/dispatcher   
 dispatcherREQUEST/dispatcher 
/filter-mapping
**
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/decorators # cat 
basic-theme.jsp

 %@ taglib uri=http://www.opensymphony.com/sitemesh/decorator; 
prefix=decorator %
 
%@ taglib uri=http://www.opensymphony.com/sitemesh/decorator; 
prefix=decorator%
%@ taglib uri=http://www.opensymphony.com/sitemesh/page; prefix=page%

%@ taglib prefix=s uri=/struts-tags%
 
    body
 table width=100% height=100%
   tr td 
 %@ include file=/partsearchinput.jsp%
   /td/tr
   tr td 
   decorator:body /    hr /
   /td/tr
   tr td h2 pfont color=blueCopyright X/font/p  
/h2 /td/tr
 /table
    /body
  
***
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat decorators.xml
decorators defaultdir=/decorators 
   
   decorator name=basic-theme page=basic-theme.jsp 
   pattern/menu.jsp/pattern 
   /decorator
  /decorators
**
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat partsearchinput.jsp

%@ taglib prefix=s uri=/struts-tags%
s:actionerror/
s:form action=partsearchinput
s:textfield name=partid label=partid/
s:submit value=search/
/s:form
***
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat menu.jsp

    body   
 h1test/p
   /body

struts 2 session question

2013-05-08 Thread john lee
 
for stuts 1, to get session, via the following
 
  session=request.getSession();
  session.setAttribute(PERSON, person);    /* person is object name */
 
for struts 2, to get session, via the following
 
  Map session=ActionContext.getContext().getSession();
  session.put(PERSON, person);/* person is object name */
 
question is
   
    for struts2: if i use the following
  session.setAttribute(PERSON, person);    
    then compile to get following error
    
   cannot find symbol
   symbol  : method 
setAttribute(java.lang.String,neuco.Person)
    location: interface java.util.Map
    session.setAttribute
 
   is that means for struts2, when i use session, i have to use session.put, 
but session.setAttribute is no longer valid?
   what is the difference b/w session.put and session.setAttribute?
 
thanks in advance
 
john

struts 2 presentation layer

2013-03-11 Thread john lee
struts 2 presentation layer


support JSP, freemaker 

as i know.

does it support PHP?

what is the presentation layer it support?

thanks

john




 From: Martin Gainty mgai...@hotmail.com
To: Struts Users Mailing List user@struts.apache.org 
Sent: Monday, March 11, 2013 5:33 AM
Subject: RE: struts 2 start problem struts2-gxp-plugin-2.3.7.jar
 
rename struts2-gxp-plugin-2.3.7.jar e.g.

mv 
/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar
 
/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar.old

or delete  struts2-gxp-plugin-2.3.7.jar 

stop your session and redeploy usually works BUT i would bounce the server just 
ot make sure you start ecommerce webapp clean

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: Sun, 10 Mar 2013 20:32:41 -0700
 From: sh_thorn_b...@yahoo.com
 Subject: struts 2 start problem struts2-gxp-plugin-2.3.7.jar
 To: user@struts.apache.org
 
 i try to start tomcat, but giving the following error
 
 Unable to load configuration... struts2-gxp-plugin-2.3.7.jar...
 
 in the CLASSPTH, i even did not load struts2-gxp-plugin-2.3.7.jar at all, why 
 this happen?
 
 please advise
 
 thanks in advance
 
 john
 
 
 SEVERE: Dispatcher initialization failed
 Unable to load configuration. - bean - 
 jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar!/struts-plugin.xml:8:162
         at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:71)
         at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
         at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
         at 
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
         at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
         at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
         at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
         at 
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
         at 
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:104)
         at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
         at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
         at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
         at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
         at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
         at java.util.concurrent.FutureTask.run(FutureTask.java:138)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
         at java.lang.Thread.run(Thread.java:662)
 Caused by: Unable to load bean: 
 type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer 
 class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - 
 jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar!/struts-plugin.xml:8:162
         at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
         at 
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
         at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
         at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:68)
         ... 18 more
 Caused by: java.lang.ClassNotFoundException: 
 org.apache.struts2.views.gxp.inject.InjectedObjectContainer
         at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
         at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
         at 
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
         at 

struts 2 session share

2013-03-10 Thread john lee


after user login our e-commerce site successfuly, he was granted an session.

his shopping cart is saved into an session object.

sometimes, customer need help for his shopping cart, in order to do that, we 
need to access his cart/session object.

how can we do session share in struts2 ? in other words,we need to save 
sth(such as the accessary parts)  in his shopping cart..


any example?

thanks in advance

john  

struts 2 start problem struts2-gxp-plugin-2.3.7.jar

2013-03-10 Thread john lee
i try to start tomcat, but giving the following error

Unable to load configuration... struts2-gxp-plugin-2.3.7.jar...

in the CLASSPTH, i even did not load struts2-gxp-plugin-2.3.7.jar at all, why 
this happen?

please advise

thanks in advance

john


SEVERE: Dispatcher initialization failed
Unable to load configuration. - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar!/struts-plugin.xml:8:162
    at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:71)
    at 
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
    at 
org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at 
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
    at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:278)
    at 
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
    at 
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:383)
    at 
org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilterConfig.java:104)
    at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
Caused by: Unable to load bean: 
type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer 
class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - 
jar:file:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-gxp-plugin-2.3.7.jar!/struts-plugin.xml:8:162
    at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:245)
    at 
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
    at 
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
    at 
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:68)
    ... 18 more
Caused by: java.lang.ClassNotFoundException: 
org.apache.struts2.views.gxp.inject.InjectedObjectContainer
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at 
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    at 
com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:152)
    at 
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:216)
    ... 21 more


alpha:/var/apache-tomcat-7.0.34/logs # env  |grep CLASSPATH

CLASSPATH=/usr/java/jdk1.6.0/lib/dt.jar:/usr/java/jdk1.6.0/lib/tools.jar:/var/apache-tomcat-7.0.34/lib:/var/apache-tomcat-7.0.34/lib/jsp-api.jar:/var/apache-tomcat-7.0.34/lib/servlet-api.jar:/var/apache-tomcat-7.0.34/lib/mysql-connector-java-5.0.5-bin.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/c3p0-0.9.2-pre8.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-fileupload-1.2.2.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-io-2.0.1.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-lang-2.4.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-lang3-3.1.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-logging-1.1.1.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-logging-api-1.1.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/commons-validator-1.3.1.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/json-lib-2.3
-jdk15.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/ognl-3.0.5.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/struts2-core-2.3.7.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/freemarker-2.3.19.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/xwork-core-2.3.7.jar:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/lib/javassist-3.11.0.GA.jar


Re: struts 2 validation if use with spring

2013-03-08 Thread john lee
Lukasz,

thanks for your help, i just tried, but still not works

any other suggestion?

thanks in advance

john





 From: Lukasz Lenart lukaszlen...@apache.org
To: Struts Users Mailing List user@struts.apache.org 
Sent: Friday, March 8, 2013 12:01 AM
Subject: Re: struts 2 validation if use with spring
 
2013/3/8 john lee sh_thorn_b...@yahoo.com:
                  action name=signin class=loginAction

As specified in the docs [1][2], validation file name must match schema:

class-name-validation.xml - LoginAction-signin-validation.xml

[1] 
http://struts.apache.org/development/2.x/docs/validation.html#Validation-DefiningValidationRules
[2] 
http://struts.apache.org/development/2.x/docs/struts-2-spring-2-jpa-ajax.html


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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

Re: struts 2 validation if use with spring

2013-03-08 Thread john lee
Luckasz, 


thanks for your great help, 


i just checked your demo, looks like the first tricky is to define proxy action 
name signin in struts.xml


struts.xml

action name=signin method=signin class=loginAction
  result name=input/example/Login.jsp/result
  result type=redirectActionWelcome/result
    /action



and second tricky to define signin method in the file LoginAction.java


LoinAction.java
...

public String signin() {
    return SUCCESS;
    }
...



my question next is:

why can not use  Login-validation.xml directly ? but have to use your proxy 
method to work around?

is this the only way to lett struts2/spring validation works?

thanks so much in advance

john







 From: Lukasz Lenart lukaszlen...@apache.org
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Friday, March 8, 2013 7:27 AM
Subject: Re: struts 2 validation if use with spring
 
2013/3/8 john lee sh_thorn_b...@yahoo.com:
 Lukasz,

 thanks for your help, i just tried, but still not works

 any other suggestion?

I have prepared a small demo app
https://github.com/lukaszlenart/struts2-spring-validation


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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

struts 2 validation if use with spring

2013-03-07 Thread john lee




Problem
 
I use struts2/spring 3 as integration, and need to use struts2
validation.xml as well, 
Basically, the action name in the login.jsp/struts.xml  is pseudo class name, 
but is implemented in
the applicationContext.xml
In order to let validation.xml works, I defined  all the possible 
XXXvalidation.xml for both matched
psesuo action class name and actually class name, but looks like no one works.
Is XXXvalidation.xml only works for struts2 actual class
name only? But not works if used in struts2/spring proxy action forward?
Pelase   advise.
 
john
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat
login.jsp

%@ taglib prefix=s
uri=/struts-tags%
s:actionerror/
s:form action=signin
s:textfield name=loginId
label=login/
s:textfield name=password
label=password/
s:submit value=logint/
/s:form  
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF
# cat applicationContext.xml
……
bean
id=loginAction class=neuco.AcctAction
scope=prototype /bean


 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes
# cat struts.xml

!DOCTYPE struts PUBLIC    -//Apache Software Foundation//DTD
Struts Configuration 2.0//EN
    http://struts.apache.org/dtds/struts-2.0.dtd;   
struts
    package
name=default extends=struts-default
 action name=signin class=loginAction
    result
name=successsuccess.jsp/result
    result
name=errorlogin.jsp/result
    /action 
 /package/struts
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/src/neuco
# cat AcctAction.java

package neuco;
public class AcctAction extends
ActionSupport {
  private
String loginId;
  private String password;
  public void setLoginId(String loginId) { this.loginId=loginId; }
  public void setPassword(String password) { this.password=password; }
  public String getLoginId() { return loginId; }
  public String getPassword() { return password; }
 
     public String execute() throws
Exception {
  Map
session=ActionContext.getContext().getSession();
      if (login.equals(test ) ) {
   session.put(loginid,login_return);
   addActionMessage(Login
Success);
   return success;
   }
    else
   addActionError(loginid/password
not match);
    return error;
  }  
 
}   
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes
# cat  Signin-Validation.xml

!DOCTYPE validators PUBLIC
-//Apache Struts//XWork Validator 1.0.3//EN    
http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd;
validators 
 field name=loginId 
 field-validator
type=requiredstring
    param
name=trimtrue/param 
   message=errors.required /   
 /field-validator
    /field
/validators   
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes
# ls *Validation.xml
AcctAction-Validation.xml  LoginAction-Validation.xml  Signin-Validation.xml
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes/neuco
# ls *Validation.xml
AcctAction-Validation.xml  LoginAction-Validation.xml  Signin-Validation.xml

struts 2 validation error

2013-03-06 Thread john lee


please advise


thanks in advance

john


**

error:

Template processing error: Method public java.util.List 
org.apache.struts2.components.Form.getValidators(java.lang.String) threw an 
exception when invoked on org.apache.struts2.components.Form@d6147e

Method public java.util.List 
org.apache.struts2.components.Form.getValidators(java.lang.String) threw an 
exception when invoked on org.apache.struts2.components.Form@d6147e
The problematic instruction:
--
== list tag.getValidators(${tagName}) as validator [on line 46, column 9 in 
template/xhtml/form-close-validate.ftl]
 in include /${parameters.templateDir}/xhtml/form-close-validate.ftl [on line 
25, column 1 in template/xhtml/form-close.ftl]
--

Java backtrace for programmers:
--
freemarker.template.TemplateModelException: Method public java.util.List 
org.apache.struts2.components.Form.getValidators(java.lang.String) threw an 
exception when invoked on org.apache.struts2.components.Form@d6147e
    at 
freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
    at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)


*



alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat login.jsp

%@ taglib prefix=s uri=/struts-tags%
   
s:actionerror/
s:form action=signin validate=true
s:textfield name=loginId label=login/
s:textfield name=password label=password/
s:submit value=logint/
/s:form

*
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
struts.xml

?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=default extends=struts-default
 
    action name=signin class=loginAction
    result name=successsuccess.jsp/result
    result name=errorlogin.jsp/result
    /action
 
 /package

/struts

*

alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
signin-valition.xml
!DOCTYPE validators PUBLIC -//Apache Struts//XWork Validator 1.0.3//EN    
http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd;

validators 
 field name=loginId 
 field-validator type=requiredstring
    param name=trimtrue/param 
   message=errors.required /   
 /field-validator
    /field
/validators

Struts 2 - java.lang.ClassNotFoundException

2013-03-05 Thread john lee





I use struts at 
webserver, and create proxy action , that proxy action forward to 
spring, but when executed result is the following 
 
please advise
 
thanks in advance
 
john
 
[CODE]
Struts Problem Report
Struts has detected an unhandled exception: 
Messages: loginAction 
Invalid action class configuration that references an unknown class named 
[loginAction] 
Stacktraces
java.lang.RuntimeException: Invalid action class configuration that references 
an unknown class named [loginAction] 
java.lang.ClassNotFoundException: loginAction 
[/CODE]
 
[CODE]
  alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce # cat login.jsp
s:actionerror/
s:form action=login
s:textfield name=loginId label=login/
s:textfield name=password label=password/
s:submit value=logint/
/s:form
[/CODE]
 
[CODE]
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat web.xml
web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xmlns=http://java.sun.com/xml/ns/javaee; 
xmlns:web=http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; 
xsi:schemaLocation=http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; id=WebApp_ID version=2.5
filter
filter-namestruts2/filter-name
filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter/filter-class
/filter
listener
listener-classorg.springframework.web.context.ContextLoaderListener/listener-class
/listener
filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping
context-param 
  param-namecontextConfigLocation/param-name 
  param-value/WEB-INF/applicationContext.xml/param-value 
/context-param 
/web-app
[/CODE]

[CODE]
   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
struts.xml
   
struts
  include file=struts-default.xml/
  constant name=struts.enable.DynamicMethodInvocation value=false /
  constant name=struts.devMode value=true /
  constant name=struts.objectFactory value=spring /
  package name=default extends=struts-default
 action name=login class=loginAction
    result name=successsuccess.jsp/result
    result name=errorerror.jsp/result
    /action
 /package
/struts[/CODE]
 
 
[CODE]
   alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # cat 
applicationContext.xml
    
bean id=sessionFactory 
class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
  property name=dataSource ref=dataSource/
  property name=mappingResources
    list
    valueAcctsecurity.hbm.xml/value
    /list
  /property
   /bean   
bean id=loginAction class=neuco.AcctAction scope=prototype
    property name=mgr ref=acctmgr/
/bean

bean id=acctsecurityDao class=neuco.AcctsecurityDaoHibernate
    property name=sessionFactory ref=sessionFactory/
/bean
bean id=acctmgr class=neuco.AcctManagerImpl
    property name=acctsecurityDao ref=acctsecurityDao/
/bean
bean id=transactionManager 
class=org.springframework.orm.hibernate3.HibernateTransactionManager
 property name=sessionFactory ref=sessionFactory/
/bean
tx:advice id=txAdvice transaction-manager=transactionManager 
  tx:attributes
 tx:method name=get* read-only=true/
 tx:method name=*/
  /tx:attributes
/tx:advice
aop:config
   aop:pointcut id=leePointcut expression=execution(* neuco.*Impl.*(..))/
   aop:advisor advice-ref=txAdvice pointcut-ref=leePointcut/
/aop:config
/beans
[/CODE]
 
[CODE]
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes/neuco # ls 
*.class
AcctAction.class   AcctManagerImpl.class  AcctsecurityDao.class
AcctManager.class  Acctsecurity.class AcctsecurityDaoHibernate.class
[/CODE] 


struts2/spring Parameter is on the excludeParams list of patterns!

2013-03-03 Thread john lee




The input 
   http://localhost:8080/ecommerce/login.jsp

The Output
    login is succcese Sun Mar 03
01:01:16 CST 2013

problem
 

   
login.jsp-loginAction-struts.xml-applicationContext.xml-loginAction-neuco.AcctAction-inject
  acctsmgr-….- 
 
  but  in the AcctAction.java, 
    public String Execute() throws
Exception {neuco.AcctAction
        System.out.println(loginId=+getLoginId()+\n);
 System.out.println(password=+getPassword()+\n);
  System.out.println(here\n);


   In the logfile , it should display my input
from login.jsp, but it did not show up at all, instead, shows warning 
    WARNING: Parameter [loginId] is on the
excludeParams list of patterns!
    Mar 3, 2013 12:57:58 PM
com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
   WARNING: Parameter [password] is on the
excludeParams list of patterns!

So, looks like
neuco.AcctAction is not triggered/initiated by spring assmeble, otherwise it
should display debug info, but if not triggered, how come it return “success”
to success.jsp ?
 
Please help
  

 alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce
# cat login.jsp
%@ taglib prefix=s uri=/struts-tags%

s:actionerror/
s:form action=login
s:textfield name=loginId
label=login/
s:textfield name=password
label=password/
s:submit value=logint/
/s:form
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce
# cat success.jsp
login is succcese %= new java.util.Date() %
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes
# cat struts.xml

struts
    constant
name=struts.objectFactory value=spring/
  package
name=neuco extends=struts-default
     action name=login
class=loginAction
    result name=successsuccess.jsp/result
    result name=errorerror.jsp/result
    /action
 /package

alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
struts.xml
   
struts
  constant name=struts.devMode value=true /
  constant name=struts.objectFactory value=spring/
  package name=neuco extends=struts-default
    action name=login class=loginAction
    result name=successsuccess.jsp/result
    result name=errorerror.jsp/result
    /action
 
 /package
/struts


alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF
# cat applicationContext.xml.

bean id=dataSource
class=com.mchange.v2.c3p0.ComboPooledDataSource
destroy-method=close.

/bean
bean id=sessionFactory
class=org.springframework.orm.hibernate3.LocalSessionFactoryBean
  property
name=dataSource ref=dataSource/
  property
name=mappingResources
    list    valueAcctsSecurity.hbm.xml/value    /list
  /property
 /bean    
bean
id=loginAction class=neuco.AcctAction
scope=prototype
    property name=mgr
ref=acctsmgr/
/bean
bean id=acctssecurityDao
class=neuco.AcctsecurityDaoHibernate
    property
name=sessionFactory ref=sessionFactory/
/bean
bean
id=acctsmgr class=neuco.AcctManagerImpl
    property
name=acctsecurityDao ref=acctssecurityDao/
/bean
bean id=transactionManager
class=org.springframework.orm.hibernate3.HibernateTransactionManager
 property
name=sessionFactory ref=sessionFactory/
/bean
 
tx:advice id=txAdvice
transaction-manager=transactionManager 
  tx:attributes
 tx:method
name=get* read-only=true/
 tx:method
name=*/
  /tx:attributes
/tx:advice
aop:config
   aop:pointcut
id=leePointcut expression=execution(*
neuco.*Impl.*(..))/
   aop:advisor
advice-ref=txAdvice pointcut-ref=leePointcut/
/aop:config
/beans

alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/src/neuco # cat 
AcctAction.java
package neuco;


/**   lot of  import *  */

public class AcctAction extends ActionSupport {

  protected AcctManager mgr;
  private String loginId;
  private String password;

  String login_return=null;
 
  public void setMgr(AcctManager mgr) { this.mgr=mgr; }

  public void setLoginId(String loginId) { this.loginId=loginId; }
  public void setPassword(String password) { this.password=password; }
  
  public String getLoginId() { return loginId; }
  public String getPassword() { return password; }

 public String Execute() throws Exception {
    System.out.println(loginId=+getLoginId()+\n);
    System.out.println(password=+getPassword()+\n);
    System.out.println(here\n);
    Map session=ActionContext.getContext().getSession();
    login_return=mgr.loginValid(getLoginId(), getPassword());
    if (login_return !=null ) {
   session.put(loginid,login_return);
   addActionMessage(Login Success);
   return SUCCESS;
   }
    else
   addActionError(loginid/password not match);
    return failure;
  }  

}


struts2+hiberate org.hibernate.cfg.Configuration

2012-12-14 Thread john lee
i am new to struts2+hiberate,  i can successfuly make struts2 sample project 
working, but not hiberate, i just make an simple test program, and compile is 
good, but when execute, the error is at following, the project tree is also 
include
 
please help, thanks in advance
 
 
 
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # java Test
 
Dec 14, 2012 2:56:28 PM org.hibernate.cfg.Configuration 
getConfigurationInputStream
INFO: HHH40: Configuration resource: /hibernate.cfg.xml
Exception in thread main org.hibernate.MappingException: invalid configuration
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2018)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1935)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
    at Test.main(Test.java:12)
Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
    at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # ls -R
.:
classes  compile.sh  lib  src  web.xml  
 
./classes:
Student.hbm.xml  Test.class  example  hibernate.cfg.xml    struts.xml
 
./classes/example:
Student.class
 
./lib:
commons-fileupload-1.2.2.jar  freemarker-2.3.19.jar   
ognl-3.0.5.jar
commons-io-2.0.1.jar  hibernate-commons-annotations-4.0.1.Final.jar   
spring-test-3.0.5.RELEASE.jar
commons-lang-2.4.jar  hibernate-core-4.1.8.Final.jar  
struts2-core-2.3.7.jar
commons-lang3-3.1.jar javassist-3.11.0.GA.jar 
xwork-core-2.3.7.jar
commons-logging-1.1.1.jar jboss-logging-3.1.0.GA.jar
dom4j-1.6.1.jar   jboss-transaction-api_1.1_spec-1.0.0.Final.jar
 
./src:
example
 
./src/example:
Student.java  Test.java  
 
*
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
Student.hbm.xml
 
?xml version=1.0?
    !DOCTYPE hibernate-mapping PUBLIC
    -//Hibernate/Hibernate Mapping DTD 3.0//EN
    http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd;
 
hibernate-mapping
    class name=example.Student table=student
    id name=studentId column=student_id
    generator class=increment /
    /id
    property name=firstName type=string column=first_name /
    property name=lastName type=string column=last_name /
    property name=address type=string column=address /
    /class
/hibernate-mapping
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
hibernate.cfg.xml
hibernate-configuration
 
    session-factory
 
    property 
name=connection.driver_classcom.mysql.jdbc.Driver/property
    property 
name=connection.urljdbc:mysql://10.1.1.37/mytest/property
    property name=connection.usernametest/property
    property name=connection.passwordpassword/property
 
    property 
name=dialectorg.hibernate.dialect.MySQLInnoDBDialect/property
 
    property name=show_sqltrue/property
 
 
    mapping resource=Student.hbm.xml/
 
    /session-factory
 
/hibernate-configuration
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/src/example # cat 
Test.java
 
import org.hibernate.Session;
import example.Student;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
 
public class Test {
    public static void main(String[] args) {
    //Session session = 
HibernateUtil.getSessionFactory().getCurrentSession();
 
    Configuration conf=new Configuration().configure();
    SessionFactory sf=conf.buildSessionFactory();
    Session session=sf.openSession();
    session.beginTransaction(); 
    Student s = new Student(firstname, lastname, address);
    session.save(s);
    session.getTransaction().commit();
    }
}
 
 
mysql desc student;
++-+--+-+-++
| Field  | Type    | Null | Key | Default | Extra  |
++-+--+-+-++
| student_id | bigint(10) unsigned | NO   | PRI | NULL    | auto_increment | 
| first_name | varchar(50) | YES  | | NULL    |    | 
| last_name  | varchar(50) | YES  | | NULL    |    | 
| address    | varchar(50) | YES  | | NULL    |    | 
++-+--+-+-++
4 rows in set (0.00 sec)

Re: struts2+hiberate org.hibernate.cfg.Configuration

2012-12-14 Thread john lee
tks for reply.
 
it is at local, no proxy, no firwall
 
also, i just change to SYSTEM for give an try, but also receive same error 
message.
 
 



From: Jeff Black jeffrey.bl...@yahoo.com
To: Struts Users Mailing List user@struts.apache.org; john lee 
sh_thorn_b...@yahoo.com 
Sent: Friday, December 14, 2012 2:44 PM
Subject: Re: struts2+hiberate org.hibernate.cfg.Configuration 


John,

Are you behind a proxy?

Double-check that you can access the DTD from your system.

You might consider changing your DOCTYPE to reference the DTD contained in your 
Hibernate.jar (i.e. from PUBLIC to SYSTEM) so it won't try to look things up 
remotely.

Best,

Jeff






From: john lee sh_thorn_b...@yahoo.com
To: user@struts.apache.org user@struts.apache.org 
Sent: Friday, December 14, 2012 1:46 PM
Subject: struts2+hiberate org.hibernate.cfg.Configuration 

i am new to struts2+hiberate,  i can successfuly make struts2 sample project 
working, but not hiberate, i just make an simple test program, and compile is 
good, but when execute, the error is at following, the project tree is also 
include
 
please help, thanks in advance
 
 
 
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # java Test
 
Dec 14, 2012 2:56:28 PM org.hibernate.cfg.Configuration 
getConfigurationInputStream
INFO: HHH40: Configuration resource: /hibernate.cfg.xml
Exception in thread main org.hibernate.MappingException: invalid configuration
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2018)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1935)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1914)
    at Test.main(Test.java:12)
Caused by: org.xml.sax.SAXParseException: Document is invalid: no grammar found.
    at 
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF # ls -R
.:
classes  compile.sh  lib  src  web.xml  
 
./classes:
Student.hbm.xml  Test.class  example  hibernate.cfg.xml    struts.xml
 
./classes/example:
Student.class
 
./lib:
commons-fileupload-1.2.2.jar  freemarker-2.3.19.jar   
ognl-3.0.5.jar
commons-io-2.0.1.jar  hibernate-commons-annotations-4.0.1.Final.jar   
spring-test-3.0.5.RELEASE.jar
commons-lang-2.4.jar  hibernate-core-4.1.8.Final.jar  
struts2-core-2.3.7.jar
commons-lang3-3.1.jar javassist-3.11.0.GA.jar 
xwork-core-2.3.7.jar
commons-logging-1.1.1.jar jboss-logging-3.1.0.GA.jar
dom4j-1.6.1.jar   jboss-transaction-api_1.1_spec-1.0.0.Final.jar
 
./src:
example
 
./src/example:
Student.java  Test.java  
 
*
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
Student.hbm.xml
 
?xml version=1.0?
    !DOCTYPE hibernate-mapping PUBLIC
    -//Hibernate/Hibernate Mapping DTD 3.0//EN
    http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd;
 
hibernate-mapping
    class name=example.Student table=student
    id name=studentId column=student_id
    generator class=increment /
    /id
    property name=firstName type=string column=first_name /
    property name=lastName type=string column=last_name /
    property name=address type=string column=address /
    /class
/hibernate-mapping
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/classes # cat 
hibernate.cfg.xml
hibernate-configuration
 
    session-factory
 
    property 
name=connection.driver_classcom.mysql.jdbc.Driver/property
    property 
name=connection.urljdbc:mysql://10.1.1.37/mytest/property
    property name=connection.usernametest/property
    property name=connection.passwordpassword/property
 
    property 
name=dialectorg.hibernate.dialect.MySQLInnoDBDialect/property
 
    property name=show_sqltrue/property
 
 
    mapping resource=Student.hbm.xml/
 
    /session-factory
 
/hibernate-configuration
 
 
alpha:/var/apache-tomcat-7.0.34/webapps/ecommerce/WEB-INF/src/example # cat 
Test.java
 
import org.hibernate.Session;
import example.Student;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
 
public class Test {
    public static void main(String[] args) {
    //Session session = 
HibernateUtil.getSessionFactory().getCurrentSession();
 
    Configuration conf=new Configuration().configure();
    SessionFactory sf=conf.buildSessionFactory();
    Session session=sf.openSession();
    session.beginTransaction(); 
    Student s = new Student(firstname, lastname, address);
    session.save(s

struts 1.x webservice question

2010-06-16 Thread john lee
how can i implement webservice inside the struts 1.x application?
 
if i need to implement webservice server, which library need to download or use?
 
if i need to implment websrvice client only, which libary need to call ?
 
should i download apache AXIS as requirement ?
 
tks in advance
 
john


  

struts 2, how to trigger interceptor after action's execute() ?

2010-04-03 Thread john lee
 
***
package name=me extends=struts-default
  interceptors
   interceptor name=mysimple class=mysimple
  param name=name try /param
/interceptor
 /interceptors
 
 action name=try class=try
 result name=success=/success.jsp/result
 interceptor-ref name=mysimple
    param name=name try 2/param
/interceptor
/action
 

the above code triggers interceptor before class try's execute(), and the 
purpose of interceptor,
But, how to trigger interceptor again after class try's execute() ? i check the 
stuts 2 document, 
it just saying interceptor can trigger before and after execute, but never give 
the example for how to do it after execute(), 
 
anyone can help?
 
tks in advance
 
john


  

Re: struts 2 - framework question

2010-03-08 Thread john lee
Cimballi,
 
tks for your help, but i do not  quite understand about '...set the parameter 
statically in the action definitions...',  would you demonstrate me couple line 
of psudo code to explain this?
 
tks in advance
 
john



/7/10, Cimballi cimba...@cimballi.net wrote:


From: Cimballi cimba...@cimballi.net
Subject: Re: struts 2 - framework question
To: john lee sh_thorn_b...@yahoo.com
Cc: Struts Users Mailing List user@struts.apache.org
Date: Sunday, March 7, 2010, 8:33 PM


John, I don't have immediate code that I can copy paste, but I can
explain a bit more the package solution.

You will have to declare 2 packages, one with namespace store1 and
one with namespace store2.
Then you can write a single action, which take a storeId paramter, and
you set the parameter statically in the action definitions.

You will need 2 action definitions, one in each package, calling the
same java action and setting the storeId parameter like said before.

Then, in each JSP for each store, you call the correct struts action.

Is it clear for you ?

Cimballi


On Sun, Mar 7, 2010 at 11:36 AM, john lee sh_thorn_b...@yahoo.com wrote:



 possible for you to show some psedo code for how to do it?

 tks in advance

 john
 --- On Sun, 3/7/10, Paweł Wielgus poulw...@gmail.com wrote:

 From: Paweł Wielgus poulw...@gmail.com
 Subject: Re: struts 2 - framework question
 To: Struts Users Mailing List user@struts.apache.org, 
 cimba...@cimballi.net
 Date: Sunday, March 7, 2010, 1:59 AM

 Hi All,
 You can also have N applications representing stores under names 
 store1..storeN,
 where one application just knows about itself and all applications are
 identical in code but different in data and css maybe.

 Best greetings,
 Paweł Wielgus.


 2010/3/7 Cimballi cimballi.cimba...@gmail.com:
  John, you can use namespaces at the package level to distinguish your 
  stores.
  You can also do that in a rest way, like http://www.xyz.com/store/1.
 
  Cimballi
 
 
  On Sat, Mar 6, 2010 at 11:18 PM, john lee sh_thorn_b...@yahoo.com wrote:
 
  my company is distributor, we plan to provide platform for our 
  customer(different store) to sell their product to indivual customers.
 
  http://www.xyz.om/store1
  http://www.xyz.com/store2
  http://www.xyz.com/store3
  ...
  http://www.xyz.com/storeN
 
  (store1...storeN) list our(distributor)'s product to their customer, when 
  customer see the display price, the display price=our price(base 
  price)+storeX's margin
 
  my question is the following
 
  a. in the struts.xml, different store should have different package 
  defination ?
 
  b. in the application, what is the struts2's method to detect which store? 
  in other words, how can i detect which link(http://www.xyz.om/store1 or 
  store2 or store3) is pass in ? without knowing which store is called, i 
  can not call special routine(could be price cal, ...) associated with that 
  store.
 
  any good idea to approach this?
 
  tks in advance
 
  john
 
 
 
 
  -
  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



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




  

Re: struts 2 - framework question

2010-03-08 Thread john lee
how apache/struts 2 handle multiple domain as your explain? could you explain 
in some detail? tks in advance
 
john 

--- On Mon, 3/8/10, stanl...@gmail.com stanl...@gmail.com wrote:


From: stanl...@gmail.com stanl...@gmail.com
Subject: Re: struts 2 - framework question
To: Struts Users Mailing List user@struts.apache.org
Date: Monday, March 8, 2010, 6:51 AM


If each company will have their own domain name this will solve itself.

On Sat, Mar 6, 2010 at 10:18 PM, john lee sh_thorn_b...@yahoo.com wrote:


 my company is distributor, we plan to provide platform for our
 customer(different store) to sell their product to indivual customers.

 http://www.xyz.om/store1
 http://www.xyz.com/store2
 http://www.xyz.com/store3
 ...
 http://www.xyz.com/storeN

 (store1...storeN) list our(distributor)'s product to their customer, when
 customer see the display price, the display price=our price(base
 price)+storeX's margin

 my question is the following

 a. in the struts.xml, different store should have different package
 defination ?

 b. in the application, what is the struts2's method to detect which store?
 in other words, how can i detect which link(http://www.xyz.om/store1 or
 store2 or store3) is pass in ? without knowing which store is called, i can
 not call special routine(could be price cal, ...) associated with that
 store.

 any good idea to approach this?

 tks in advance

 john






  

Re: struts 2 - framework question

2010-03-08 Thread john lee
possible for you to show me the psudo code for how to do it?
 
tks in advance
 
john

--- On Mon, 3/8/10, emil thushanga thusha...@gmail.com wrote:


From: emil thushanga thusha...@gmail.com
Subject: Re: struts 2 - framework question
To: Struts Users Mailing List user@struts.apache.org
Date: Monday, March 8, 2010, 3:39 AM


Hi ,

You can define interceptors for each namespace.

Emil

On Mon, Mar 8, 2010 at 3:19 PM, Alex Rodriguez Lopez
alo...@flordeutopia.pt wrote:
 It looks to me that you could use a combination of packages for each store
 with different namespaces, but to save code repetition it would be good idea
 to use wildcards (or go for the restful way as already suggested) in the
 config files and later on the action retrieve the full url to see which
 store the request comes from.

 What helped me a lot to work with only some mappings (using wildcards) and
 only some actions is this book, listed in Struts2 docs, which is freely
 downloable: http://www.infoq.com/minibooks/starting-struts2

 Alex

 Em 08-03-2010 02:33, Cimballi escreveu:

 John, I don't have immediate code that I can copy paste, but I can
 explain a bit more the package solution.

 You will have to declare 2 packages, one with namespace store1 and
 one with namespace store2.
 Then you can write a single action, which take a storeId paramter, and
 you set the parameter statically in the action definitions.

 You will need 2 action definitions, one in each package, calling the
 same java action and setting the storeId parameter like said before.

 Then, in each JSP for each store, you call the correct struts action.

 Is it clear for you ?

 Cimballi


 On Sun, Mar 7, 2010 at 11:36 AM, john leesh_thorn_b...@yahoo.com  wrote:



 possible for you to show some psedo code for how to do it?

 tks in advance

 john
 --- On Sun, 3/7/10, Paweł Wielguspoulw...@gmail.com  wrote:

 From: Paweł Wielguspoulw...@gmail.com
 Subject: Re: struts 2 - framework question
 To: Struts Users Mailing Listuser@struts.apache.org,
 cimba...@cimballi.net
 Date: Sunday, March 7, 2010, 1:59 AM

 Hi All,
 You can also have N applications representing stores under names
 store1..storeN,
 where one application just knows about itself and all applications are
 identical in code but different in data and css maybe.

 Best greetings,
 Paweł Wielgus.


 2010/3/7 Cimballicimballi.cimba...@gmail.com:

 John, you can use namespaces at the package level to distinguish your
 stores.
 You can also do that in a rest way, like http://www.xyz.com/store/1.

 Cimballi


 On Sat, Mar 6, 2010 at 11:18 PM, john leesh_thorn_b...@yahoo.com
  wrote:

 my company is distributor, we plan to provide platform for our
 customer(different store) to sell their product to indivual customers.

 http://www.xyz.om/store1
 http://www.xyz.com/store2
 http://www.xyz.com/store3
 ...
 http://www.xyz.com/storeN

 (store1...storeN) list our(distributor)'s product to their customer,
 when customer see the display price, the display price=our price(base
 price)+storeX's margin

 my question is the following

 a. in the struts.xml, different store should have different package
 defination ?

 b. in the application, what is the struts2's method to detect which
 store? in other words, how can i detect which 
 link(http://www.xyz.om/store1
 or store2 or store3) is pass in ? without knowing which store is called, i
 can not call special routine(could be price cal, ...) associated with that
 store.

 any good idea to approach this?

 tks in advance

 john




 -
 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



 -
 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





-- 
Emil Thushanga
(Lets say i am Programmer/Developer)

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




  

Re: struts 2 - framework question

2010-03-07 Thread john lee
 
 
possible for you to show some psedo code for how to do it?
 
tks in advance 

 
john

--- On Sun, 3/7/10, Paweł Wielgus poulw...@gmail.com wrote:


From: Paweł Wielgus poulw...@gmail.com
Subject: Re: struts 2 - framework question
To: Struts Users Mailing List user@struts.apache.org, cimba...@cimballi.net
Date: Sunday, March 7, 2010, 1:59 AM


Hi All,
You can also have N applications representing stores under names store1..storeN,
where one application just knows about itself and all applications are
identical in code but different in data and css maybe.

Best greetings,
Paweł Wielgus.


2010/3/7 Cimballi cimballi.cimba...@gmail.com:
 John, you can use namespaces at the package level to distinguish your stores.
 You can also do that in a rest way, like http://www.xyz.com/store/1.

 Cimballi


 On Sat, Mar 6, 2010 at 11:18 PM, john lee sh_thorn_b...@yahoo.com wrote:

 my company is distributor, we plan to provide platform for our 
 customer(different store) to sell their product to indivual customers.

 http://www.xyz.om/store1
 http://www.xyz.com/store2
 http://www.xyz.com/store3
 ...
 http://www.xyz.com/storeN

 (store1...storeN) list our(distributor)'s product to their customer, when 
 customer see the display price, the display price=our price(base 
 price)+storeX's margin

 my question is the following

 a. in the struts.xml, different store should have different package 
 defination ?

 b. in the application, what is the struts2's method to detect which store? 
 in other words, how can i detect which link(http://www.xyz.om/store1 or 
 store2 or store3) is pass in ? without knowing which store is called, i can 
 not call special routine(could be price cal, ...) associated with that store.

 any good idea to approach this?

 tks in advance

 john




 -
 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




  

struts 2 - framework question

2010-03-06 Thread john lee

my company is distributor, we plan to provide platform for our 
customer(different store) to sell their product to indivual customers.
 
http://www.xyz.om/store1
http://www.xyz.com/store2
http://www.xyz.com/store3
...
http://www.xyz.com/storeN
 
(store1...storeN) list our(distributor)'s product to their customer, when 
customer see the display price, the display price=our price(base 
price)+storeX's margin
 
my question is the following
 
a. in the struts.xml, different store should have different package defination ?
 
b. in the application, what is the struts2's method to detect which store? in 
other words, how can i detect which link(http://www.xyz.om/store1 or store2 or 
store3) is pass in ? without knowing which store is called, i can not call 
special routine(could be price cal, ...) associated with that store.
 
any good idea to approach this?
 
tks in advance
 
john


  

struts bug, session object bug? pls help

2009-12-12 Thread john lee
 
I have the same serious problem that is similar to an old thread
http://marc.info/?l=struts-userm=121234554714110w=2
 
I use session object to manage user data for my company's e-commerce site, from 
time to time,specially when have high web access traffic, the session data 
could overlap, and from different user object. It is very frustrated, because 
it not happen always, but once a while, but serious problem, i do not know it 
is bug for strusts or not.
 
public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response
   ) throws Exception
{
HttpSession session=request.getSession();
UserInfoForm uif, t_uif;
Boolean check_cookie=false;
String login=null;
if (session==null) {
session=request.getSession(true);
    check_cookie=true;
   }
else {
  uif=(UserInfoForm) session.getAttribute(BeanNames.USERINFO);
  if (uif==null || uif.getLogin_id()==null 
||uif.getLogin_id().equals(Visit) )    
 check_cookie=true;
 }
 
if (check_cookie) {
    t_uif=new UserInfoForm();
    uif.setLogin_id(Visit);
    session.setAttribute(BeanNames.USERINFO,uif);
Cookie theCookie=null;uif.setLogin_id(Visit);
Cookie cookieList[]=request.getCookies();
    if (cookieList!=null) {
   for (int i=0; icookieList.length;i++) {
   theCookie=cookieList[i];
   if ( theCookie.getName().equals(XXX) )   /* 
XXX=company name */
  login=theCookie.getValue();
   }
   if (login==null)
     t_uif=null;
   else
     t_uif=security_service.ask(login);  /* to access db, to verify 
user info ...*/
   if (t_uif==null)
  t_uif.setLogin_id(Visit);
   session.setAttribute(BeanNames.USERINFO,t_uif);
   }
    }
 
uif=(UserInfoForm) session.getAttribute(BeanNames.USERINFO);
 
.
 
average once a month or when have heavy web traffic, the 'USERINFO' session 
object could be overlap with wrong customer info.
 
please give me any clue, tks in advance
 
john
 
 
 


  

struts bug? session object bug? pls help

2009-12-12 Thread john lee
I have the same serious problem that is similar to an old thread
http://marc.info/?l=struts-userm=121234554714110w=2
 
I use session object to manage user data for my company's e-commerce site, from 
time to time,specially when have high web access traffic, the session data 
could overlap, and from different user object. It is very frustrated, because 
it not happen always, but once a while, but serious problem, i do not know it 
is bug for strusts or not.
 
public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response
   ) throws Exception
{
HttpSession session=request.getSession();
UserInfoForm uif, t_uif;
Boolean check_cookie=false;
String login=null;
if (session==null) {
session=request.getSession(true);
    check_cookie=true;
   }
else {
  uif=(UserInfoForm) session.getAttribute(BeanNames.USERINFO);
  if (uif==null || uif.getLogin_id()==null 
||uif.getLogin_id().equals(Visit) )    
 check_cookie=true;
 }
 
if (check_cookie) {
    t_uif=new UserInfoForm();
    uif.setLogin_id(Visit);
    session.setAttribute(BeanNames.USERINFO,uif);
Cookie theCookie=null;uif.setLogin_id(Visit);
Cookie cookieList[]=request.getCookies();
    if (cookieList!=null) {
   for (int i=0; icookieList.length;i++) {
   theCookie=cookieList[i];
   if ( theCookie.getName().equals(XXX) )   /* 
XXX=company name */
  login=theCookie.getValue();
   }
   if (login==null)
     t_uif=null;
   else
     t_uif=security_service.ask(login);  /* to access db, to verify 
user info ...*/
   if (t_uif==null)
  t_uif.setLogin_id(Visit);
   session.setAttribute(BeanNames.USERINFO,t_uif);
   }
    }
 
uif=(UserInfoForm) session.getAttribute(BeanNames.USERINFO);
 

 
average once a month or when have heavy web traffic, the 'USERINFO' session 
object could be overlap with wrong customer info.
 
please give me any clue, tks in advance
 
john


  

struts 1.x, how to create package ?

2009-07-27 Thread john lee
 
i build online store by struts 1.x, and working fine, and all the classes file 
under 
 
/var/apache-tomcat-6.0.16/webapps/store/WEB-INF/classes/packageX/cart/*.class

 /mail/*.class
/security/*.class
 
how can i generate 1 single .jar? and put into which folder, then i can delete 
those many *.class files, and delete folder packageX as well?
 
tks in advance
 
john
 
 
 
  


  

struts 1.x, how to create packge and jar file ...?

2009-07-27 Thread john lee
 I build online store by struts 1.x, and working fine, and all the classes file 
under 
 
/var/apache-tomcat-6.0.16/webapps/storeX/WEB-INF/classes/packageX/cart/*.class

 /mail/*.class
/security/*.class
 
how can i generate 1 single .jar? and put into which folder, then i can delete 
those many *.class files, and delete folder packageX as well?
 
tks in advance
 
john


  

Re: struts 1.x, how to create package ?

2009-07-27 Thread john lee
tks for reply, but should put it in which folder/directory ? then tomcat/struts 
can serve to online user?
 
 

--- On Mon, 7/27/09, Musachy Barroso musa...@gmail.com wrote:


From: Musachy Barroso musa...@gmail.com
Subject: Re: struts 1.x, how to create package ?
To: Struts Users Mailing List user@struts.apache.org
Date: Monday, July 27, 2009, 4:07 PM


http://www.google.com/search?q=how+to+make+a+jar

musachy

On Mon, Jul 27, 2009 at 1:45 PM, john leesh_thorn_b...@yahoo.com wrote:

 i build online store by struts 1.x, and working fine, and all the classes 
 file under

 /var/apache-tomcat-6.0.16/webapps/store/WEB-INF/classes/packageX/cart/*.class
 
  /mail/*.class
 /security/*.class

 how can i generate 1 single .jar? and put into which folder, then i can 
 delete those many *.class files, and delete folder packageX as well?

 tks in advance

 john









-- 
Hey you! Would you help me to carry the stone? Pink Floyd



  

reference variable in struts 1 and 2

2009-04-14 Thread john lee
in struts 1
  if need to get variable from action, and do further processing, could do 
following
logic:iterate id=plist name=partlist scope=session 
type=neuco.CartItemsForm
   %
  
qty_available=((CartForm)pageContext.findAttribute(plist)).getQty_available();
  ...
   %
/logic:iterate
 
but in struts 2
   public class Cart {
    int qty_available;
int getQty_available();
    ...
   }
 i know in jsp , could do s:property value=qty_available to get variable, 
 but, how to put this into jsp file, and do further processing as Struts 1 did ?
 something like %  #{qty_available} %
 
tks in advance
 
john
 
 
    
 


  

RE: reference variable in struts 1 and 2

2009-04-14 Thread john lee

i know s:set.but i just do not know how to put it into jsp file
  % 
    varialble  
   %
 
for further processing as the demo i show that i did in struts 1.X
 
john
 

--- On Tue, 4/14/09, Security Management list-subscripti...@secmgmt.com wrote:


From: Security Management list-subscripti...@secmgmt.com
Subject: RE: reference variable in struts 1 and 2
To: 'Struts Users Mailing List' user@struts.apache.org
Date: Tuesday, April 14, 2009, 4:02 PM


http://struts.apache.org/2.1.6/docs/set.html

-Original Message-
From: john lee [mailto:sh_thorn_b...@yahoo.com] 
Sent: Tuesday, April 14, 2009 4:52 PM
To: user@struts.apache.org
Subject: reference variable in struts 1 and 2

in struts 1
  if need to get variable from action, and do further processing, could do
following
logic:iterate id=plist name=partlist scope=session
type=neuco.CartItemsForm
   %
 
qty_available=((CartForm)pageContext.findAttribute(plist)).getQty_availabl
e();
  ...
   %
/logic:iterate
 
but in struts 2
   public class Cart {
    int qty_available;
int getQty_available();
    ...
   }
 i know in jsp , could do s:property value=qty_available to get
variable, 
 but, how to put this into jsp file, and do further processing as Struts 1
did ?
 something like %  #{qty_available} %
 
tks in advance
 
john
 
 
    
 


      


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




  

Re: reference variable in struts 1 and 2

2009-04-14 Thread john lee
Yes, i need to further do variable processing at scriptlet(jsp) page, the 
reason is to do different kind of summary etc...
 
but how? can i still use Context...same as i did in Struct 1.X's example?
 
tks
 
john
 


--- On Tue, 4/14/09, Dave Newton newton.d...@yahoo.com wrote:


From: Dave Newton newton.d...@yahoo.com
Subject: Re: reference variable in struts 1 and 2
To: Struts Users Mailing List user@struts.apache.org
Date: Tuesday, April 14, 2009, 4:08 PM


Security Management wrote:
 http://struts.apache.org/2.1.6/docs/set.html

AFAIK that doesn't make the variable available to scriptlets, which would be 
the equivalent of the OP's example.

That said, @John, I'd question the need and/or wisdom of performing that kind 
of computation on the JSP page: is it really necessary for you to do that kind 
of logic on the view side?

Dave


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




  

RE: struts 2 s:iterator

2009-04-12 Thread john lee


tks for your feedback,
 
as your suggest/my understanding, the default struts2 package does not have 
equivalent
logic:present to check  the object inside logic:iterator exists or not, but 
need to configure spring to accomplish it.
 
jiong
 
 
--- On Sun, 4/12/09, Martin Gainty mgai...@hotmail.com wrote:


From: Martin Gainty mgai...@hotmail.com
Subject: RE: struts 2 s:iterator
To: Struts Users Mailing List user@struts.apache.org
Date: Sunday, April 12, 2009, 8:59 AM



IOC Container manages the location,creation and instantiation of framework bean
http://struts.apache.org/2.x/docs/spring-plugin.html

I would suggest configuring Spring IOC Container 
struts.objectFactory.spring.autoWire to either
name,type,auto, or constructor

Martin 
__ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de 
déni et de confidentialité 
This message is confidential. If you should not be the intended receiver, then 
we ask politely to report. Each unauthorized forwarding or manufacturing of a 
copy is inadmissible. This message serves only for the exchange of information 
and has no legal binding effect. Due to the easy manipulation of emails we 
cannot take responsibility over the the contents.
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: Sat, 11 Apr 2009 21:36:41 -0700
 From: sh_thorn_b...@yahoo.com
 Subject: struts 2  s:iterator 
 To: user@struts.apache.org
 
  
 in strut 1.X, 
    logic:present name=
              logic:iterator name=.
    /logic:present
    logic:notPresent name=
             search result  not exist 
    /logic:present
  
 but, in struts 2, 
        how can i use the same method to check s:iterator is not empty? in 
other words, i did not find equivalent s:present to achive the same effect as 
struts 1.x at above.
  
 please advise
  
 tks in advance
  
 john
 
 
       

_
Rediscover Hotmail®: Now available on your iPhone or BlackBerry
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Mobile1_042009


  

Re: s:checkboxlist or s:checkbox

2009-04-11 Thread john lee

tks for both of u try to help me
 
s:iterator value=beds status=st 
  s:property value=bed_id/
/s:iterator
 
the above works, and print the value of bed_id
 
but, the following still not works
 
s:iterator value=beds status=st var=curBed
  s:checkbox name=%{'bed[' + (st.count-1) + ']'}  
alue=#curBed.bed_id/s:checkbox
/s:iterator
 
and running result complain the var tag
 
please advise, tks in advance
 
john

--- On Fri, 4/10/09, Dave Newton newton.d...@yahoo.com wrote:


From: Dave Newton newton.d...@yahoo.com
Subject: Re: s:checkboxlist or s:checkbox
To: Struts Users Mailing List user@struts.apache.org
Date: Friday, April 10, 2009, 6:28 PM


Wes Wannemacher wrote:
 Second, when you are using the iterator and creating single checkboxes, you 
 need to make the names unique. You are simply creating a new checkbox with 
 the name beds over and over again. 

Putting in an index only matters if order is important (and you don't trust the 
browser to submit in order); if a page has multiple variables of the same name 
their values will be put into an array or collection action property.

For a checkbox w/ a true/false value probably need either an index or to use a 
map-based property.

Dave


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




  

Re: s:checkboxlist or s:checkbox

2009-04-11 Thread john lee
tks very much, it works after change var to id. 
 
Also, have further question need to bother you similar to it
 
same bean class
 
public class Bed {
  private String bed_id;
  public String getBed_id() {return bed_id;}
  public void setBed_id(String bed_id) { this.bed_id=bed_id; }
}
 
same action class
...
private ArrayListBed beds;
    public String execute() throws Exception {
  
  beds=service.Beds();
  return SUCCESS;
    }
    public void setBeds(ArrayListBed beds){    this.beds = beds;    }
    public ArrayListBed getBeds() {    return beds;    }
 
almost same jsp file
    s:iterator value=beds status=st 
  s:property value=bed_id/
    /s:iterator
    s:select label=Bed ID name=bed_id headerKey=1 headerValue=Please 
Select Bed# list=beds/ /* the problem */
 
the output is 
  1 2 3 4
...@188d92e 
...@16a5bcb
    b...@1b08cf3
   @1f5d699    

my question is that why s:select list print object but value, is because i 
defined ArrayListBed ?
what is the correct way to fetch value out as s:iterators:property 
value=bed_id/ did
 
tks in advance again
 
 
 

--- On Sat, 4/11/09, Wes Wannemacher w...@wantii.com wrote:


From: Wes Wannemacher w...@wantii.com
Subject: Re: s:checkboxlist or s:checkbox
To: john lee sh_thorn_b...@yahoo.com
Date: Saturday, April 11, 2009, 11:53 AM


Try to use id attribute instead of var

-W

On 4/11/09, john lee sh_thorn_b...@yahoo.com wrote:

 tks for both of u try to help me

 s:iterator value=beds status=st 
   s:property value=bed_id/
 /s:iterator

 the above works, and print the value of bed_id

 but, the following still not works

 s:iterator value=beds status=st var=curBed
   s:checkbox name=%{'bed[' + (st.count-1) + ']'}
 alue=#curBed.bed_id/s:checkbox
 /s:iterator

 and running result complain the var tag

 please advise, tks in advance

 john

 --- On Fri, 4/10/09, Dave Newton newton.d...@yahoo.com wrote:


 From: Dave Newton newton.d...@yahoo.com
 Subject: Re: s:checkboxlist or s:checkbox
 To: Struts Users Mailing List user@struts.apache.org
 Date: Friday, April 10, 2009, 6:28 PM


 Wes Wannemacher wrote:
 Second, when you are using the iterator and creating single checkboxes,
 you need to make the names unique. You are simply creating a new checkbox
 with the name beds over and over again.

 Putting in an index only matters if order is important (and you don't trust
 the browser to submit in order); if a page has multiple variables of the
 same name their values will be put into an array or collection action
 property.

 For a checkbox w/ a true/false value probably need either an index or to use
 a map-based property.

 Dave


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






-- 
Sent from my mobile device

Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher



  

s:datetimepicker

2009-04-11 Thread john lee
 
is s:datetimepicker struts default tag?  if so, why it can not render the 
display?
 
does it need to load additional .jar to support it?
 
i tried the simple way
   s:datetimepicker lable=calendar value=2009-01-01  
but just display calendar only, nothing display on the right side
 
i tried the complex way, define action class
   public  class DateBean  extends ActionSupport {
  
    public String execute() throws Exception {
  setTodayDate(new Date());
  return SUCCESS;
  }
    private Date todayDate;
    public Date getTodayDate() {    return todayDate;    }
    public void setTodayDate(Date value) {    todayDate = value;   }
}

the jsp file is 
s:datetimepicker name=todayDate label=calendar displayFormat=-MM-dd/
 
but just display 'calendar', nothing display on the right side either
 
what happen? 
 
tks in advance
 
john




  

Re: s:datetimepicker / display date content customrize

2009-04-11 Thread john lee
tks, it works after i put s:head
 
my new question:
 
is it possible to mark some of display/pop calendar cell with special color and 
clickable link?
 
In real word, any of display date could associate special event or customer 
order ...etc.
 
what is the approach could be? 
 
tks in advance
 


--- On Sat, 4/11/09, Dave Newton newton.d...@yahoo.com wrote:


From: Dave Newton newton.d...@yahoo.com
Subject: Re: s:datetimepicker
To: Struts Users Mailing List user@struts.apache.org
Date: Saturday, April 11, 2009, 1:50 PM


john lee wrote:
 is s:datetimepicker struts default tag?  if so, why it can not render the 
 display?

You're using  S2.1 I assume?

Are you using the s:head tag as mentioned in the s:datetimepicker docs [1]?

Dave

[1] http://struts.apache.org/2.0.11/docs/datetimepicker.html


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




  

RE: s:datetimepicker

2009-04-11 Thread john lee
tks for ur reply,
 
but i expect when build calendar list in the action class, can assign the 
element of list(calendar) with clickable feature or highlight color, for 
example, the pop calendar display as following
 
 S M T W T F S
 1 2 3 4 5 6 7
  9 10   
 
but Tuesday (2) color need to be  different color, such as blue, which refer to 
special event..(map to the data from database).
 
tks in advance
 
john 
 
 
 

--- On Sat, 4/11/09, Martin Gainty mgai...@hotmail.com wrote:


From: Martin Gainty mgai...@hotmail.com
Subject: RE: s:datetimepicker
To: Struts Users Mailing List user@struts.apache.org
Date: Saturday, April 11, 2009, 5:20 PM




set the value with JS e.g.script type=text/javascript
  function setValue() {
     var picker = dojo.widget.byId(picker); 
     //string value//figure out where the value is then use 
dojo.widget.byId(DateID).setValue('new value') e.g.
     picker.setValue('2007-01-01'); //notice the tick marks for constants
     //Date value
     picker.setValue(new Date());
  }
  
  function showValue() {
     var picker = dojo.widget.byId(picker);
     //string value
     var stringValue = picker.getValue();
     alert(stringValue);
     //date value
     var dateValue = picker.getDate();
     alert(dateValue);
  }
/script

sx:datetimepicker id=picker 




Martin 
__ 
Disclaimer and Confidentiality/Verzicht und Vertraulichkeitanmerkung / Note de 
déni et de confidentialité 
This message is confidential. If you should not be the intended receiver, then 
we ask politely to report. Each unauthorized forwarding or manufacturing of a 
copy is inadmissible. This message serves only for the exchange of information 
and has no legal binding effect. Due to the easy manipulation of emails we 
cannot take responsibility over the the contents.
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: Sat, 11 Apr 2009 14:57:21 -0700
 Subject: Re: s:datetimepicker
 From: saty.pra...@gmail.com
 To: user@struts.apache.org
 
 Which version of struts are you using? If you using 2.1.6 and above, you
 need to have the struts-dojo lib and there is a tag include with sx:
 you need to use sx:datetimepicker It is something like struts extensions.
 
 You also need to include this..sx:head debug=true cache=false
 compressed=false /
 
 
 http://struts.apache.org/2.1.6/docs/datetimepicker.html
 
 Rgds,
 
 Satya
 
 On Sat, Apr 11, 2009 at 11:34 AM, john lee sh_thorn_b...@yahoo.com wrote:
 
 
  is s:datetimepicker struts default tag? if so, why it can not render the
  display?
 
  does it need to load additional .jar to support it?
 
  i tried the simple way
  s:datetimepicker lable=calendar value=2009-01-01 
  but just display calendar only, nothing display on the right side
 
  i tried the complex way, define action class
  public class DateBean extends ActionSupport {
 
  public String execute() throws Exception {
  setTodayDate(new Date());
  return SUCCESS;
  }
  private Date todayDate;
  public Date getTodayDate() { return todayDate; }
  public void setTodayDate(Date value) { todayDate = value; }
  }
 
  the jsp file is
  s:datetimepicker name=todayDate label=calendar
  displayFormat=-MM-dd/
 
  but just display 'calendar', nothing display on the right side either
 
  what happen?
 
  tks in advance
 
  john
 
 
 
 
 

_
Rediscover Hotmail®: Get quick friend updates right in your inbox. 
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Updates1_042009


  

struts 2, implements Action / extend ActionSupport

2009-04-11 Thread john lee
 
 
i am aware that in struts 2, when define an action, it could be 
 
   public class XXX implement Action 
   or
   public class XXX extends ActionSupport
 
what is the difference b/w above two? in other words, in what kind of scenario, 
pick which one?
 
tks in advance
 
john 


  

struts 2, s:select postback problem

2009-04-11 Thread john lee
 
in struts 2, try to do following:
 
  a.    use s:select to display the selectable list (get value from db)
  b.    pickup the selection, 
  c.query the db
  d.    use s:select to display the selectable list still, and display 
the query result
 
2 Bean file
 
public class Bed {
  private String bed_id;
  public String getBed_id() {return bed_id;}
  public void setBed_id(String bed_id) { this.bed_id=bed_id; }
}
 
public class BedAnalysis {
  private String bed_id;
  private String status;
  public String getBed_id() {return bed_id;}
  public String getStatus() {return status;}
  public void setBed_id(String bed_id) { this.bed_id=bed_id; }
  public void setStatus(String status) { this.status=status; }
  }
 
Action 
 
public class Analysis_input implements Action {
private ArrayListBed beds;
private ArrayListBedAnalysis bedanalysis;
    private String bed_id;
   
    public String execute() throws Exception {
    /* db initial, get session etc */
  beds=service.Beds();  /* service is call db */
  String first_time=null;
  
first_time=ActionContext.getContext().getSession().get(FIRST_TIME);
  if (first_time==null)
  session.put(FIRST_TIME,1);
  else {
   bedanalysis=service.Analysis2(getBed_id());
   }

  return SUCCESS;
    }
 
    public void setBeds(ArrayListBed beds){ this.beds = beds; }
public void setBed_id(String bed_id){ this.bed_id = bed_id; } 
public void setBedanalysis(ArrayListBedAnalysis bedanalysis){ 
this.bedanalysis = bedanalysis; }
    public ArrayListBed getBeds() { return beds; }
    public String getBed_id(){ return bed_id; }
 public ArrayListBedAnalysis getBedanalysis() { return bedanalysis; }
   
struts.xml
    action name=Analysis_input class=matco.Analysis_input
    result name=error/Analysis_input.jsp/result
    result name=input/Analysis_input.jsp/result
    result name=success/Analysis_input.jsp/result
    /action
 
jsp file
    s:form id=analysis action=Analysis_input
 s:select label=beds name=beds headerKey=1 headerValue=Please 
Select Bed# list=beds listKey=bed_id listValue=bed_id  
value=%{#beds{bed_id}}/
s:submit value=Query/
/s:form
     s:iterator value=bedanlysis status=st 
   s:property value=bed_id/nspnbsps:property 
value=status/  /s:iterator
 
when i call Analysis_input.action, it works, the select box pop the value from 
db
   but after i select value of bed_id and submit, page render back, and show me 
the following
    



Invalid field value for field beds.

beds:
 Please Select Bed# 
 
i did select the value of bed_id, why this happen?
 
the weird thing even are:  the select list box' all value are gone.
 
pls help me
 
john


  

struts 2 s:iterator

2009-04-11 Thread john lee
 
in strut 1.X, 
   logic:present name=
 logic:iterator name=.
   /logic:present
   logic:notPresent name=
search result  not exist 
   /logic:present
 
but, in struts 2, 
   how can i use the same method to check s:iterator is not empty? in 
other words, i did not find equivalent s:present to achive the same effect as 
struts 1.x at above.
 
please advise
 
tks in advance
 
john


  

s:checkboxlist or s:checkbox

2009-04-10 Thread john lee
 
I defined an entity java.
  
public class Bed {
  private String bed_id;
  public String getBed_id() {return bed_id;}
  public void setBed_id(String bed_id) { this.bed_id=bed_id; }
}
 
in action file, i did the following, 
    public class Analysis_input extends ActionSupport {
private ArrayListBed beds; 
    public String execute() throws Exception {
  / * initialized service...and it is database 
connection */
  beds=service.Beds(); 
  ActionContext.getContext().getSession().put(Beds,beds);
  return SUCCESS;
    }
    public void setBeds(ArrayListBed beds){    this.beds = beds;    }
    public ArrayListBed getBeds() {   return beds;    }
}
 
in jsp file, i did
 s:checkboxlist name=beds list=beds /
 
but received the error 
 
 FreeMarker template error!
Error on line 28, column 13 in template/simple/checkboxlist.ftl
stack.findValue(parameters.listKey) is undefined.
It cannot be assigned to itemKey
The problematic instruction:
== assignment: itemKey=stack.findValue(parameters.listKey) [on line 28, column 
13 in template/simple/checkboxlist.ftl]
 in user-directive s.iterator [on line 25, column 5 in 
template/simple/checkboxlist.ftl]
 in include /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25, 
column 1 in template/xhtml/checkboxlist.ftl]
 
if i change the jsp file to the following
    
  s:iterator value=beds status=st
   s:checkbox name=beds value=bed_id/s:checkboxbr
    /s:iterator
  
but receive the new error

!--StartFragment--Error on line 28, column 13 in 
template/simple/checkboxlist.ftl
stack.findValue(parameters.listKey) is undefined.
It cannot be assigned to itemKey
The problematic instruction:
--
== assignment: itemKey=stack.findValue(parameters.listKey) [on line 28, column 
13 in template/simple/checkboxlist.ftl]
 in user-directive s.iterator [on line 25, column 5 in 
template/simple/checkboxlist.ftl]
 in include /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25, 
column 1 in template/xhtml/checkboxlistany expert can give me the advise? i am 
new to struts 2tks in advancejohn 


  

Re: s:checkboxlist or s:checkbox

2009-04-10 Thread john lee
tks for your quick response.
 
the reason i initialize there is because try to get fresh list from database.
 
second, as your suggest, i need to change the name, but how? 
 
tks in advance again
 
john

--- On Fri, 4/10/09, Wes Wannemacher w...@wantii.com wrote:


From: Wes Wannemacher w...@wantii.com
Subject: Re: s:checkboxlist or s:checkbox
To: Struts Users Mailing List user@struts.apache.org
Date: Friday, April 10, 2009, 1:09 AM


I'm jumping in a bit late, but I'll add a few observations. I don't think that 
execute is the place where you want to initialize your service and populate 
the beds list... You're better off implementing Preparable and initializing 
the list there. 

Second, when you are using the iterator and creating single checkboxes, you 
need to make the names unique. You are simply creating a new checkbox with the 
name beds over and over again. 

-Wes

On Friday 10 April 2009 01:59:42 john lee wrote:
 I defined an entity java.
  
 public class Bed {
   private String bed_id;
   public String getBed_id() {return bed_id;}
   public void setBed_id(String bed_id) { this.bed_id=bed_id; }
 }
  
 in action file, i did the following,
     public class Analysis_input extends ActionSupport {
     private ArrayListBed beds;
     public String execute() throws Exception {
                   / * initialized service...and it is database
 connection */ beds=service.Beds();
                   ActionContext.getContext().getSession().put(Beds,beds);
                   return SUCCESS;
     }
     public void setBeds(ArrayListBed beds){        this.beds = beds;    }
     public ArrayListBed getBeds() {       return beds;    }
 }
  
 in jsp file, i did
  s:checkboxlist name=beds list=beds /
  
 but received the error
  
      FreeMarker template error!
 Error on line 28, column 13 in template/simple/checkboxlist.ftl
 stack.findValue(parameters.listKey) is undefined.
 It cannot be assigned to itemKey
 The problematic instruction:
 == assignment: itemKey=stack.findValue(parameters.listKey) [on line 28,
 column 13 in template/simple/checkboxlist.ftl] in user-directive s.iterator
 [on line 25, column 5 in template/simple/checkboxlist.ftl] in include
 /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25, column 1
 in template/xhtml/checkboxlist.ftl] 
 if i change the jsp file to the following
    
               s:iterator value=beds status=st
                s:checkbox name=beds value=bed_id/s:checkboxbr
             /s:iterator
       
 but receive the new error

 !--StartFragment--Error on line 28, column 13 in
 template/simple/checkboxlist.ftl stack.findValue(parameters.listKey) is
 undefined.
 It cannot be assigned to itemKey
 The problematic instruction:
 --
 == assignment: itemKey=stack.findValue(parameters.listKey) [on line 28,
 column 13 in template/simple/checkboxlist.ftl] in user-directive s.iterator
 [on line 25, column 5 in template/simple/checkboxlist.ftl] in include
 /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25, column 1
 in template/xhtml/checkboxlistany expert can give me the advise? i am new
 to struts 2tks in advancejohn

-- 

Wes Wannemacher
Author - Struts 2 In Practice 
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher


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




  

Re: s:checkboxlist or s:checkbox

2009-04-10 Thread john lee
 
tks for your great advise, i run the code, but receive the following error
 
/Analysis_input.jsp(17,12) Attribute var invalid for tag iterator according to 
TLD
 
i check the syntax, then i put extra } inside the tag as the following
 
then i put extra '}' inside s:checkbox name=%{'bed[' + (st.count -1) + 
']'}'          
                value=#curBed.bed_id/s:checkbox
 
and run again, but receive the same error, 
 
please advise.
 
tks again
 
john



--- On Fri, 4/10/09, Wes Wannemacher w...@wantii.com wrote:


From: Wes Wannemacher w...@wantii.com
Subject: Re: s:checkboxlist or s:checkbox
To: john lee sh_thorn_b...@yahoo.com
Cc: Struts Users Mailing List user@struts.apache.org
Date: Friday, April 10, 2009, 1:26 AM


On Friday 10 April 2009 02:14:22 john lee wrote:
 tks for your quick response.
  
 the reason i initialize there is because try to get fresh list from
 database. 

Preparable will run per invocation, just like execute runs once per 
invocation. The difference is that execute is likely to run after the view has 
been rendered. Check this page - 

http://struts.apache.org/2.x/docs/prepare-interceptor.html

 second, as your suggest, i need to change the name, but how?
  

Really, implementing Preparable and moving the initialization logic to a 
prepare method is your best option. But, what you have to do to make your 
checkboxes unique is add some OGNL like this - 

s:iterator value=beds status=st var=curBed
  s:checkbox name=%{'bed[' + (st.count -1) + ']'          
                value=#curBed.bed_id/s:checkbox
/s:iterator

Now, that code is completely untested and the status object's count member is 
1-based, not zero-based as you'll need since you're iterating an ArrayList, 
that's why there is some math in there. I can't remember if you can do it that 
way or if you'll just end up with string concatenations... but you get the 
idea. You could also get done and find the object uninitialized since your 
logic for loading up the arraylist is done in the execute method. 

-Wes

 tks in advance again
  
 john

 --- On Fri, 4/10/09, Wes Wannemacher w...@wantii.com wrote:


 From: Wes Wannemacher w...@wantii.com
 Subject: Re: s:checkboxlist or s:checkbox
 To: Struts Users Mailing List user@struts.apache.org
 Date: Friday, April 10, 2009, 1:09 AM


 I'm jumping in a bit late, but I'll add a few observations. I don't think
 that execute is the place where you want to initialize your service and
 populate the beds list... You're better off implementing Preparable and
 initializing the list there.

 Second, when you are using the iterator and creating single checkboxes, you
 need to make the names unique. You are simply creating a new checkbox with
 the name beds over and over again.

 -Wes

 On Friday 10 April 2009 01:59:42 john lee wrote:
  I defined an entity java.
  
  public class Bed {
    private String bed_id;
    public String getBed_id() {return bed_id;}
    public void setBed_id(String bed_id) { this.bed_id=bed_id; }
  }
  
  in action file, i did the following,
      public class Analysis_input extends ActionSupport {
      private ArrayListBed beds;
      public String execute() throws Exception {
                    / * initialized service...and it is database
  connection */ beds=service.Beds();
                
     ActionContext.getContext().getSession().put(Beds,beds); return
  SUCCESS;
      }
      public void setBeds(ArrayListBed beds){        this.beds = beds;   
  } public ArrayListBed getBeds() {       return beds;    }
  }
  
  in jsp file, i did
   s:checkboxlist name=beds list=beds /
  
  but received the error
  
       FreeMarker template error!
  Error on line 28, column 13 in template/simple/checkboxlist.ftl
  stack.findValue(parameters.listKey) is undefined.
  It cannot be assigned to itemKey
  The problematic instruction:
  == assignment: itemKey=stack.findValue(parameters.listKey) [on line 28,
  column 13 in template/simple/checkboxlist.ftl] in user-directive
  s.iterator [on line 25, column 5 in template/simple/checkboxlist.ftl] in
  include /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25,
  column 1 in template/xhtml/checkboxlist.ftl]
  if i change the jsp file to the following
    
                s:iterator value=beds status=st
                 s:checkbox name=beds value=bed_id/s:checkboxbr
              /s:iterator
        
  but receive the new error
 
  !--StartFragment--Error on line 28, column 13 in
  template/simple/checkboxlist.ftl stack.findValue(parameters.listKey) is
  undefined.
  It cannot be assigned to itemKey
  The problematic instruction:
  --
  == assignment: itemKey=stack.findValue(parameters.listKey) [on line 28,
  column 13 in template/simple/checkboxlist.ftl] in user-directive
  s.iterator [on line 25, column 5 in template/simple/checkboxlist.ftl] in
  include /${parameters.templateDir}/simple/checkboxlist.ftl [on line 25,
  column 1 in template/xhtml/checkboxlistany expert can give me the advise?
  i am new

what is the equivalent of method in struts 2 for retrieve data?

2009-04-08 Thread john lee
in struts 1, i saved the data into session
  session.setAttribute(BeanNames.PARTS_LIST,partsList);
  then, in the jsp file, retrieve the data by 
  logic:iterate id=plist name=partslist scope=session 
type=neuco.PartForm
 
what is the equivalent method in struts 2?
 
tks in advance
 
john


  

my first struts 2 HelloWord.action still not working

2009-04-07 Thread john lee
please help me.
 
after i did all the necessary configuration, i did the following
 
http://localhost:8080/jiong2/HelloWorld.action
 
but, receive the following:
HTTP Status 404 - /jiong2/HelloWorld.action


type Status report
message /jiong2/HelloWorld.action
description The requested resource (/jiong2/HelloWorld.action) is not available.
 
 
my configuration is the following:
 
file name:  /var/apache-tomcat-6.0.16/conf/server.xml
   ...
   Context path=/jiong2 docBase=jiong2 debug=5 reloadable=true 
crossContext=true
   ...
 
file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/HelloWorld.jsp
  
%@ taglib prefix=s uri=/struts-tags %
html head titleHello World!/title/head body
    h2s:property value=message //h2  /body/html
 
file name:  /var/apache-tomcat-6.0.16/webapps/jiong2/WEB_INF/web.xml
 
web-app xmlns=http://java.sun.com/xml/ns/javaee;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xsi:schemaLocation=http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd;
   version=2.5
   display-nameMy Application/display-name
  filter
    filter-namestruts2/filter-name
    filter-classorg.apache.struts2.dispatcher.FilterDispatcher/filter-class
  /filter
  filter-mapping
    filter-namestruts2/filter-name
    url-pattern/*/url-pattern
  /filter-mapping

/web-app
 
file_name: /var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/struts.xml
    !DOCTYPE struts PUBLIC
    -//Apache Software Foundation//DTD Struts Configuration 2.0//EN
    http://struts.apache.org/dtds/struts-2.0.dtd;
 struts    package name=neuco extends=struts-default
    action name=HelloWorld class=neuco.HelloWorld
    result/HelloWorld.jsp/result
    /action
    /package/struts
 
file_name:  
/var/apache-tomcat-6.0.16/webapps/jiong2/WEB-INF/classes/neuco/HelloWorld.class
 
 package neuco;
import com.opensymphony.xwork2.ActionSupport;
public class HelloWorld extends ActionSupport {
    public static final String MESSAGE = Struts is up and running ...;
    public String execute() throws Exception {
    setMessage(MESSAGE);
    return SUCCESS;
    }
    private String message;
    public void setMessage(String message){
    this.message = message;
    }
    public String getMessage() {
    return message;
    }
}
  
 
 


Apache Tomcat/6.0.16


  

  1   2   >