HtmlElement formats the table html and this causes problem :

Hello,
The HtmlElement parses the html and configures the tr and td tags according to an algorithm.
I use an html table to view parts of an image as one image by putting each part of the image to into another td tag.
Since HtmlElement parses this and changes the way it is written a empty space occurs between the rows of my table.
In fact this seems as a bug of InternetExplorer(I am using IE 5 ) but since we can not solve the bugs of IE 5 can somebody help me about this problem?
I am sending the pictures and html pages in the atached zip file.

Thanks
Server
X-Application Version: 3.1.3
Tamino Version : 3.1.1
Platform : Win2k
WebContainer : Tomcat 3.3
JDK Version : 1.3.1
problem.zip (9.66 KB)

I wonder why HtmlElement is used to parse your table. HtmlElement is used to parse smaller html fragments like links or images, not big things like tables. Could you please post the part of your jsp page that contains the table (including the surrounding X-Application tag)?

Michael

Software AG Germany, Darmstadt

Hello,
I put the table into a tag (edit or display) like the one in the attached document.
So HtmlElement needs to parse it.
vArtroplasti.jsp (12.1 KB)

Why do you put tables into edit/display tags?! What do you expect the edit tag to do with the table?

Putting tables into edit or display tags is not supported and shouldn’t work at all, I’m surprised that only the formatting is broken.
Please refer to the jsp tag reference documentation, it lists valid bodies for the various tags.

Michael

Software AG Germany, Darmstadt

Hello,
In fact I dont use the table in an edit or display tag but in a similar tag I have written which extends the FieldTag.
I have to extend FieldTag because I need to write out a table to the jsp file according to the value of this field.
And in the field tag the only way I could write to out is to use HtmlElement like this :
(myHtml contains a table tag…)
htmlElement = sessionContext.initHtmlElement(myHtml);

super.handleInputControls(htmlElement);

// write field values
if (body == null) {
System.out.println(“body null in hxsl”);
htmlElement.writeOut(getOut());
} else {
htmlElement.writeOut(body.getEnclosingWriter());
body.clearBody();
}

This does work fine but only problem is the formatting is broken.
Is there any way to correct this formatting?
Or a way to write any html to the jsp page?

Thanks
Server

Hello,

another way than extending the FieldTag could be using the Plugin interface of X-Application.

I don’t know exactly what you want to do, but according to your description a plugin called by directelementaction could be a solution, e.g.

<xapp:directelementaction type=“printImageTable” select="/Doctype/SubElem1/SubElem2"/>

Within a Java class you implement the method for printing out the table dependent on the content of the selected target node, e.g.

<BR>package myPackage;<BR><BR>public class MyClass {<BR>   public static <B>String</B> getTable(Element elem) {<BR>       String result = "<table><tr><td>" + elem.getText() + "</td></tr></table>";<BR>       return result;<BR>   }<BR>   ...<BR>}<BR></pre><BR><BR>For mapping the action 'printImageTable' to the method 'getTable' add an entry to the xapplication.xml<BR><BR><pre class="ip-ubbcode-code-pre"><BR><element><BR>   <action name="printImageTable" method="myPackage.MyClass.getTable"/><BR></element><BR></pre><BR><BR>or if the action is restricted to a certain element use the name attribute<BR><BR><pre class="ip-ubbcode-code-pre"><BR><element name="SubElem2"><BR>    <action .../><BR>



If you need more information about capabilities of plugins, have a look at the Plugin documentation or post a request to the community.

Bye,
Christian.

You could write without HtmlElement. Just use the getOut() method and write to the resulting Writer.

Michael

Software AG Germany, Darmstadt

Hello,
I have tried using getOut.write("") method but it does not work.
That’s why I have to use HtmlElement to write something to the page.

Here is the code

public class HFResimTag extends FieldTag {

protected String form = null;
protected boolean wrkd = false;
String s;

public void setSelect(String select) {
s = select;
if (form!=null && !wrkd) {
s = Hitit.getTaminoFieldName(s,form);
wrkd = true;
}
super.setSelect(s);
}

public String getForm() { return form; }

public void setForm(String newForm) { form = newForm; }

public void processField() throws XException, IOException {
BodyContent body = getBodyContent();
HtmlElement htmlElement;
String bodyContentStr="";

if (body == null) {
htmlElement = sessionContext.initHtmlElement("<input type=“text”/>");
} else {
bodyContentStr = body.getString();
if (bodyContentStr.length() == 0) {
htmlElement = sessionContext.initHtmlElement("<input type=“text”/>");
} else {
Vector fv = CommonJava.getStringAsVector(fieldValue) ;
for (int i=0;i<fv.size();i++) {
String tmp = fv.get(i).toString();
bodyContentStr = CommonJava.replaceString(bodyContentStr,“f”+tmp.substring(1),“t”+tmp.substring(1));
}
htmlElement = sessionContext.initHtmlElement(bodyContentStr);
}
}
// super.handleInputControls(htmlElement);
getOut().write(bodyContentStr);
// write field values
/
if (body == null) {
System.out.println(“body null in hresimtag”);
htmlElement.writeOut(getOut());
} else {
htmlElement.writeOut(body.getEnclosingWriter());
body.clearBody();
}
/
}
}

this doesnt work…

Oops, my misstake. When called from the field tag’s process Field method, you have to write to body.getEnclosingWriter().

Michael

Software AG Germany, Darmstadt

Hello Michael,
Thanks for your help.
It works EXCELLENT now… :smiley:
Server