JSP - How to read file and display Image - html

I have an JSP page where I want to display an image from a specific folder of my computer. Can any body help me how can I do this ? Another issue is, I want to read a text file from a specific folder by my JSP code, can anybody help me how can I achive this ?

You can use an HTML img tag to display the image. As long as the image is in the same directory as your jsp file, you can just reference it directly.
As far as reading the file goes, it really depends on what exactly you're trying to do here. For a complex web application, (in the interests of keeping your model and view separate) you need to use a lot of different technologies like JSTL and java beans, and maybe even a framework like Spring. If what you're trying to do is simple you can "cheat" and read the file with a scriptlet, just don't expect the code to scale to anything complicated.

Related

Change csv output from one column to multiple in html

I have tried to find an answer but am not finding what I am looking for. I am using hostinger to host my website and using their built in design software. Their csv output creates a csv file with all parameters in one column instead of each parameter in its own column. I believe programming is in html and I don’t have access to base code but I can add to the “header” of the code with custom code. Does anyone know what will help me to solve my issue?
I haven’t tried anything yet as I’m not very familiar with html and Hostingers support team told me to look here as they specialize in hosting and support of that, not programming.
are you using their Website builder and a pre-designed templates ?
if you think the problem come from website template, you can delete that section and use custom html code
https://support.hostinger.com/en/articles/6475646-website-builder-how-to-customize-a-website-template#h_ed99b23b6a
There are two ways to add HTML code to your website, and it depends on the type of code you want to add.
If the code needs to be added to the part of your website's source code, use the Custom code field in your website's integration settings.
If the code needs to be added to the part of your website's source code, use the Embed code element.

How to parse a PDF using AS3? (air)

is there a way to parse a pdf using AS3 via Air in mobile?.
I don't need the full content of the PDF, only some data, is that possible?.
Edit for clarification:
I got a PDF file that was originally created based on a XML, what I'd need is to be able to retrieve that XML. Or at least, to find a string inside that PDF so I can make a call to a web service.
Original:
There's nothing native in AS3 for this kind of stuff but AlivePDF. It won't let you traverse things like XML so much, as it seems like you're trying to do by taking a small bit of a PDF, but it will let you create pdf's, add pages and change fonts etc.
You weren't entirely clear on what you're attempting to achieve, if you update your question a with a bit more detail we may be able to help a bit more.
Edit:
From the refined question, AlivePDF is not what you're after as it's really only for PDF generation. I'm assuming you're after a method to traverse the document like you would XML, by looking for a tag and extracting the information. I've not found a way to do this other than iterating through the document and searching manually which probably isn't what you're after.
After some searching I found an as3-pdfreader which doesn't seem to be complete at the moment. However on the Project Home the roadmap says parsing pdf files is complete, I've not been able to try it out yet though.

How to locate an HTML file on localhost using Google Developer Tools?

I'm building a website using Wordpress on Localhost. I'm learning the structure of the webpage by editing the HTML and CSS using Google Developer Tools. I want to know which file I'm editing and where on the hard drive it is located.
I have edited the height and width of an element inside the circle marked but when I try to save the file, it asks me for a location to save which I'm unaware of. One the left is the HTML code, how can I locate the file with that HTML code?
how can I locate the file with that HTML code?
You can’t – not really, not from within your browser, because your browser doesn’t see individual “files”, it only sees the complete HTML source code of the one resource it requested, that might have been composed of lots of different files, plus functions that generate HTML code dynamically – so that actual piece of HTML code might not even be written as such within a file.
You might be able to identify different sections of the HTML document though – and with a little knowledge of the template structure and output logic of WordPress, you should be able to find out what the relevant file to look in might most likely be.
Another thing I’d suggest, is that you get yourself an IDE that allows you to search across all files in the whole project folder – and than look for certain class names, IDs etc. on the HTML element in question or near/above it. If you search for those, you might get lucky as well. (Although a lot of times those classes/IDs might be output dynamically as well, so you won’t find them inside of a template file as such.)
Especially with little knowledge of WP template structures, it might take some trial and error to find the piece of code and file you are actually looking for.
The Google Developer Tools is not a code editor, so whilst you can try out different options I'm not aware that you can save it, and if you can, I wouldn't say it's a good idea.
Wordpress uses PHP, a language which HTML code is embedded with PHP code. For example the code <a href='<?php echo(link1);?>'>Home</a> has had the href attribute embedded with a PHP variable. If you want to find the HTML code, look at the PHP files in your Wordpress directory, index.php is the landing page code.
One thing to bear in mind is that not all the HTML code will be included in one PHP file, it is usually included from several files, and much of the content will be in the wp-content directory, keep an eye out for the PHP include or require commands.
Google developer tool is just to check, once you are done with the editing, You have to copy your css code- and paste in your css file.
To get the css file look at the below image.
Hope your question got clarified!!

Beautifying HTML with JSP mixed in

Does anyone know of an HTML beautifier that can deal with (or at least ignore) JSP? I've searched high and low... I'm not looking for an HTML validator, just something that can format the file decently (i.e. indentation).
Most good IDE's will let you say which code template to use as default within another file extension.
So i use PHPstorm in which i can say, for example that a *.jsp will use html first and then jsp. This way the page will display and reformat my code with the correct spacings and what not.
Worth looking into which IDE you are using, assuming you're using one :)

How to embed link HTML into CSS file for menus?

I know something like this is possible, I'm pretty sure I'm just wording it wrong as I've been searching online for hours to no avail.
The same way an HTML page refers to the CSS file for a menu design, how can the HTML page also refer to a file (or the same CSS file if possible) to get the links information? So when I change the link information in that one file, it changes links on all HTML pages referring to it. Is this possible?
There is no simple way to do this. In general this happens server-side and is drawn from a database.
You CAN draw this data from a JavaScript file, using HTML templating without having to depend on a server. This may help.
http://net.tutsplus.com/tutorials/javascript-ajax/quick-tip-an-introduction-to-jquery-templating/