views:

236

answers:

1

I have a form which has both HMTL tags and struts tags. I use the HTML tags because of alignment issues with struts tags.

<s:form action = "setNode" name = "processing" method ="POST">



      <script>
      <!--
      createTree(catArray);

      </script>
      <br/>
      <s:radio name="processOption" label="" list="{'Add','Move','Delete'}" ></s:radio>

      <s:textfield name="node" ></s:textfield>

      <s:submit name="Go" value="              Go                " align="center" />
      </s:form>

the createTree function creates a tree form with HTML checkbox input types.

The action triggers a java function. How do i see which checkboxes are checked?

+1  A: 

Bad approach, I'd say.

First, have you taken a look at the generated html? (generated by struts, at least - if possible also generated by you javascript). It's the first thing to do, always. Can you post it ?

Second, are you aware of "themes" in struts2 forms ? If you are using the default ("xhtml"), the form will be inside a table, and, if you are going to add some non-struts2 elements inside, you must be aware of that - for example, your <br/> tag seems out of place.

Third, Struts2 tags are always mixed with html tags, that their point. I guess you mean you are mixing input html tags (form elements) generated in javascript with others generated by the struts2 tags. In general, this is messy, you should try to avoid this. Even more when your tags are generated by a black-box javascript function as yours (with document.write() I guess). You should try (except very special scenarios) to generate those checkboxes with struts2.

leonbloy
Well thanks for all the insight. I haven't come across themes, because I'm just a beginner as far as struts is concerned.
ryan
You're welcome. Post your generated html if you need more help. BTW, if this helps: Firefox allows you get the html code (including the generated dinamically by javascript) if you select a fragment of the web page, right-click, "View selection source".
leonbloy