aspose file tools*
The moose likes Struts and the fly likes Struts validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts validation" Watch "Struts validation" New topic
Author

Struts validation

shyam jakki
Ranch Hand

Joined: Dec 09, 2003
Posts: 37
Hi

�On Main selection criteria screen we have a Sort-by Button, the user clicks the button and it opens a new popup window. On the Window the user has the ability to select the sort by information based on the configuration, and he can either choose the columns based on the position and order of the columns i.e. either on Ascending or Descending.
�The new window screen would be in the following way for example

Column Name from configurationPosition(dropdown)Order(radiobuttons)
Department 1---n Asc/Desc
Age1---nAsc/Desc
Salary1---nAsc/Desc



In the above sample screen the user has the ability to choose/select the column names as desired.

a.First column: represents the Column names.
b.Second column: represents at which column position the data of the column name to be ordered.
c.Third Column: represents the Order data of the column corresponds, it would be either in Ascending or Descending.

For example the user might select in the order, the Department as the first position in Ascending and then salary as the second one in Descending or Age as the 3rd one in Descending or vice versa, or any column position and order he wants. And also user has the ability to change the positions/orders as he needed to appear.

�After the user done with the selection criteria and clicks "OK" button on the sort by window screen. The selected data would be saved in to memory (i.e. the values would be retained as long as the user is in session) and will go back to the main selection screen.


As the user selects only two columns to sort the drop down should show only 1-2 postions.

I have to retrieve a List getSortedelements(String columnname,int position, boolean ascending)at the server.

Appreciate if anyone helps me on this how to do this using struts.

Thanks in advance
Regards
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I was reading along and looking for a question. It seems like you have most everything thought out. What in particular do you need help with?

- Brent
shyam jakki
Ranch Hand

Joined: Dec 09, 2003
Posts: 37
Hi

I'm looking how to do the server side validations like to retrieve the List of Sorted ones, If the user selects first department as ist position in Asc and then salary 2nd postion Desc and then Age as the 3rd as Asc.

The drop dwon and the Asc/Desc Radio buttons should be Dynamic.

Please could you help me with the code at the .

I have a two classe one with SortManage and other one SortBy

public class SortManager {

List sortbyList = null;
/**
* @param sortBy
*/
public void addSortBy(SortBy sortBy) {

if ( sortbyList == null ){
sortbyList = new ArrayList();
}

sortbyList.add(sortBy);

}

public List getSortConfig() {
return this.sortbyList;
}

public String toString() {
for ( Iterator f = sortbyList.iterator(); f.hasNext() {
SortBy sortBy = (SortBy) f.next();
sortBy.toString();
}

return "";
}

}


And other SOrtBY Class
public class SortBy {

private String sortColumnName;

private String sortDisplayTitle;
private int position;

private String sortOrder;

/**
* @return Returns the position.
*/
public int getPosition() {
return position;
}
/**
* @param position The position to set.
*/
public void setPosition(int position) {
this.position = position;
}
/**
* @return Returns the sortOrder.
*/
public String getSortOrder() {
return sortOrder;
}
/**
* @param sortOrder The sortOrder to set.
*/
public void setSortOrder(String sortOrder) {
this.sortOrder = sortOrder;
}
/**
* @param sortColumnName
*/
public void setColumnName(String sortColumnName) {
this.sortColumnName = sortColumnName;

}

/**
* @param sortDisplayTitle
*/
public void setDisplayTitle(String sortDisplayTitle) {
this.sortDisplayTitle = sortDisplayTitle;

}

/**
* @return Returns the sortColumnName.
*/
public String getSortColumnName() {
return sortColumnName;
}
/**
* @return Returns the sortDisplayTitle.
*/
public String getSortDisplayTitle() {
return sortDisplayTitle;
}

public String toString(){
System.out.println ("Sort Column Name -> "+ sortColumnName + " Sort Display Title "+ sortDisplayTitle );
return "";
}
}

And the XML file as

<property-group name ="ScreenDefinitions">
<property-group name="ScreenDefinition">
<property-group name="DisplayEmployees">
<property-group name="Filters">
<property name="Filter1">Department</property>
<property name="Filter2">Age</property>
</property-group>
<property-group name="FilterDependencies">
<property-group name="Age">
<property name="DependsOnFilter1">Department</property>
</property-group>
</property-group>
<property-group name="Sort">
<property-group name="Column1">
<property name="ColumnName">empName</property>
<property name="DisplayTitle">Employee Name</property>
</property-group>
<property-group name="Column2">
<property name="ColumnName">dept</property>
<property name="DisplayTitle">Department</property>
</property-group>
</property-group>
</property-group>
</property-group>
</property-group>



I have the following flows

1.User Clicks the Sort by button on the Main Screen
2.Sort by pop-up window Screen is displayed with default sort order.
3.User selects sorted selection criteria as desired as by Column name, by position and the order
4.User clicks "OK" button and the selected sort by information would be saved into memory and (i.e. the values would be retained as long as the user in the session) will go back to the main screen.

alternate flow would be

1.User clicks the Sort by button on the filter screen.
2.Sort by pop-up window screen is displayed with default sort order.
3.User specifies the order of position multiple times.
4.User clicks the Ok button.
5.Displays an error message "Ordering of position of columns have been specified multiple times" to sort.

Appreciate if you would help with the validations code.

Regards
Shyam
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts validation