Vita Rara: A Life Uncommon

Solved - Colspan not working for some "input" tags like "submit"

Great Work ! So while I am happy I like to give here some hints...

I noticed that in my struts version 2.1.6 for instance the "colspan" for the "<s:submit>" was not working. The reason is the same as Mark noticed that simple "parameters" are not passed. So how to pass the parameters to your UI tag?

Well the "<s:submit>" and also the "<s:form>" tag are "open-" and "closing-tags".

public abstract class FormButton extends ClosingUIBean
public class Form extends ClosingUIBean

The passing of the parameters happens not during the "open-tag", it happens at the "closing-tag". The content resp. the body and its child tags (param tags) are getting later evaluated and are available when thhe "closing-tag" is executed.

// e.g. the "end" tag evaluation of the "parameter tag"
// initializes its owner with the parameters
public boolean end(Writer writer, String body) {
Component component = findAncestor(Component.class);
....
component.addParameter(name, value);
}

These "open-" and "closing-tags" have also 2 freemarker templates. e.g. an "open" which is for instance the "submit.ftl" and the "submit-close.ftl"

In the example, you provided only an "opening" template. So in case you test there for instance for parameters then you will get nothing.

So to solve my problem for the provided example. Rename the provided "submit.ftl" to "submit-close.ftl" and empty the "submit.ftl"

With some refactoring you should also now be able to get rid of the "qTableLayout" and use instead "s:param" tags.

regards
Mark Egloff

Reply

Please solve the math problem above and type in the result. e.g. for 1+1, type 2
  • Allowed HTML tags: <a> <img> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <h1> <h2> <h3>
  • Lines and paragraphs break automatically.
More information about formatting options