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

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 1.0.1
    • Fix Version/s: None
    • Component/s: Tag Libraries
    • Labels:
      None
    • Environment:
      struts 1.0, jsp 2.0, jdk1.5
    • Flags:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: