Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML Writer for a web project.

 
rahull agarwal
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont think you can use java for that! are you thinking of Javascript???
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe "custom tag" refers to JSP? I think we need a better description of the problem.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64858
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic