File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes HTML Writer for a web project. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "HTML Writer for a web project." Watch "HTML Writer for a web project." New topic
Author

HTML Writer for a web project.

rahull agarwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 31
Hi,

I have a web project. I am not using swing. I am creating a custom tag.

Within this tag, is there something like HTMLWriter that I can use?

I would like to be able to create a table, add tr and td within that.

Thanks so much.
sean beacham
Greenhorn

Joined: Apr 12, 2011
Posts: 20
i dont think you can use java for that! are you thinking of Javascript???
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18876
    
    8

Maybe "custom tag" refers to JSP? I think we need a better description of the problem.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61594
    
  67

There is nothing like this built into JSP. You may find a 3rd-party library if you look around.

If your tag emits a lot of HTML or other markup, you might consider using a tag file rather than a Java class to implement your tag.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61594
    
  67

sean beacham wrote:i dont think you can use java for that! are you thinking of Javascript???

Custom tags are implemented on the server side; not with JavaScript.
rahull agarwal
Ranch Hand

Joined: Dec 20, 2010
Posts: 31
I appreciate all the answers. I also apologize for not being clear in my question.

I have a custom tag. that is implemented as a java file extending TagSupport

public class MyTag extends TagSupport {

public int doStartTag() throws JspException {
try {
pageContext.getOut().print("<b>test statement that is bold</b> <u>test statement that is underlined</u>");

is this the best way to do this? Or can i use some htmlwriter to create that html statment?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61594
    
  67

As I said, there is no "HTML writer" in the JSP or servlets APIs.

And again, if your tag mostly emits markup, learn about tag files.

And if you decide to implement your tag as a Java class, use modern SimpleTagSupport. TagSupport is an older API.

(And please UseCodeTags when posting code.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTML Writer for a web project.