Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
1.0.1
-
None
-
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