如何获取DDL表单的字段名称?

时间:2020-04-09 15:23:57

标签: java liferay

我实现了MVCActionCommand来覆盖ddl表单的add方法。我想从该表格检索字段的值。

class Level_Select
{
  private int level;

  public Level_Select(int level)
  {
  this.Level = level;
  }

   public int Level
   {
    get { return level; }
    set {
     if (value == 1)
      {
      this.level = value;
      }
      else if (value == 2)
      {
      this.level = value;
      }
      else if (value == 3)
      {
      this.level = value;
      }
     }
    }

    public static int Default()
    {
    int min = 000;
    int max = 999;
    Random num = new Random();
    return num.Next(min, max);
    }

    public static int level1()
    {
    int min = 000;
    int max = 99999;
    Random num = new Random();
    return num.Next(min, max);
    }

   public static int level2()
   {
   int min = 00000;
   int max = 99999999;
   Random num = new Random();
   return num.Next(min, max);
   }

   public static int level3()
   {
   int min = 000000000;
   long ten = 9999999999;
   int max = (int)ten;
   Random num = new Random();
   return num.Next(min, max);
   }
}

也尝试过这个,但是给了我一个'null'值

@Override
public boolean processAction(ActionRequest actionRequest, ActionResponse actionResponse) 
throws PortletException {      
 try {
        String fieldName = ParamUtil.getString(actionRequest, "field_name");      
        System.out.println(fieldName);    //returned nothing
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return false;
}

0 个答案:

没有答案