Can anyone give the solution for reading .properties file from jsp page (using HTML5 or other tags)?
A JSP is a servlet with a different syntax. It executes at server-side. HTML5 is a markup language interpreted by browsers, at-client-side. It has nothing to do with reading properties files.
Since JSPs are servlets, they can contain any kind of Java code. So you read a properties file in a JSP the same way you would do it in any Java application (using the java.util.Properties class).
However, in well-designed applications, the JSP is only used as a view, generating markup from data prepared by a controller written in Java. It's the job of the controller to read a properties file. Not the job of a JSP.
I think you should read tutorials and understand what a servlet, a JSP, an HTML page, and MVC are, because you seem quite confused.
Related
I want a parameter in html code to be dynamic which is passed while the code. For eg if I run eg.html?link=https://google.com then the html code should be able to parse google.com and be able to open it. If I run eg.html?link=https://gmail.com, then gmail should open.
HTML alone cannot do that. In order to dynamically change the content of the HTML file, you will need some server-side processing using a language such as PHP, Python, or Node.js.
Hi I am currently working on delphi intraweb. I try to import html template file to the program instead of hard-code it by using components from tool palette. However, I cannot find anyway to interact with the html file satisfyingly. For example, I want to handle the values of input box in the html file or adding data to data table through delphi. Or should I perform the tasks through other aspects?
I am using IWTemplateProcessorHTML to load external html template to delphi but I couldnt figure out a way to pass values from the html file to delphi or from delphi to that html file in run-time. There is not coding involved yet.
Thanks.
my keys and values for translating the web app (AngularJS) are located in DB
Is there a way for razor to get a request for sample_{culture}.html and manipulate the html containing translation keys to return a translated html?
If you get your translation strings from the db instead of a resx file, you have to write your own resource provider:
http://msdn.microsoft.com/en-us/library/aa905797.aspx
This is not complicated and there are examples out there for a DB resource provider.
Once you have that, you can just localized the razer cshtml files. I don't think this works with normal html files though.
I want to make a program that prepares an HTML file. It would either be on the server side or just running in my local machine.
I think it would be nice to be able to use the dart:html library since it has a lot of methods for manipulating html (obviously). But it is thought to be used dynamically on the client side, and I want to use it like this: manipulate an html DOM tree with dart:html, and when its ready, write a static html file. For instance using query('body').innerHtml
The problem I'm running into is that I if start a project with the "console application" template, I am not able to make dart:html talk to an html file. And if I choose "web application", in which I am able to do this, I cannot load the dart:io library, maybe it has to do with it being tagged as [server] in the SDK?
Of course I could just do:
print(query('body').innerHtml);
and manually copying the output to a file, but I thought maybe there is a more elegant solution.
See html5lib.
html5lib in Pure Dart
This is a pure Dart html5 parser. It's a port of
html5lib from Python. Since it's 100% Dart you can use it safely from
a script or server side app.
Eventually the parse tree API will be compatible with dart:html, so
the same code will work on the client or the server.
It doesn't support much in the way of queries yet.
Is there a way to read an XML file via HTML/Javascript on the client side?
I know I can add the XML data in the string in the javascript of the page. This solution works but it would be great if the xml file could be added like a css or a javascript file.
Is there a way to add a XML file like you would add a js file?
You could convert the XML into JSON or import it into a database first.
PHP has a library called Simple XML Parser that comes with most distributions. The interface is really straightforward.
Python also has a rich library called lxml to parse XML.
As the comments noted, accessing an XML file on the fly is probably not efficient.