Re: Date Type Converter strange behavior

2021-04-26 Thread M Huzaifah
Hii Yaser,

Thank you for reply. my problem solved by add:

 @TypeConversion(type = ConversionType.APPLICATION, key = "java.util.Date", 
converterClass = DateConverter.class)

Regards


> On 26 Apr 2021, at 14.36, Yasser Zamani  wrote:
> 
> Hi thanks for reaching out!
> 
> I don't remember and should check that your desired behavior used to work or 
> not but as a quick answer I think you're looking for Class wide conversion 
> [1] e.g. @TypeConversion(type = ConversionType.APPLICATION, property = 
> "java.util.Date", DateConverter.class)?
> 
> Regards.
> 
> [1] https://struts.apache.org/core-developers/type-conversion-annotation.html
> 
> On 2021/04/25 20:02:47, M Huzaifah  wrote: 
>> Hy guys,
>> 
>> i found somethin strange with StrutsTypeConverter.
>> let say i have a converter like this:
>> 
>> 
>> //-- begin DateConverter class ---
>> import java.text.ParseException;
>> import java.text.SimpleDateFormat;
>> import java.util.Date;
>> import java.util.Map;
>> 
>> import javax.annotation.PostConstruct;
>> 
>> import org.apache.commons.lang.ArrayUtils;
>> import org.apache.commons.lang.StringUtils;
>> import org.apache.struts2.util.StrutsTypeConverter;
>> 
>> public class DateConverter extends StrutsTypeConverter {
>>  
>>  private  String shortDateFormat;
>>  
>>  @PostConstruct
>>  public void loadFormat() {
>>  this.shortDateFormat = "dd/MM/";
>>  }
>> 
>>  @SuppressWarnings("unused")
>>  @Override
>>  public Object convertFromString(Map arg0, String[] arg1, Class arg2) {
>>  
>>  System.out.println("begin converter");
>> 
>>  if(ArrayUtils.isEmpty(arg1) || StringUtils.isEmpty(arg1[0])) {
>>  return null;
>>  }
>> 
>>  Date date = null;
>>  
>>  try {
>>  //cek kalo formatnya dd/MM/ hh:mm:ss
>>  if(arg1[0].contains(" ")) {
>>  this.shortDateFormat = "dd/MM/ hh:mm:ss";
>>  date = new 
>> SimpleDateFormat(shortDateFormat).parse(arg1[0]);
>>  }else {
>>  date = new 
>> SimpleDateFormat(shortDateFormat).parse(arg1[0]);
>>  }
>>  }catch (ParseException e) {
>>  System.out.println("DateConverter StrutsTypeConverter 
>> gagal parsing date;");
>>  e.printStackTrace();
>>  }
>> 
>>  System.out.println("end converter");
>>  return date;
>>  }
>> 
>>  @Override
>>  public String convertToString(Map arg0, Object arg1) {
>> 
>>  System.out.println("begin converter to string");
>>  if(arg1 instanceof Date) {
>>  System.out.println("end converter to string");
>>  return new 
>> SimpleDateFormat(shortDateFormat).format((Date) arg1);
>>  }
>> 
>>  System.out.println("end converter to string");
>>  return StringUtils.EMPTY;
>>  }
>> 
>>  
>>  
>> }
>> 
>> //-- end DateConverter class ---
>> 
>> 
>> 
>> and in my action class, i have 2 property. one of them is Date type. and 
>> other one is Pojo which one of that Pojo property have a Date type. so my 
>> action look like this
>> 
>> 
>> //-- begin MasterPatienAction class ---
>> 
>> @Namespace("/patient")
>> @ParentPackage("app-default")
>> @Conversion(conversions = {
>>  @TypeConversion(key = "birthDate", converterClass = 
>> DateConverter.class)
>> })
>> public class MasterPatientAction extends BaseAction {
>> 
>>  /**
>>   * 
>>   */
>>  private static final long serialVersionUID = 1L;
>> 
>>  private static transient Logger log = 
>> Logger.getLogger(MasterPatientAction.class);
>>  
>>  
>>  Patient patient;
>>  List listPatient;
>>  Date birthDate;
>>  
>>  @Action(value = "init", results = {
>>  @Result(name

Date Type Converter strange behavior

2021-04-25 Thread M Huzaifah
Hy guys,

i found somethin strange with StrutsTypeConverter.
let say i have a converter like this:


//-- begin DateConverter class ---
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import javax.annotation.PostConstruct;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.struts2.util.StrutsTypeConverter;

public class DateConverter extends StrutsTypeConverter {

private  String shortDateFormat;

@PostConstruct
public void loadFormat() {
this.shortDateFormat = "dd/MM/";
}

@SuppressWarnings("unused")
@Override
public Object convertFromString(Map arg0, String[] arg1, Class arg2) {

System.out.println("begin converter");

if(ArrayUtils.isEmpty(arg1) || StringUtils.isEmpty(arg1[0])) {
return null;
}

Date date = null;

try {
//cek kalo formatnya dd/MM/ hh:mm:ss
if(arg1[0].contains(" ")) {
this.shortDateFormat = "dd/MM/ hh:mm:ss";
date = new 
SimpleDateFormat(shortDateFormat).parse(arg1[0]);
}else {
date = new 
SimpleDateFormat(shortDateFormat).parse(arg1[0]);
}
}catch (ParseException e) {
System.out.println("DateConverter StrutsTypeConverter 
gagal parsing date;");
e.printStackTrace();
}

System.out.println("end converter");
return date;
}

@Override
public String convertToString(Map arg0, Object arg1) {

System.out.println("begin converter to string");
if(arg1 instanceof Date) {
System.out.println("end converter to string");
return new 
SimpleDateFormat(shortDateFormat).format((Date) arg1);
}

System.out.println("end converter to string");
return StringUtils.EMPTY;
}



}

//-- end DateConverter class ---



and in my action class, i have 2 property. one of them is Date type. and other 
one is Pojo which one of that Pojo property have a Date type. so my action look 
like this


//-- begin MasterPatienAction class ---

@Namespace("/patient")
@ParentPackage("app-default")
@Conversion(conversions = {
@TypeConversion(key = "birthDate", converterClass = 
DateConverter.class)
})
public class MasterPatientAction extends BaseAction {

/**
 * 
 */
private static final long serialVersionUID = 1L;

private static transient Logger log = 
Logger.getLogger(MasterPatientAction.class);


Patient patient;
List listPatient;
Date birthDate;

@Action(value = "init", results = {
@Result(name = "success", location = 
"/pages/pasient-main.jsp"),
@Result(name = "error", location = 
"/pages/pasient-main.jsp"),
@Result(name = "input", location = 
"/pages/pasient-main.jsp")
})
public String init() {
log.info("begin execute method init");

log.info("end execute method init");
return SUCCESS;
}

@Action(value = "search", results = {
@Result(name = "success", location = 
"/pages/pasient-main.jsp"),
@Result(name = "error", location = 
"/pages/pasient-main.jsp"),
@Result(name = "input", location = 
"/pages/pasient-main.jsp")
})
public String search() {
log.info("begin execute method search");

if(birthDate!=null) {
patient.setPatientBirthDate(birthDate);
}

try {
listPasien = service.search(patient);
} catch (DnaException e) {
setMessageError("error caused : "+e.getMessage());
return ERROR;
}

log.info("end execute method search");
return SUCCESS;
}

//--setter getter
}


//-- end MasterPatienAction class ---


let say my pojo like this:


//-- begin Patient pojo class ---

public class Patient {
private integer patientId;
private String patientName;
private String patientCode;
private Date 

Re: Struts 1 -> Struts 2 migration session parameters not found

2020-08-27 Thread M Huzaifah
Hii Natta Wang,

Are you try using session interceptor? In java, the session could access
using ServletActionContext.getRequest().getSession(); it will return
servlet HttpSession and use getAttribute() method to ge your particular
session by given sessionAttribut name.

To access session in jsp, i usualy using
${sessionScope.yourSesionAttributName}

Regards...

On Thu, Aug 27, 2020, 6:17 PM Natta Wang  wrote:

> I start to migrate from Struts 1 to Struts 2 and found a problem that I
> want to ask for help with the session.
>
> In Struts 1 web.xml, I have a Filter class that maps to servlet and when
> it be called, it will set a parameter with an object.
>
> All Struts 1 JSP pages can access the session that has those parameters,
> and what I did to the new Action class of Struts 2 is implements with
> SessionAware,
> in the class if found session object by
> ServletActionContext.getRequest().getSession(), but cannot found the
> parameter with the parameter name that I expected it has.
>
> What I tried is added new filter-mapping in the web.xml file, which map
> url-pattern to Struts 2 Action class (same with that mapped to servlet I
> mentioned above), hope it will be called when opening with a specific URL
> but I failed as it comes out like the not set version.
>
> Can someone guide me on how to make the session and all parameters visible
> in the Action class and JSP page?
>
> And one more thing, I use  the header page and header page also
> refers to those session parameters. Do I need to implement any
> configuration to make header JSP can access the session?
>
> Any help or suggestion are appreciated.
> Thanks.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Validation using Struts2-spring

2020-06-04 Thread M Huzaifah
Dear All,

i am sorry, is my bad. the validation are running well. i am trying to do show 
the message error in action, but in this code the message going to the field 
with parameter named “parameterString1” and i change requiredFiled validation 
to requiredString validation in parameter Validations Annotation.

Thank You All

> On 4 Jun 2020, at 12.00, M Huzaifah  wrote:
> 
> Hii Guys,
> 
> i’am stuck with Validation in Struts2 using struts2-spring plugin. 
> struts version : 2.5.22
> spring version : 5.2.1.RELEASE
> 
> my validators.xml in classpath:
> 
> 
>  "-//Apache Struts//XWork Validator Definition 1.0//EN"
> "http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd 
> <http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd>">
> 
>  class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
>  class="com.opensymphony.xwork2.validator.validators.ConversionErrorFieldValidator"/>
> 
> 
> 
> my struts.xml config form constant Struts-spring:
> 
> 
> 
> 
> 
> 
> 
> my validation method using Annotation
> 
> 
>   //validation
>   @Validations( requiredFields = {
>   @RequiredFieldValidator(type = ValidatorType.SIMPLE, 
> fieldName = "parameterString1", message = "You must enter a value for field.")
>   }
>   )
>   @Action(value = "testingValidation", results = {
>   @Result(name = "success", location = 
> "/pages/blank.jsp"),
>   @Result(name = "input", location = "/pages/blank.jsp"),
>   @Result(name = "error", location = "/pages/blank.jsp") 
> },
>   interceptorRefs = {
>   @InterceptorRef("validation")
>   })
>   public String testingValidation() {
>   List a = new ArrayList();
>   a.add("salah field");
>   setActionMessages(a);
>   return SUCCESS;
>   }
> 
> when i hit the URL http://localhost:8080/baseapp/example/testingValidation 
> <http://localhost:8080/baseapp/example/testingValidation>(without parameter) 
> it does’t show my error message, the error should shown using 
>  tag in JSP.
> 
> when i trace the log, here i found:
> 
> 
> [http-nio-8080-exec-6] DEBUG 
> com.opensymphony.xwork2.validator.ValidationInterceptor - Validating 
> /example/testingValidation with method testingValidation.
> [http-nio-8080-exec-6] TRACE 
> org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
> autowiring property 'textProviderFactory' of bean 
> 'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by 
> name: no matching bean found
> [http-nio-8080-exec-6] TRACE 
> org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
> autowiring property 'validatorContext' of bean 
> 'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by 
> name: no matching bean found
> [http-nio-8080-exec-6] TRACE 
> org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
> autowiring property 'valueStack' of bean 
> 'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by 
> name: no matching bean found
> 
> the spring nt autowiring validation.
> 
> 
> 
> 
> 
> 
> 



Validation using Struts2-spring

2020-06-03 Thread M Huzaifah
Hii Guys,

i’am stuck with Validation in Struts2 using struts2-spring plugin. 
struts version : 2.5.22
spring version : 5.2.1.RELEASE

my validators.xml in classpath:


http://struts.apache.org/dtds/xwork-validator-definition-1.0.dtd;>







my struts.xml config form constant Struts-spring:







my validation method using Annotation


//validation
@Validations( requiredFields = {
@RequiredFieldValidator(type = ValidatorType.SIMPLE, 
fieldName = "parameterString1", message = "You must enter a value for field.")
}
)
@Action(value = "testingValidation", results = {
@Result(name = "success", location = 
"/pages/blank.jsp"),
@Result(name = "input", location = "/pages/blank.jsp"),
@Result(name = "error", location = "/pages/blank.jsp") 
},
interceptorRefs = {
@InterceptorRef("validation")
})
public String testingValidation() {
List a = new ArrayList();
a.add("salah field");
setActionMessages(a);
return SUCCESS;
}

when i hit the URL http://localhost:8080/baseapp/example/testingValidation 
(without parameter) it 
does’t show my error message, the error should shown using  tag 
in JSP.

when i trace the log, here i found:


[http-nio-8080-exec-6] DEBUG 
com.opensymphony.xwork2.validator.ValidationInterceptor - Validating 
/example/testingValidation with method testingValidation.
[http-nio-8080-exec-6] TRACE 
org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
autowiring property 'textProviderFactory' of bean 
'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by name: 
no matching bean found
[http-nio-8080-exec-6] TRACE 
org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
autowiring property 'validatorContext' of bean 
'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by name: 
no matching bean found
[http-nio-8080-exec-6] TRACE 
org.springframework.beans.factory.support.DefaultListableBeanFactory - Not 
autowiring property 'valueStack' of bean 
'com.opensymphony.xwork2.validator.validators.RequiredFieldValidator' by name: 
no matching bean found

the spring nt autowiring validation.









Re: Issue adding filter to struts2-archetype-starter project

2020-05-05 Thread M Huzaifah
Eyou should use interface Filter in servlet package. Not from nio package

On Tue, May 5, 2020, 22:40 Dave Newton  wrote:

> `import java.nio.file.DirectoryStream.Filter` is not a servlet filter.
>
> Dave
>


Re: OSGi support

2020-04-15 Thread M Huzaifah
Hii Lucas,

Personally, i am not use OSGi. There is plan to remove this in struts?

Regards.

On Wed, Apr 15, 2020, 12:29 Lukasz Lenart  wrote:

> Hi,
>
> Does anybody is using OSGi support in Struts these days?
>
>
> 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: Tiles upgrade Path

2020-03-25 Thread M Huzaifah
Hii

Got the differencea in here
http://tiles.apache.org/framework/tutorial/pattern.html

I have to try using tiles. When i need a Single Page Application approach,
currently i use one single jsp page that have iframe in it. So the page
literally have header, footer, sidebar, and iframe for body content. And
then, when we hit the menu in sidebar, the iframe body should reload with
page return from normal struts action. I make all pages in struts (not all
jsp, except selected jsp e.g login, main page, etc) decorated by sitemesh.

Anyone can give me a efective why to build SPA approach in struts2 ?

Regards.


On Wed, Mar 25, 2020, 23:19 M Huzaifah  wrote:

> Hii
>
> I am not use tiles before, it seems like site mesh. Currently we use
> sitemesh to decorate page based on url. I checked the tiles its retired. I
> suggest you to use sitemesh. I dont know what is plus using tiles. With
> sitemesh you don't even use plugin in struts.
>
> Thank you...
>
> On Mon, Mar 23, 2020, 16:41 amit vijayvargee 
> wrote:
>
>> Hi,
>>
>> We are currently looking to migrate struts 2.3 and tiles 2 to newer
>> version. As per the security scan, existing tiles (2.0) version is
>> deprecated and reported some vulnerability in it.
>> Could you please help to answer following queries?
>> •   Possible options to migrate to newer version, we are planning to
>> upgrade to struts 2.5 with tiles plugin, please confirm
>> •   Any migration documentation or reference link would be helpful
>> •   Any challenges/issues during the upgrade cycle?
>> •   Support lifecycle & maintainability of struts2-tiles-plugin
>> •   As per the maven repository struts2-tiles-plugin has only compile
>> tile dependency upon tiles-jars (core, api etc..) and doesn’t required to
>> bundle with the deployable artifact (.war)?
>>   Thanks in advance.
>>
>> Regards,
>> Amit V
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>


Re: Tiles upgrade Path

2020-03-25 Thread M Huzaifah
Hii

I am not use tiles before, it seems like site mesh. Currently we use
sitemesh to decorate page based on url. I checked the tiles its retired. I
suggest you to use sitemesh. I dont know what is plus using tiles. With
sitemesh you don't even use plugin in struts.

Thank you...

On Mon, Mar 23, 2020, 16:41 amit vijayvargee 
wrote:

> Hi,
>
> We are currently looking to migrate struts 2.3 and tiles 2 to newer
> version. As per the security scan, existing tiles (2.0) version is
> deprecated and reported some vulnerability in it.
> Could you please help to answer following queries?
> •   Possible options to migrate to newer version, we are planning to
> upgrade to struts 2.5 with tiles plugin, please confirm
> •   Any migration documentation or reference link would be helpful
> •   Any challenges/issues during the upgrade cycle?
> •   Support lifecycle & maintainability of struts2-tiles-plugin
> •   As per the maven repository struts2-tiles-plugin has only compile
> tile dependency upon tiles-jars (core, api etc..) and doesn’t required to
> bundle with the deployable artifact (.war)?
>   Thanks in advance.
>
> Regards,
> Amit V
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: OGNL in struts tag

2020-02-20 Thread M Huzaifah
Dear Lucas,

Sorry if i am wrong about that. let me clarify in here.

let say i have pojo :

public class FormColumnKey {
private Integer formcolumnFormId;

private String formcolumnName;
//sette-getter
}
in action class, i have list of clolumn:

private List displayColumnList;


and then, i put all my column from table into the list, next i’ll iterate that 
list in JSP. so this is what i’ve done in JSP:

 


the jsp has error:

Struts Problem Report

Struts has detected an unhandled exception:

Messages:   
/pages/common/genericform/genericMain.jsp (line: 165, column: 24) According to 
TLD or attribute directive in tag file, attribute name does not accept any 
expressions
File:   org/apache/jasper/compiler/DefaultErrorHandler.java
Line number:41


cause the error above, then i state attribute name on struts tag does not 
accept any expressions. if i test to just print like code bellow thats no 
problem:

 
${a.formcolumnName}

so, i read your documentation about the expression, then i change my code 
bellow:




it works perfectly, thank you Lucas.


Regards



> On 20 Feb 2020, at 16.16, Lukasz Lenart  wrote:
> 
> wt., 18 lut 2020 o 17:04 M Huzaifah  napisał(a):
>> Thank you Lucas, my goal is render the struts tag based on list of column
>> name that i've set before. So i have to iterate the list of column using
>> jstl than put the "name" on attribut name in struts tag. From here,  i
>> think i miss understanding about struts tag. I use struts 2.5x that not
>> support for expressions anymore.
> 
> Wait, what? Struts tags do not support expressions? Where did you find
> such information? Did you read that?
> https://struts.apache.org/tag-developers/tag-syntax.html (improved
> version I'm working on right now
> https://struts.staged.apache.org/tag-developers/tag-syntax.html)
> 
> Also Struts tags are using our internal mechanism which prevents
> evaluating malicious expressions, in case of using JSTL you don't have
> such control and as those tags are out of Struts control you can
> mistakenly inject a malicious code
> https://struts.apache.org/security/#internal-security-mechanism
> 
> Also using JSTL and Struts tags in the same JSP is like using Java and
> Kotlin to write the same code. Anyway, Bad Idea.
> 
> 
> 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: OGNL in struts tag

2020-02-18 Thread M Huzaifah
Dear Lucas,

Thank you Lucas, my goal is render the struts tag based on list of column
name that i've set before. So i have to iterate the list of column using
jstl than put the "name" on attribut name in struts tag. From here,  i
think i miss understanding about struts tag. I use struts 2.5x that not
support for expressions anymore.

Dear Prasanth,

Yes thank you for your advise.

I have done my little work for dynamic field by generate html code (include
attribut name, id, value, class) in action class, then render the code into
JSP using ${htmlComponen} syntaks. I know this is temporary solution, for
next i have to improve.


On Tue, Feb 18, 2020, 21:28 Prasanth  wrote:

> Guessing you are trying to create dynamic names for the text fields. If
> you have dynamic names how are you going to get the values into your
> action? You could probably have an array of text fields
> where the names of text fields are like mytext[columnName1],
> mytext[columnName2]  etc.
>
> You can then use a map in the action to collect the values from the jsp.
> In the below example you would use a map named mycolumns.
>
> 
> 
> 
>
> I think Struts2 tags don't allow EL so you have to use OGNL expression to
> create dynamic names.
>
> On 2/18/20 7:09 AM, Lukasz Lenart wrote:
> > wt., 18 lut 2020 o 05:22 M Huzaifah 
> napisał(a):
> >> I've looking for solution how to create struts2 tag could generate
> >> dynamically. This is my code:
> >>
> >> 
> >>  
> >> 
> > You shouldn't mix Struts and non-Struts tags, this is a bad idea. Why
> > don't you use  here?
> > https://struts.apache.org/tag-developers/iterator-tag.html
> >
> > And I'm not sure what do you want achieve with this strange syntax
> > "name:${column.columnName}"?
> >
> >
> > Regards
>
>


OGNL in struts tag

2020-02-17 Thread M Huzaifah
Dear All,

I've looking for solution how to create struts2 tag could generate
dynamically. This is my code:


 


There is a way we can use ${} ini struts tag?. I found security issue about
this evaluation sintaks in here :
https://securitylab.github.com/research/apache-struts-double-evaluation

Anyone has done with this?

Regards


Re: Struts Application Generator plugin

2019-11-30 Thread M Huzaifah
Hi,..

I was wonder to have  generator like you said. My idea came up when i use
mybatis generator. Mybatis generator will inspect single column in table
that we've registeren in config, and generate the POJO,Interface, and XML
for us. For custom purpose i plan to use it for generate JSP, struts2
controller, and Spring Service (i use Spring instead).

In the future, this feature will usefull when we need to speedup
development such as create a CRUD on Master Tables


Regards

On Sun, Dec 1, 2019, 08:00 Zahid Rahman  wrote:

> Hi,
>
> I am sure you are familiar with the Java Object Orientated Code Generator
> Plugin ,
> where you can declare a variable in a class and then you are able to
> generate
> the repetitive task of generating code for the Getters and  Setters for
> that variable.
> No doubt the experience is rather fun too !.
>
> Is there a plugin available where you place your cursor in the .jsp.
> start a GUI plugin.
>
> create a field variable of type  [s:textfield  s:radio  s:select
>  s:checkbox  s:textarea s:checkboxlist  etc.] .
> select the attributes associated for that field , from a list [ drop down
> or radio button].
>
> You then have option of  Generating the corresponding  class  property,
> including  create a class if one doesn't exist,
> Go on to generate code for field getter and setter in the class and even
> perhaps  the  corresponding  s:property in a selected  JSP (create a JSP if
> one doesn't exist, minimum generated code required code by struts
> framework), Also  creating the corresponding s:property field just above
>  TAG.  all following the struts design pattern.
>
> As you can see the functionality of the Struts application Generator plugin
> is same as the Object orientated getter an setter, constructor code
> generator plugin, you are familiar using , but specific for struts
> framework.
> The struts Application Generator will also eliminated many  of the
> unnecessary bugs found by application developers.
>
> Please see page 411  ISBN 0-8053-5340-2 Object Orientated Analysis and
> Design with Applications for further details.
>
> Best Regards
> Zahid
>
> .
>


Re: Update views how to ?

2019-11-26 Thread M Huzaifah
Hi Yasser,

Thank you for your information, glad to hear that struts2 going to have
Async actions support. until this day, i use DWR for sync and Async.
this feature make me easy build app using strtus2.

Regards

On Sun, Nov 24, 2019 at 3:09 PM Yasser Zamani 
wrote:

> Hi Zahid,
>
> Additionally, AFAIK...
>
> If your users are a lot, then I think you have to wait for Struts 2.6
> release where I've added support for Async actions. For an instance usage
> see my example at [1] (you can try it via running Struts 2.6 snapshot
> showcase - it's a simple chat room i.e. classic usage of server push).
>
> Otherwise or anyway, for now, you can try if Struts ExecAndWait is able to
> handle your users.
>
> Regards.
>
> [1]
> https://github.com/apache/struts/pull/179/commits/aee171c3b8ad401006612c4df44ed540fb2ed7e3
>
> >-Original Message-
> >From: M Huzaifah 
> >Sent: Friday, November 22, 2019 6:57 AM
> >To: Struts Users Mailing List 
> >Subject: Re: Update views how to ?
> >
> >Hi,
> >
> >You should use stream mecanism for that case. What i've done, i used JMS,
> >message-broker, which mean the browser always listen to message-broker
> server
> >using websocket (STOMP,AMQP,etc). When backend push message to the broker
> >server, browser automatically receive and render the message to the
> browser. I
> >use ActiveMQ over MQTT, and render the message using javascript in
> browser.
> >
> >You can find another stream mecanism or reactive application example out
> there.
> >
> >Regards
> >
> >On Fri, Nov 22, 2019, 10:06 Zahid Rahman  wrote:
> >
> >> Hi,
> >>
> >> I have an admin screen (jsp) where  the administrator updates values
> i.e.
> >> current weather temperature, cricket , football score, death counter
> >> showing people killed by knife crime in a city, natural causes , car
> >> accidents etc.
> >>
> >>
> >> I have at least two users who are looking at the current temperature
> >> or game score etc. (JSP).
> >>
> >> Once the administrator updates the values , the data viewed by the two
> >> users In their browser is now stale data , due to the fact the web
> >> browser is based on a stateless pull model.
> >>
> >> Is there an example app or maven  archetype which shows how I can
> >> update or  refresh  the views (JSPs viewed in browser) in all the user
> >> sessions [views ] from inside the running application server using the
> >> struts2 framework.
> >>
>


Re: Update views how to ?

2019-11-21 Thread M Huzaifah
Hi,

You should use stream mecanism for that case. What i've done, i used JMS,
message-broker, which mean the browser always listen to message-broker
server using websocket (STOMP,AMQP,etc). When backend push message to the
broker server, browser automatically receive and render the message to the
browser. I use ActiveMQ over MQTT, and render the message using javascript
in browser.

You can find another stream mecanism or reactive application example out
there.

Regards

On Fri, Nov 22, 2019, 10:06 Zahid Rahman  wrote:

> Hi,
>
> I have an admin screen (jsp) where  the administrator updates values i.e.
> current weather temperature, cricket , football score, death counter
> showing people killed by knife crime in a city, natural causes , car
> accidents etc.
>
>
> I have at least two users who are looking at the current temperature or
> game score etc. (JSP).
>
> Once the administrator updates the values , the data viewed by the two
> users
> In their browser is now stale data , due to the fact the web browser is
> based on a stateless pull model.
>
> Is there an example app or maven  archetype which shows how I can update
> or  refresh  the views (JSPs viewed in browser) in all the user  sessions
> [views ] from inside the running application server using the struts2
> framework.
>


How to Strtus2-Rest plugin could create /user/{id}/{branch} URL Pattern

2019-05-11 Thread M Huzaifah
Dear All,

i’am stuck how to create /user/{id}/{branch}/{xx} URL Pattern using 
Struts-convention and Struts2-rest plugin.
there is a way to make it done? 

I knew it can be done by using advance wildcard in our struts xml as mention in 
here https://struts.apache.org/core-developers/wildcard-mappings.html 

i would better to use Annotation in our Action Class like this code below:

@ParentPackage("baseapp")
@Namespace("/api/test/{id}/{branch}")
public class UserApi implements ModelDriven {

private String id;
private String branch;
Object resposeModel;

//our setter-getter, index, show, etc method 

@Override
public Object getModel() {
// TODO Auto-generated method stub
return resposeModel;
}


}

Regards,,,…..

Re: [ask] How to pass multiple radio button in struts2

2018-12-24 Thread M Huzaifah
Hi Yasser,

i tried, it will exception.

 i use this code bellow to get that value, instead for loop:
request.getParameterValues("viewAccess["+i+"]")[0]
this work for me. i’ll update if i got the proper way about this

Thank you


> On 22 Dec 2018, at 15.31, Yasser Zamani  wrote:
> 
> Hi,
> 
> As different values are setting into same viewAccess[0], I guess instead 
> `private String viewAccess[][];` (array of array) would work.
> 
> Regards. 
> 
>> -Original Message-
>> From: M Huzaifah 
>> Sent: Friday, December 21, 2018 11:44 AM
>> To: Struts Users Mailing List 
>> Subject: [ask] How to pass multiple radio button in struts2
>> 
>> Hi Members,
>> 
>> i would like to ask something about radio button in strtus2.
>> 
>> i have radio button in jsp like this:
>> 
>> 
>> 
>>   All
>>   Self
>>   Custom
>> 
>> 
>> 
>>   All
>>   Self
>>   Custom
>> 
>> 
>> and in my JavaAction class i add property " private String viewAccess[]; “ 
>> also with
>> setter and getter.
>> 
>> the problem is, i am not able to get value of radio button in Java Action. i 
>> use
>> struts 2.3.35
>> 
>> someone could help?
>> 
>> Thank you
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org



[ask] How to pass multiple radio button in struts2

2018-12-21 Thread M Huzaifah
Hi Members,

i would like to ask something about radio button in strtus2.

i have radio button in jsp like this:



All
Self
Custom



All
Self
Custom


and in my JavaAction class i add property " private String viewAccess[]; “ also 
with setter and getter.

the problem is, i am not able to get value of radio button in Java Action. i 
use struts 2.3.35

someone could help?

Thank you



Re: Ask - "Reloading all providers." everytime invoce action.

2018-12-12 Thread M Huzaifah
Dear Yasser Zamani,

Thank you dude, noted

Regards


> On 12 Dec 2018, at 16.16, Yasser Zamani  wrote:
> 
> Hi,
> 
> Sorry this is a bug in 2.5.18 which only occurs in development mode, so, the 
> easiest workaround is to set struts.configuration.xml.reload to false.
> 
> This bug already has fixed [1] and will be released soon with 2.5.19.
> 
> Regards.
> 
> [1] https://issues.apache.org/jira/browse/WW-4974
> 
>> -Original Message-
>> From: M Huzaifah 
>> Sent: Wednesday, December 12, 2018 12:37 PM
>> To: user@struts.apache.org
>> Subject: Ask - "Reloading all providers." everytime invoce action.
>> 
>> Dear All,
>> 
>> I already migrate from struts 2.3 to 2.5.18 successfully, i also integrate 
>> struts2
>> with spring (autowired capability). i found somethin strange in my console. 
>> what i
>> found is everytime request action, in console always show this log:
>> 
>> "[INFO  2018-12-12 15:46:29,369]
>> com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>> provider [Struts XML configuration provider (struts-default.xml)] needs to be
>> reloaded. Reloading all providers."
>> 
>> in struts2.3 theres no log like that. this will effect rendering time in 
>> browser,
>> theres lag when load the result page.
>> 
>> my action use interceptor for authorization, in the interceptor class i use
>> 
>> 
>> WebApplicationContext wac =
>> WebApplicationContextUtils.getWebApplicationContext(request.getServletConte
>> xt());
>> 
>> BeanService beanService = wac.getBean(BeanService.class);
>> 
>> 
>> to get my bean from spring ioc.
>> 
>> theres is explanation about this??
>> 
>> i am using log4j2 for my log. this is the complete log what i’ve got:
>> 
>> 
>> [INFO  2018-12-12 16:04:37,138]
>> com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>> provider [Struts XML configuration provider (struts-default.xml)] needs to be
>> reloaded. Reloading all providers.
>> [INFO  2018-12-12 16:04:37,557]
>> org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
>> Struts-Spring
>> integration...
>> [INFO  2018-12-12 16:04:37,557]
>> com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire
>> strategy to name [INFO  2018-12-12 16:04:37,558]
>> org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
>> Struts-Spring
>> integration successfully [WARN  2018-12-12 16:04:37,700]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:37,700]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:37,701]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:37,701]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD invoke intercept() INFO | [Begin] execute method
>> index()  INFO | [end] execute method index() [INFO  2018-12-12 16:04:38,557]
>> com.opensymphony.xwork2.config.ConfigurationManager | Detected container
>> provider [Struts XML configuration provider (struts-default.xml)] needs to be
>> reloaded. Reloading all providers.
>> [INFO  2018-12-12 16:04:38,768]
>> org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
>> Struts-Spring
>> integration...
>> [INFO  2018-12-12 16:04:38,771]
>> com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire
>> strategy to name [INFO  2018-12-12 16:04:38,773]
>> org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
>> Struts-Spring
>> integration successfully [WARN  2018-12-12 16:04:38,895]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:38,895]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:38,896]
>> com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor
>> found for name = enableSMD [WARN  2018-12-12 16:04:38,896]
&

Ask - "Reloading all providers." everytime invoce action.

2018-12-12 Thread M Huzaifah
Dear All,

I already migrate from struts 2.3 to 2.5.18 successfully, i also integrate 
struts2 with spring (autowired capability). i found somethin strange in my 
console. what i found is everytime request action, in console always show this 
log:

 "[INFO  2018-12-12 15:46:29,369] 
com.opensymphony.xwork2.config.ConfigurationManager | Detected container 
provider [Struts XML configuration provider (struts-default.xml)] needs to be 
reloaded. Reloading all providers."

in struts2.3 theres no log like that. this will effect rendering time in 
browser, theres lag when load the result page.

my action use interceptor for authorization, in the interceptor class i use


 WebApplicationContext wac = 
WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());

BeanService beanService = wac.getBean(BeanService.class);


to get my bean from spring ioc.

theres is explanation about this??

i am using log4j2 for my log. this is the complete log what i’ve got:


[INFO  2018-12-12 16:04:37,138] 
com.opensymphony.xwork2.config.ConfigurationManager | Detected container 
provider [Struts XML configuration provider (struts-default.xml)] needs to be 
reloaded. Reloading all providers.
[INFO  2018-12-12 16:04:37,557] 
org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
Struts-Spring integration...
[INFO  2018-12-12 16:04:37,557] 
com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire strategy 
to name
[INFO  2018-12-12 16:04:37,558] 
org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
Struts-Spring integration successfully
[WARN  2018-12-12 16:04:37,700] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:37,700] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:37,700] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:37,700] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:37,701] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:37,701] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
invoke intercept() INFO | [Begin] execute method index()
 INFO | [end] execute method index()
