Can JSTL be used in HTML page? - html

I have run JSTL tag on JSP page but could not run the same code on HTML page. So, if its possible can anyone help me on it!

As name it self indicates
The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates core functionality common to many JSP applications.
And if you see the wiki of JSTL
It extends the JSP specification by adding a tag library of JSP tags for common tasks,
Summary:You cannot use.

You can't, they only run on JSP pages. Sorry!

Not Possible to do this.It supports only JSP.

Any JSP file is recompiled is when the file is modified and the web container detects it, but definitely this is the wrong approach... What about saving HTML templates in the database and process them before JSP receives them?

Related

What is the best way to include an external html file into another html file?

When I have one basis html file in which I want to embed a few external html files as sort of a portfolio page, what is the best way to embed those external html files? I now use iframe, but I've read that is not the preferred way? What other options are there and which one is the best?
Most modern websites implement a server-side framework such as php or asp.net that can assemble the final HTML for each page and output it together
The only issue with iFrame is that it causes additional round-trips to the server, as the client has to load each frame individually, but if you don't have access to any server-side scripting then any other solution will do the same thing

How do you work with include pages in jsp or php or the likes without getting IDE / Editor warnings for CSS classes?

If the CSS files for your site are referenced in the parent page, obviously you can use those CSS rules and classes in the sub-page or "included" page (like a jsp include or a php include). That will run as expected in the browser. BUT, if you are using an IDE or smart text editor of some kind (I'm using Netbeans), you will get warnings about the CSS elements in the sub-page (a .jspf for example) unless that file has a redundant reference to the css files. Is there a work-around for this? I don't want to have to reference the CSS files in both my jsp and my jspf (jsp include).
One technique I've used is to abandon jspf files in favour of a templating system where if you want to include something from a template, the template is actually a full page of which part is marked to be included. I actually use a home-grown template system for this, but my understanding is that thymeleaf (http://www.thymeleaf.org/) offers the same feature.

JSP include prefixes the project name in the link

I have a html file in a share folder (ie, out of web server location) and I have to include it in a jsp using
<jsp:include page="//TestFolder/Sample.html">.
While running the application the following error appears on the page:
The requested resource (/projectName//TestFolder/Sample.html) is not available
Here the application name (/projectName) is being prefixed with the target path. How to get rid of the application name so that the html can be included within the jsp?
Any clarifications would be appreciable.
Thanks.
The jsp:include action can be used only within the same servlet context. It accepts only relative url(either page-relative or application-relative)
Based on your comment, what you are trying to achieve is not possible with jsp inclued tag nor jsp include directive. This is because, at the end of the day, all JSPs become servlets. And a servlet with dependency outside of it's WAR (or any other packaging) would be quite tricky, now, wouldn't it?
I imagine, however, that you could create your own tag that would dynamically read a static HTML file and include it's contents in response. Just put into account that bypassing this limitation will put your application at risk of this HTML not being available unless you prepare your tag for that.

Is it Possible with out using Iframes we can display HTML page inside an other Html Page?

I am new to HTML5,i need to display one HTML page Inside an other HTML page with out using frames&iframes.
please help me.
the other way is to 'scrape' other web pages via AJAX and insert contents into an element on your page.
You will probably be hosting your HTML web pages in some kind of a server. So in an Apache server you can use PHP include() function.
Or in IIS you can use ASP #include directive

Why would JSP tags appear in HTML source code?

I'm a front-end web developer at a company using Java on their server. As a front-end developer, I'm concerned with the HTML structure that the server produces, but I don't have control over anything our back-end team produces. Rather than ask someone on that team, I would like to gather knowledge from the Stackoverflow community so I can communicate intelligently with the back-end team. So, I am curious as to what would cause certain JSP tags to appear in the rendered HTML that is sent to the browser. We have tags in our HTML source such as:
<flow:fileRef id="vfileColor" fileId="vfile.color"/>
<flow:fileRef id="StyleDir" fileId="StyleDir"/>
<flow:fileRef id="vfileStylesheet" fileId="vfile.stylesheet"/>
I am more interested in knowing why these appear, not as much about what they do. Is there a server setting for Tomcat/Apache/etc. that would hide these tags from the browser? Any information would be helpful. Thanks in advance.
They will appear in the generated HTML source if the associated taglib isn't declared or its URI is wrong.
In this particular case with <flow:xxx> tags, you should have a
<%#taglib uri="a/valid/uri" prefix="flow" %>
in top of the JSP page(s) in question (even if it's only to be used as an include file). If you can't figure the right URI, then you should consult the taglib's documentation for the right one or extract the JAR file of the taglib and read the tld file.
You should also ensure that the JAR file containing the taglib classes and the tld file is been placed in the runtime classpath of the webapplication, e.g. in /WEB-INF/lib.