A polymorphic array would be my suggestion. Have an array of objects which contain an identifier for the struts tag type, and the data needed to populate it. For example;
In your action you would have ; private MyPolyObject[] blah; Where MyPolyObject contains; class MyPolyObject { private int type private String value ... } Then your JSP has <s:iterator value="blah"> <s:if test="type==1"> <s:property value="%{value}"> </s:if> <s:elseif test="type==2"> <s:textfield value="%{value}"> </s:elseif> .... </s:iterator> You can then build extend MyPolyObject into classes which hold the information for specific types (e.g. a Map for the s:select type). Hope this helps. Al. -----Original Message----- From: shai200 [mailto:[EMAIL PROTECTED] Sent: 03 January 2008 02:36 To: user@struts.apache.org Subject: Re: Outputting raw HTML with s:property tag OK, here's what I'm doing: I am generating forms from external data. Meaning, I have some XML files, based on which, I am generating a form. Normally I could do this without Actions, but rather include a bean into a JSP file (am I right about that?) However, I also need to use request and response information, and that is why I was trying to do this through an action. Perhaps you have some suggestions for me? Thanks. Laurie Harper wrote: > > Leaving aside the issue that you really shouldn't be spitting HTML out > of calls to action methods, the answer to your question is no. JSPs > are aren't processed 'recursively' like that; you can't have the > result of evaluating something in a JSP be something that needs evaluating. > > Why do you want this? It sounds like you're trying to do too much of > your presentation logic in action code, which is generally a bad idea. > If you describe what you're trying to achieve, someone can probably > suggest a better approach. > > L. > > shai200 wrote: >> No, I want the output of my action to be yet another Struts tag (with >> an >> s: >> suffix) which is translated into its HTML equivalent - so for example: >> >> If my JSP file includes: >> >> <s:property value="property1"> >> >> then the output of myAction.getProperty1 will be the following code: >> >> <s:property value="property2"> >> >> and that in turn returns "Hello". >> >> So I want the outcome to be "Hello" on the screen. >> >> Another example: >> >> <s:property value="mytextbox"> >> >> and the output of that will be >> >> <s:textfield value="hello".... > >> >> and I want the result to be a text field displaying the string "hello" >> inside it. >> >> >> Etcetera... >> >> >> >> newton.dave wrote: >>> --- shai200 <[EMAIL PROTECTED]> wrote: >>>> Second question - how can I use struts tags as output (i.e. >>>> <s:textarea>)? >>>> Can Struts in turn convert them into HTML code by outputting Struts >>>> HTML tag using <s:property > ? >>> You mean you want to display the (escaped) HTML created by a tag? >>> >>> d. >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Outputting-raw-HTML-with-s%3Aproperty-tag-tp14554781p1 4590802.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]