Scenario 1 works because the JSP parser understands it needs to parse the tags. However, Scenario 2 is simply returning text that will be written to the response. There is no way that I know of to force a container to read dynamically-generated JSP without spitting it out into a JSP file and including that JSP file or (BAD IDEA!!!) calling the JSPC code from within your JSP/servlet.
If you want to get the dynamic results from the string, you can instantiate instances of the tags that are actually doing the work, or if possible, use runtime expressions in the parameters of the tags. However, I'm not sure exactly what you're trying to accomplish by returning JSP from a method so this may not be helpful at all. -- Michael D. Norman ProbuSoft -- Custom Software Development http://www.probusoft.com/ 913-390-6951 [EMAIL PROTECTED] > -----Original Message----- > From: Chadha, Deepak (BLM) [mailto:[EMAIL PROTECTED] > Sent: Friday, October 17, 2003 12:51 PM > To: [EMAIL PROTECTED] > Subject: HTML encoding of text returned from a bean > > > Hi, > I have some UI customization that is done based on some data. In order to > implement it in a generic, reusable fashion, I am trying to generate the > HTML text (including struts tags) in a bean (called FETList below). > > Scenario1 shown below works. However, Scenario2 is what I am trying to > get working and not succeeding. > Thanks for any help. > Regards > Deepak > > Scenario1: Placing the code in the JSP. This works and a droplist shows > up fine. > ****CODE IN JSP **** > <jsp:setProperty name="FETList" property="currentKey" > value="MEMBER_DETAIL5MEM_FIELD5C5"/> > <bean:define id="dctest" name="FETList" property="myFieldChoiceList" /> > <BR> New > <html:select property="contractName"> > <html:options collection="dctest" property="value_cd" > labelProperty="ext_desc" /> > </html:select> > > > > Scenario2: Attempting to invoke the getHTMLString() on the bean from the > JSP. This does not work. Instead of the droplist showing up, I see the > actual text showing up ("<bean:define id..) What am I doing wrong? Is > there some way that I need to flag an encoding scheme? > > > ****CODE IN JSP **** > <jsp:setProperty name="FETList" property="currentKey" > value="MEMBER_DETAIL5MEM_FIELD5C5"/> > <BR> <bean:write name="FETList" property="HTMLString" /> > > ****CODE IN BEAN FETList that is invoked **** > public String getHTMLString() { > > System.out.println("Entered getHTMLString"); > > String HTMLString = new String(); > > HTMLString = "<bean:define id=\"dctest\" name=\"FETList\" > property=\"myFieldChoiceList\" /><BR> New <html:select > property=\"contractName\"> <html:options collection=\"dctest\" > property=\"value_cd\" labelProperty=\"ext_desc\" /> </html:select>"; > > return HTMLString ; > > } > ******* Confidentiality Notice ******* > This email, its electronic document attachments, and the contents of its > website linkages may contain confidential health information. This > information is intended solely for use by the individual or entity to whom > it is addressed. If you have received this information in error, please > notify the sender immediately and arrange for the prompt destruction of > the material and any accompanying attachments. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]