struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Sousa <>
Subject REST Plugin
Date Wed, 03 Mar 2010 15:00:41 GMT

I'm facing some problems using this plugin, i want to handle multiple 
parameters,something like the example:

I checked the available examples ( available in and all of them only owns a id that 
fetches the parameter.

Below are the code of the example that i mencioned.

Any of you faced the same problem?
One more question:*

I used the name OrdersController in the class that implements my methods 
and everything works fine, why did this stoped working when  i changed 
the name to OrdersHandlingController? I keeped the Controller at the 
end, i think this should have worked.

Thanks in advance,

Jorge Sousa from Portugal

Code Example:

public class OrdersController extends BaseAction implements 
ModelDriven<Object>, Validateable{

     private Order model = new Order();
     private String id;
     private Collection<Order> list;
     private OrdersService ordersService = new OrdersService();

     // GET /orders/1
     public HttpHeaders show() {
         return new DefaultHttpHeaders("show");

     // GET /orders
     public HttpHeaders index() {
         list = ordersService.getAll();
         return new DefaultHttpHeaders("index")

     // GET /orders/1/edit
     public String edit() {
         return "edit";

     // GET /orders/new
     public String editNew() {
         model = new Order();
         return "editNew";

     // GET /orders/1/deleteConfirm
     public String deleteConfirm() {
         return "deleteConfirm";

     // DELETE /orders/1
     public String destroy() {
         addActionMessage("Order removed successfully");
         return "success";

     // POST /orders
     public HttpHeaders create() {;
         addActionMessage("New order created successfully");
         return new DefaultHttpHeaders("success")

     // PUT /orders/1
     public String update() {;
         addActionMessage("Order updated successfully");
         return "success";

     public void validate() {
         if (model.getClientName() == null || 
model.getClientName().length() ==0) {
             addFieldError("clientName", "The client name is empty");

     public void setId(String id) {
         if (id != null) {
             this.model = ordersService.get(id);
         } = id;

     public Object getModel() {
         return (list != null ? list : model);


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message