[INFO  2018-12-12 16:04:38,557] 
com.opensymphony.xwork2.config.ConfigurationManager | Detected container 
provider [Struts XML configuration provider (struts-default.xml)] needs to be 
reloaded. Reloading all providers.
[INFO  2018-12-12 16:04:38,768] 
org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
Struts-Spring integration...
[INFO  2018-12-12 16:04:38,771] 
com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire strategy 
to name
[INFO  2018-12-12 16:04:38,773] 
org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
Struts-Spring integration successfully
[WARN  2018-12-12 16:04:38,895] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:38,895] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:38,896] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:38,896] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:38,896] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:38,897] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[INFO  2018-12-12 16:04:39,028] 
com.opensymphony.xwork2.config.ConfigurationManager | Detected container 
provider [Struts XML configuration provider (struts-default.xml)] needs to be 
reloaded. Reloading all providers.
[INFO  2018-12-12 16:04:39,186] 
org.apache.struts2.spring.StrutsSpringObjectFactory | Initializing 
Struts-Spring integration...
[INFO  2018-12-12 16:04:39,186] 
com.opensymphony.xwork2.spring.SpringObjectFactory | Setting autowire strategy 
to name
[INFO  2018-12-12 16:04:39,186] 
org.apache.struts2.spring.StrutsSpringObjectFactory | ... initialized 
Struts-Spring integration successfully
[WARN  2018-12-12 16:04:39,293] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:39,294] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD
[WARN  2018-12-12 16:04:39,294] 
com.opensymphony.xwork2.config.providers.InterceptorBuilder | No interceptor 
found for name = enableSMD

Re: A book of Struts

2018-10-17 Thread M Huzaifah
Hii Lukas,

Sounds great, consider to add integration with other framework such as
spring, mybatis, etc

Regards

On Wed, Oct 17, 2018, 2:38 PM Lukasz Lenart  wrote:

> Hi everyone,
>
> I would like to (finally ;-) write a book about the latest version of
> the Apache Struts, probably targeting Struts 2.6. I wonder what kind
> of book this should be:
> - an introduction from zero to a full blown app
> - a 101 good practices/examples
> - any other idea
>
> I hope you will give me some positive feedback to start working on this
> task :)
>
>
> Kind 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
>
>