Generate a HTML file from JSP
Does anyone know how to generate a html file from code in JSP without using a form, as i have one of those already. I don't want this page to appear, just exist.
Thanks
You can do like this:
File outputFile = new File("Publicacao.html");
FileWriter escrever = new FileWriter(outputFile);
escrever.write("<center><h1>Assunto:" + assunto + "</h1></center><br><center><h2>Titulo:" + titulo +"</h2></center><br><center><h3>Sub Titulo:"+subTitulo+"</h3></center><br>"+ conteudo +"<br>");
escrever.close();
Similar Messages
-
Generate an HTML file from a Report in ABAP
Good morning,
How I could generate an HTML file from a report.
Any Ideas... I have found the function WWW_ITAB_TO_HTML, but someone has the standar code and how use this function?
Thanks a lot,
Hernán RestrepoHi,
I am facing a similar problem.I did try using the function module WWW_ITAB_TO_HTML in the reoprt program, as I'm trying to generate a url from a report, but i'm not able to get the expected results. The code is given below. Could someone please try and help me resolve this issue.Thanks in advance.
DATA: emp_name TYPE char80.
DATA: it_itabex TYPE zdb_ex_tty,
it_emp TYPE TABLE OF zis_emp,
it_org TYPE TABLE OF zis_org,
it_pos TYPE TABLE OF zis_pos,
it_pos_alloc TYPE TABLE OF zis_pos_alloc,
it_res TYPE TABLE OF zis_res,
it_res_alloc TYPE TABLE OF zis_res_alloc,
ls_itabex TYPE zdb_ex_s.
DATA: lv_filename TYPE string,
lv_path TYPE string,
lv_fullpath TYPE string,
lv_replace TYPE i.
DATA qstring LIKE it_itabex OCCURS 10.
DATA: url(200), url2(200), url3(200), fullurl(200).
FIELD-SYMBOLS: <fs_emp> LIKE LINE OF it_emp,
<fs_org> LIKE LINE OF it_org,
<fs_pos> LIKE LINE OF it_pos,
<fs_pos_alloc> LIKE LINE OF it_pos_alloc,
<fs_res> LIKE LINE OF it_res,
<fs_res_alloc> LIKE LINE OF it_res_alloc.
Report Program to export data from database to Excel.
Populate all the tables that have to be exported.
SELECT * FROM zis_org INTO TABLE it_org.
SELECT * FROM zis_pos INTO TABLE it_pos.
SELECT * FROM zis_pos_alloc INTO TABLE it_pos_alloc.
SELECT * FROM zis_emp INTO TABLE it_emp.
SELECT * FROM zis_res_alloc INTO TABLE it_res_alloc.
SELECT * FROM zis_res INTO TABLE it_res.
Append the Column Header
CLEAR ls_itabex.
ls_itabex-ipp_pos_id = 'IPP Pos ID'.
ls_itabex-emp_name = 'Name'.
ls_itabex-dt_of_join = 'JoinedOn'.
ls_itabex-emp_status = 'Status'.
ls_itabex-org_name = 'Org'.
ls_itabex-prj_name = 'Project'.
ls_itabex-mgr_name = 'Line'.
ls_itabex-designation = 'Designation'.
ls_itabex-specialization = 'Specialization'.
APPEND ls_itabex TO it_itabex.
Append all the tables into one internal table
LOOP AT it_pos_alloc ASSIGNING <fs_pos_alloc>.
CLEAR ls_itabex.
ls_itabex-ipp_pos_id = <fs_pos_alloc>-ipp_pos_id.
READ TABLE it_emp ASSIGNING <fs_emp> WITH KEY emp_guid = <fs_pos_alloc>-emp_guid.
IF sy-subrc = 0.
CONCATENATE <fs_emp>-emp_fname <fs_emp>-emp_lname INTO ls_itabex-emp_name SEPARATED BY space.
ls_itabex-dt_of_join = <fs_emp>-dt_of_join.
ls_itabex-emp_status = <fs_emp>-emp_status.
ls_itabex-specialization = <fs_emp>-specialization.
ENDIF.
READ TABLE it_pos ASSIGNING <fs_pos> WITH KEY ipp_pos_id = <fs_pos_alloc>-ipp_pos_id.
IF sy-subrc = 0.
ls_itabex-designation = <fs_pos>-designation.
READ TABLE it_org ASSIGNING <fs_org> WITH KEY org_id = <fs_pos>-org_id.
IF sy-subrc = 0.
ls_itabex-org_name = <fs_org>-org_name.
ls_itabex-mgr_name = <fs_org>-mgr_name.
ENDIF.
ENDIF.
READ TABLE it_res ASSIGNING <fs_res> WITH KEY org_id = <fs_org>-org_id.
ls_itabex-org_name = <fs_org>-org_name.
APPEND ls_itabex TO it_itabex.
ENDLOOP.
url = 'http://testweb/scripts/wgate/zvw10a/!?~language=en'.
url2 = '&~OkCode(LGON)=LGON&login-login_user='.
url3 = '&vbcom-vbeln='.
CONCATENATE url url2 url3 INTO fullurl.
WRITE: /'Staffing Excel'.
CALL FUNCTION 'WWW_SET_URL'
EXPORTING
offset = 12
length = 10
func = fullurl
TABLES
query_string = qstring
EXCEPTIONS
invalid_table = 1
OTHERS = 2.
Thanks & Regards,
Preethi. -
How to generate a html file from a xml file with the default Firefox look and feel
Hello
Any xml or xsd file are pretty printed with Mozilla firefox. I would like to generate the equivalent html file, in order to introduce it later in a Word document. Do you use a xslt file ? How can I do this ?
Best regardsI would be remiss if I did not point out that the forum software detected your Firefox as version 17. Is that correct?
Version 17 is not secure; Mozilla discloses [https://www.mozilla.org/security/known-vulnerabilities/firefox.html security flaws] after each new release. Is something holding you back from upgrading to Firefox 31? Please let us know so we can suggest solutions or workarounds.
If Help > About Firefox shows Firefox 31, you may need to clear the preference that is misreporting your version number. See: [[Websites say that Firefox is outdated or incompatible even though it's the latest version]]. -
How to generate individual HTML files from linked help?
Hi folks,
I'm trying to figure out how to generate individual web pages - based on heading types - from a help project this is linked to a FrameMaker book.
I'm linking to the FM book, rather than importing, because the import process ruins my graphics. So, I know how to create individual web help pages using the import process; but that's not an option for me. (The graphics issue is a whole other discussion, which I've since given up on.)
So, I'm using TCS 3.5 (RH9 and FM10). I've successfully linked to the FM book. Each topic represents a complete chapter and includes a single Heading 1 for the title and several Heading 2's. Again, these are all in the same help topic because I'm linked to the FM book.
What I want to do is generate the web help so that new web pages (files) are created. In other words, I want breaks before each Heading 2. I want the resulting web pages to be named based on the Heading 2.
Is this possible?
Thanks for reading,
TomI’m not sure I understand the problem (I’m using FM 10, RH9, TCS3): You can adjust .isf and all Conversion/CSS mapping, etc settings for an existing project (Linked or Imported) at:
File > Project Settings > FrameMaker Document > Edit Conversion settings for FrameMaker documents: (click Edit button).
Then, Go to FrameMaker Settings > Paragraph > Heading 1 etc. and click the box for Pagination.
What I don’t know is if you have to re-do your linking process from scratch to do your pagination settings right the first time (like create a new project with your Frame docs, which shouldn’t be hard to test if you have saved your CSS, Master Pages etc), or already have an .isf file with proper settings that you can specify at time of first import/linking. I already had these in place when I set up my linked project of a Frame book with 13 chapters – 350 pages – resulting in over 300 separate HTML files/topics (set H1, H2, and H3 levels to paginate). I don’t know if you can change these things post-linking, but it can definitely be done!
There is definitely no reason to have to have an entire FM chapter as one topic in RH. You may have to create a new project to achieve your desired results, I am not sure.
I hope this is helpful. Regarding RH ruining your images, I know what you mean. Through a painstaking process of research, trial, and error, I found that these Image options in the Conversion Settings produced the best results for me, though not as good as “ideal:”
· Check the box for “Use Distiller to Generate Image”
· Leave the “Do Not Regenerate Images” and “Preserve 3D Images” boxes unchecked
· Under Preferred Dimensions: Check “Maintain Aspect Ratio” and check Width and Height – Set both to 0pt. (*This one was a key tip.) Leave “Scale” unchecked. (Scaling seems to do terrible things in RH.)
· I left the Max Dimensions settings unchecked.
· Set my personal preferences for margins (2pt all sides) and borders (solid, gray, 1 pt)
· Under Advanced, Default format of PNG with color bit depth of 24. My graphics are all screenshots, so this is the reason for this in my instance.
Regards,
Virginia -
Generating an HTML file.....
I would like to generate an HTML file from my javaBean but I am unsure how to do this? Do I just use the PrintWriter methods in java.io and rename the text file to a .html file?
Thanks,
SteveI assume you really mean you want to write a java servlet - in that case read Java Servlet Programming by Jason Hunter. Then you can write html like this:
/**Process the HTTP Post request*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Connection conn = null;
Statement stmt=null;
String query = null;
ResultSet rset = null;
response.setContentType(CONTENT_TYPE);
// nothing will come out on page unless an error occurs
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>AddItemServlet</title></head>");
out.println("<body>");
etc etc. -
Execute html file from java code - urgent!!!
Hi,
I need help!!
My application should open html file that located in my computer
it should be open when some line in JList was choosen
my question is: How can I open html file from my application
I work with window XP
I tried this one :
Runtime.getRuntime().exec(cmdLine);
but it doesn't work
the exeption was: CreateProccess
Please help! it's urgent!!!!http://forum.java.sun.com/thread.jsp?forum=31&thread=497600
-
Generate an XML file from a DOM tree
Hi,
I'm trying to generate an XML file from a DOM tree that I obtained from another XML file with the Xerces library. I used the following operation :
public static void writeXmlFile(Document doc, String filename) {
try {
Source source = new DOMSource(doc);
File file = new File(filename);
Result result = new StreamResult(file);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.transform(source, result);
} catch (TransformerConfigurationException e) {
System.err.println(e);
System.exit(1);
} catch (TransformerException e) {
System.err.println(e);
System.exit(1);
But I have this Windows/Linux problem. When I execute this on Windows, everything is correct. But if I try on Linux (every distribution does the same thing), I obtain an XML file where everything is written on just ONE LINE : there is neither identation nor carriage return at the end of a line ... And that is pretty annoying 'cause I need to SEE what I generate ...
Thanks for your answer,
Blueberryfin.Actually I would think that no indents and no new-lines would be more correct, but maybe it's an option for parsers to do it either way if you don't specify it. If you want to specify it, look at this post from last month:
http://forum.java.sun.com/thread.jsp?forum=34&thread=383400 -
How to include HTML file in JSP using HTML elements or Javascript?
Hi,
I have around 15000 static html files one for each item which we display each upon invoking an item.The HTML file should be part of a JSP file.
Please note that the name of the HTML file is determined dynamically
Placing all the HTML files within the web application does not give us good performance so i would like to put all of them in the webserver.
I am not able to include the file in the JSP using the jsp:include attribute if i place the HTML files in the webserver ,
in order to do that i think should use either HTML element or javascript to include the HTML in the JSP.is there any alternative to <Jsp:include>
Does anyone have an idea how to include the HTML file and take advan tage of webserver?
Any ideas are appreciatedWhat you need to do is simply read the HTML file from the disk and dump it out to the outputstream. It really is that simple.
There's no reason you need to include all 15000 files in the actual WAR, you can place those files any place handy that is easy for the application to see (in another directory, or accessible from a file server if you have multiple front ends).
Then, just write a utiility function that takes the output stream (i.e. the 'out' JSP variable), and the file name, read the file, and write it to the stream.
If you start noticing performance issues, then you can try doing some caching, but truth is your OS should be doing that for you.
But, truth be told that's the only practical way to do it.
Another solution would be to use JavaScriipt and XMLHttpRequest (i.e "AJAX") to load the file at the client side, and simply replace a tag with the results.
That's also pretty trivial to write, any web site talking about AJAX should give you hint there.
Of course, that won't work for folks who have JavaScript turned off, or some other incompatible browser, whereas the server side solution obviously works everywhere. -
Referencing static html pages from jsps...
Hi,
This is probably a very simple thing to solve, but I'm having problems with referencing
html pages from jsps under Weblogic.
I get Error 404 - not found, whenever I try something like this in a JSP...
<frame name="title" src="title.html" scrolling=no>
The title.html file has definitely been copied into my ear file, and yet it isn't
found. I can solve the problem by turning title.html into a jsp and registering
it in web.xml. But this seems like serious overkill with static content!!
Am I missing something really simple here?
I've worked it out - directory mistake...
Thanks,
Chris
"Matt Krevs" <[email protected]> wrote:
>it sounds like a relative pathing problem
>
>is title.html reachable if you enter its address in the browser?
>
>is title.html in the same directory as your jsp?
>
>perhaps you could post your web.xml file?
>
>"Chris Sceats" <[email protected]> wrote in message
>news:3d9c41b5$[email protected]..
>>
>> Hi,
>>
>> This is probably a very simple thing to solve, but I'm having problems
>with referencing
>> html pages from jsps under Weblogic.
>> I get Error 404 - not found, whenever I try something like this in
>a
>JSP...
>>
>> <frame name="title" src="title.html" scrolling=no>
>>
>> The title.html file has definitely been copied into my ear file, and
>yet
>it isn't
>> found. I can solve the problem by turning title.html into a jsp and
>registering
>> it in web.xml. But this seems like serious overkill with static content!!
>>
>> Am I missing something really simple here?
>
>
-
Write HTML Files from java application
Hello,
i have to write HTML files from a java application.
I am asking if anybody can give me a hint about a good simple solution (library) which can do some of the job for me.
i know FOP for example is good to create pdf or html from xml, but i dont want to go via xml.
the sites i need are really very simple presents emails.
body and maybe a link for next and pervious.
however, thank you in advance.
a little hint will also help :)
Sako.That, too, is my question.
Be the "server" local or remote, wouldn't JSPs still
be the easier solution? No. it will not. because you need a server. Server for a stand alone application is not esier. according to who said JSPs are easy?
Its very very difficult.
>
When answering, please clarify. I'm a bit of a newbie
here. :)To get sence about how hard is JSP, check Struts. this is very good open source Framework to simplify the JSPs. but it still complecated enough.
or Tapestry my lovely open srouce Framework.
its easier than Struts. but sill complecated because of the documentation.
All in all, using JSP is the purpose of Java in the internet. but not for me. My application will not be available in the internet, i.e. no server, i.e. no need for JSP.
i hope that helps a little. -
Forwarding to an xml file from jsp page
hi
i am subhash. i have problem in forwarding an xml file from jsp page.
i have a jsp page in which i have a button. upon click, its form method is triggered and the action is set to "serverpage.jsp". In that jsp page i have to move to an xml file. I would like u to send a sample code also for the same.
Thank You,
Subhash..Refer to the Generating XML from JSP section.
http://java.sun.com/developer/technicalArticles/xml/WebAppDev2/ -
Generating a Movie File from a List of (JPEG) Images
Hi All!
I was trying this example:
Generating a Movie File from a List of (JPEG) Images
http://java.sun.com/products/java-media/jmf/2.1.1/solutions/JpegImagesToMovie.java
I was using the following command line with the following output:
root - /home/robertmarkbram/java/jmf/classes
$java JpegImagesToMovie -w 320 -h 240 -f 1\
-o file:///home/robertmarkbram/CoolCampus/media/jpgOut.mov\
file:///BigBrain3/pics/breakfast.jpg\
file:///BigBrain3/pics/eating.jpg\
file:///BigBrain3/pics/howto.jpg\
file:///BigBrain3/pics/jupiterp_cassini_full.jpg\
file:///BigBrain3/pics/jupiterp_cassini.jpg\
file:///BigBrain3/pics/spocamok.jpg- create processor for the image datasource ...
Setting the track format to: JPEG
- create DataSink for: file:///home/robertmarkbram/CoolCampus/media/jpgOut.mov
start processing...
- reading image file: file:///BigBrain3/pics/breakfast.jpg
- reading image file: file:///BigBrain3/pics/eating.jpg
- reading image file: file:///BigBrain3/pics/howto.jpg
- reading image file: file:///BigBrain3/pics/jupiterp_cassini_full.jpg
- reading image file: file:///BigBrain3/pics/jupiterp_cassini.jpg
- reading image file: file:///BigBrain3/pics/spocamok.jpg
Done reading all images.
java.lang.NullPointerException
at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescription(QuicktimeMux.java:936)
at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.java:925)
at com.sun.media.multiplexer.video.QuicktimeMux.writeSTBL(QuicktimeMux.java:905)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMINF(QuicktimeMux.java:806)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMDIA(QuicktimeMux.java:727)
at com.sun.media.multiplexer.video.QuicktimeMux.writeTRAK(QuicktimeMux.java:644)
at com.sun.media.multiplexer.video.QuicktimeMux.writeMOOV(QuicktimeMux.java:582)
at com.sun.media.multiplexer.video.QuicktimeMux.writeFooter(QuicktimeMux.java:519)
at com.sun.media.multiplexer.BasicMux.close(BasicMux.java:142)
at com.sun.media.BasicMuxModule.doClose(BasicMuxModule.java:172)
at com.sun.media.PlaybackEngine.doClose(PlaybackEngine.java:872)
at com.sun.media.BasicController.close(BasicController.java:261)
at com.sun.media.BasicPlayer.doClose(BasicPlayer.java:229)
at com.sun.media.BasicController.close(BasicController.java:261)
at JpegImagesToMovie.controllerUpdate(JpegImagesToMovie.java:215)
at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)
Can anyone tell me what this error message means?
Thanks for any advice!
Rob
:)I think it does that for QuickTime if you don't define the lineStride value in the VideoFormat (lineStride = pixelStride * width).
-
How I could generate an XML file from a report in version 4.0B
Good morning,
How could I generate an XML file from a report? Please note that I am using version 4.0B
I don't have access to
Billy VitalHi,
In the Class CL_XML_DOCUMENT,
we have a method EXPORT_TO_FILE to download an XML file. -
How to call java class file from jsp
hi
we need to call java classes (which are written separately in .java file )from jsp file. we need it for our project if anyone knows about please reply us.
bye
siva sankariyou can call the methods in a lot of ways. you could use scriptlets with the
<%@ page import="package.class"%> and then inside instantiate an object
<%
MyClass mc = new MyClass(parameters if any);
mc.theMethodYouWantToCall();
%>or as Madathil has stated,
or use the JSP tags
<jsp:useBean id="anyname" class="classname"/>and then use the getProperty tag
or even Custom Tags -
How can i render a dynamic html file in jsp page
Hi everybody,
i am trying to render a dynamic html file in jsp page with the result of querying a database.
The response of the query is a xml document. And i have a stylesheet to transfer it to html.
How can i render the html in a jsp file?I am using below code for HTML files
private var appFile:String="index.html";
if (StageWebView.isSupported)
currentState = "normal";
webView.stage = stage;
webView.viewPort = new Rectangle( 10, 130, (stage.stageWidth)-20, 750 );
var fPath:String = new File(new File("app:/assets/html/aboutus/"+ appFile).nativePath).url;
webView.loadURL(fPath);
addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
else {
currentState = "unsupported";
lblSupport.text = "StageWebView feature not supported";
above code is working fine for me.
Maybe you are looking for
-
Installation problem for oracle 9i on linux
The following error I have got during installation of Oracle 9i (9.2.0.1.0) downloaded enterprise version for Linux from otn site. Red Hat Linux Release 9 (Kernel 2.4.20-8) 1. Could not copy /home/oracle/OraHome1/Apache/Apache/conf/ssl.key/server.key
-
Jsf web project is not working in eclipse ConfigureListener
Hi, I created a dynamic web project in eclipse with tomcat server, I also referenced the jsf jar files, besides the web.xml files contains <listener-class>com.sun.faces.config.ConfigureListener</listener-class>; even though when I run the web project
-
Product name: Pavilion dm1-4000au Product number: QG411PA This question was solved. View Solution.
-
Inserting Metadata events in a live stream using non-flash client app
Hi all, I wish to insert captions into a live flash video stream. I found an example here : http://www.adobe.com/devnet/flashmediaserver/articles/metadata_video_streaming_print.html but this example uses a Flash client app wich can invoke something l
-
i am trying to register for eprint and i keep getting a message that my email address is invalid. It is a valid email address