Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP to HTML on serverside

 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,
In my application I am haviing followings..
1>user creates request by filling up various forms (on JSP)
2>after user finishes all this final JSP having all the details is displayed.
3>the HTML generated from these JSP(including all the details of request) needs to be sent to authorised person via mail.

one suggestion i got is to generate the HTML code in java file and set it as the body of mail.

but i think it will be too complex to implement b'coz the JSP that generates this html is of 500+ lines!!!

I want to know is there n e way by which we can store the HTML generated from the JSP on serverside also in some directory?
by doing this what i will need to do is just to pass the HTML file in the mail body.
Please reply soon...
Its really urgent!
Thanks in advance!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that you could use RequestDispatcher's include() method to generate the same content from a servlet and send it to the user via email.
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay... Thank you very much
i am trying to search how to use this include() method to store the jsp into html format in some directory!
I would be very thank full if you can suggest in what directions i should search.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After some reflexion, I'm not sure that what I've spitted here would work. The include() will output the content of the JSP in the response's output buffer, so I'm not sure you can do something with it.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know whether you guys are aware with delete option or not?

by using this.. you guys edit and delete as well,
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why does it have to be in HTML, and further, why does it have to be the same HTML as what the user sees? That doesn't make sense from a usability point of view. Why wouldn't a tabular text view -which can be generated easily on the server- suffice?
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks i really did not know abuot deleting posts!!!
but now please suggest me some solution to my problem!!
 
lubna kausar
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ulf,
It needs to be the html b'coz its specified in the usecase doc. n in prototype as well.
now its must to implement it.
If there is a way to have the HTML on serverside please let me know.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First "b'coz" is not a word in the English language.
Please be careful to spell words out correctly.
See:
http://faq.javaranch.com/view?UseRealWords
to find out why this is important to us.
Thank you.

As to your question, it is possible to get the generated HTML using a post processing filter but it would probably be more hassle that it's worth.
Web pages in a browser are put together differently than HTML in an email.

Specifically, with browsers, the initial HTML document is returned first.
The browser reads that page an then issues a separate request for each of the linked resources needed to build the page (images, css sheets, linked javascript sheets, etc..)

With email, everything needed to render the page is sent in one bundle (multipart request).

This means that, not only would you have to capture the generated HTML, but that you would have to parse it to figure out what additional resources are needed, and then build a multipart document that contains all of these resources.

If this were my issue, I would look into either getting the specs changed to allow (as Ulf suggested) sending a plain text email message or, building a simplified HTML message that can be easily built up from a plain old Java class.
[ April 18, 2007: Message edited by: Ben Souther ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic