Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » FormData samlpe
FormData samlpe [message #1510772] Sun, 14 December 2014 10:37 Go to next message
Flash Man is currently offline Flash ManFriend
Messages: 17
Registered: August 2014
Junior Member
Hello....

Can I use formData object from form (searchForm) to get users from table by search parameters?

Can you give me example...

I am curently doing that by returning Object[][].... Problem is that I have many search parameters, that I add them in function arguments like example bellow...

public Object[][] getUsersBySearch(String username, Date form, Date to, String ....and many more arguments...)

Is it possible to get by FormData search params....but I didnt use generated search form by scout...

ty
Re: FormData samlpe [message #1511039 is a reply to message #1510772] Sun, 14 December 2014 15:57 Go to previous messageGo to next message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
You can just create a normal pojo bean containing your search criteria as fields. You can then pass this bean to getUsersBySearch() which would simplify the method signature.
Re: FormData samlpe [message #1511197 is a reply to message #1511039] Sun, 14 December 2014 19:06 Go to previous messageGo to next message
Flash Man is currently offline Flash ManFriend
Messages: 17
Registered: August 2014
Junior Member
Can you explain that better, I am just starting Scout, Java Smile

Example?
Re: FormData samlpe [message #1511732 is a reply to message #1511197] Mon, 15 December 2014 05:52 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Welcome in the Scout & Java world Wink.

Basic understanding of Java is required to use Eclipse Scout. Maybe you should read some Java introduction book/tutorial (you can find plenty for free online).

In this case, I can describe the idea of Urs Beeli:

POJO is an acronym for Plain Old Java Object. The name is used to emphasize that a given object is an ordinary Java Object, not a special object. You just need to follow the JavaBean conventions.

This means that you create a new Java Class: UserSearchParams

For each property (in this example String username), you create a private member, a getter and a setter:
public class UserSearchParams {
  private String m_username;

  public String getUsername() {
    return m_username;
  }

  public void setUsername(String username) {
    this.m_username = username;
  }

  // same pattern for the other properties.
}


The method signature will be:
Object[][] getUsersBySearch(UserSearchParams params)


Client side you do:
UserSearchParams params = new UserSearchParams();
param.setUsername("John Meyer");
// param.setFromDate(..);
// param.setToDate(..);
// ...
Object[][] data = getUsersBySearch(params)


Server side:
public Object[][] getUsersBySearch(UserSearchParams param) {
  //use param.getUsername();
  //use param.getFromDate();
  // ... 
}

Previous Topic:Maven deploy plugin
Next Topic:Blue backgroud forms
Goto Forum:
  


Current Time: Fri Mar 29 07:40:05 GMT 2024

Powered by FUDForum. Page generated in 0.03133 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top