Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-3057

I am unable to pass run time value in "propety" and "type" attribute of <bean:define> tag

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 1.0.1
    • None
    • Tag Libraries
    • None
    • struts 1.0, jsp 2.0, jdk1.5
    • Important

    Description

      I need to define a varible type of that varible should be define at run time.

      i am geeting one parameter from request whcih define type of varible and property name of that bean where it should be created.

      String temp="";
      String prop = "";
      String typ = "";
      if(null !=request.getAttribute("flag")){
      temp = request.getAttribute("flag");
      }

      if(temp.equals("true")){
      prop = "currentUser";
      typ = "com.for.model.vo.UserVO";
      } else{
      prop = "currentContact";
      typ = "com.for.model.vo.ContactVO";
      }

      <bean:define id="vo" name='"myBean" property="<%=prop%>" type="<%=typ%>" />

      it does not work but when i pass hard code value in these attribute then..it works fine.

      i.e.

      <bean:define id="vo" name='"myBean" property="currentUser" type="com.for.model.vo.UserVO" />

      OR
      <bean:define id="vo" name='"myBean" property="currentContact" type="com.for.model.vo.ContactVO" />

      Please tell me, does it possible to pass run time value in this tag and if we can then where i am doing mistake in above code.

      please revert back as soon as possible.

      kamlesh sharma

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamlesh_sharma_dts kamlesh sharma
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: