Escaping html for dynamic javascript
Hi Folks,
Can anyone please tell me how I escape html for use in a function?
Here is my code:
onMouseover="ddrivetip('#jobdescription#','white', 300)";
Thanks in advance
Hi there
What is it you're trying to escape exactly? Do you mean you want the literal # signs to go in? If that's the case then use a double hash ## - Coldfusion will render a single one to the browser.
If that's not what you mean then some more info may be required
O.
Similar Messages
-
Hi,
We created a custom TLN.
I would like to produce href tags but I face the problem of escaping HTML characters :
<aa on_click="return EPCM.doNavigate('<%= currNavNode.getName()%>',0,'','null',1,'<%= *StringEscapeUtils.escapeHtml(*currNavNode2.getTitle(userLocale))%>','')" href="#"><%=currNavNode2.getTitle(userLocale)%></aa>
The problem is that the org.apache.commons.lang.StringEscapeUtils is not available (or I do not know how to make it available...).
How do you proceed for escaping :
- HTML
- URL
- Javascript
Thanks in advance for your help.
Best regards,
GuillaumeHi,
After many tries, I found out that simply quotes and double-quotes is enough for the Javascript EPCM.doNavigate to work (almost) properly.
Here is the code I use in the toplevelnavigation.jsp :
<% String titlePage = "";
String escTitlePage = "";
titlePage = currNavNode2.getTitle(userLocale);
escTitlePage = titlePage;
escTitlePage = escTitlePage.replaceAll("\'","\\\\\'");
escTitlePage = escTitlePage.replaceAll("\"","\\\\\"");
//escTitlePage = escTitlePage.replaceAll("\\&","\\&");
//escTitlePage = escTitlePage.replaceAll("\\&","\\%26");
%>
<a <%=level2Id%> oncclick="return EPCM.doNavigate('<%= currNavNode2.getName()%>',0,'','null',1,'<%= escTitlePage %>','')" href="#"><%= titlePage %></a>
The last problem I have is with '&'. Whatever escaping I try, I have a truncated string in the page title at position of the '&'...
Any idea ?
Thanks in advance.
Best regards,
Guillaume -
hey does anyone know a short html for the computer to
simulate the escape command on the computer?i have a slideshow using xml that i set up with a program
that autoruns and full screens the html. to get out the user must
press the escape button.
i have a buttonthats set up ready to be linked to something
to do this but the client needs for there to be an exit button.
please let me know of a way or another to accomplish
this. -
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. -
Change Html Title dynamic from Flash
Hi,
I want to change the Title of the Html page dynamically from
the embedded Flash.
The Title, that appears on Browser bars etc.
Could I do this?
On init I can load the Html source code in with LoadVars, and
onData (src) change the Title with subString method, but, how then
could I pass the new value back to the Html page, so the Browser
Title changes?
Thank you.
LuciewongThank you both GWD and Dave for the help.
I know your code works under normal circumstances, just in my
case, I can't get it to work.
Because, on a subsequent Frame, called after the
ExternalInterface.call,
I have a getURL(javascript) to change the doc. background
color.
Now, either the Title changes or the background color
changes, but both after each other, can't make it.
I have tried Ext,CallBack function, so when the Title changes
and callBack is true, move on, but still then it changes the BG,
but not the title anymore.
I must do something wrong with the callBack function?
Thank you for your help.
Regards,
Luciewong -
Adding elements to html form dynamically
hi All,
I would like to add input boxes to html form dynamically onclick event.
But this doesnot work at all.. can u spot the trouble?
<html>
<body>
<input type=file name="fileName" value="browse">
<input type=button value="Add more file" onclick="add();">
<input type=hidden name="theValue" value='0'>
<script type="text/javascript">
function add()
var num=parseInt(theValue.value)+1;
theValue.value=num;
var name="fileName"+num;
var element=document.createElement(input);
element.setAttribute('type','file');
element.setAttribute('name',name);
element.setAttribute('value','browse');
document.appendChild(element);
</script>
</body>
</html>
thanks in advanceHi,
Since no one is giving you the hint: I'm afraid you're in the wrong forum. This is not a Javascript forum. I know it sounds confusing but despite the name, Javascript and Java have nothing really in common. Javascript runs on the client side. Java web technologies don't. Although, what you are asking for can be done with JSP's, I'm afraid, I can't help you with Javascripting :(....
Cheers,
Joerg -
Hi,
We have an application built using HTMl 5 and Javascript running on IPad2, iOS5.1 Safari 5.1.
When a file url is clicked instead of asking for Save or Open or Cancel options, the file gets opened on IPad by default.
Is this default behaviour which cannot be changed or can it be configured to ask user preference?
When we try to download a file(.pvw file -> a model file) in the above application, safari throws "Download failed" error.
Please suggest what needs to be done.
Regards,
PramodSafari on an iPad in general does not allow downloading of files. That's a safety precaution in the iOS SDK to keep unauthorized content off of iOS devices. Safari will open from the web site file types that it can handle, but direct downloading isn't normal behavior, and I don't believe the behavior can be changed, though you can try asking in the developer forum, either here or the one to which you have access as a member of Apple's iOS developer program.
Regards. -
hello, i am a fresher in jsp. i want to add new rows in html table dynamically.In my coding, just only shows in one row . please help my problem with correct coding and i don't want to use database. Thanks ...............!
Here is my coding-------------------
---------------- form.jsp --------------------->
<%@ page import="java.util.*,newtest1.Validation" %>
<jsp:useBean id="mybean" scope="page" class="newtest1.Validation" />
<jsp:setProperty name="mybean" property="name" param="name" />
<jsp:setProperty name="mybean" property="age" param="age" />
<% s[i][j] %>
<html>
<head><title>Form</title></head>
<body>
<form method="get">
<table border="0" width="700">
<tr>
<td width="150" align="right">Name</td>
<td width="550" align="left"><input type="text" name="name" size="35"></td>
</tr>
<tr>
<td width="150" align="right">Age</td>
<td width="550" align="left"><input type="text" name="age" size="35"></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr><td> </td></tr>
<tr><td><input type="submit" name="submit" value="ADD"></td></tr>
<tr><td> </td></tr>
<tr><td width="100%" align="center" border=1>
<% int count=mybean.getStart();
for(int i=count; i<count+1; i++) { %>
<tr>
<td><jsp:getProperty name="mybean" property="name" /></td>
<td><jsp:getProperty name="mybean" property="age" /></td>
<td><%= count %></td>
<% count+=1; %>
</tr>
<% } %></td></tr>
</table>
</form>
</body>
</html>
----------------- Validation.java ----------------->
package newtest1;
import java.util.*;
public class Validation {
private String name;
private String age;
static int start=0;
public Validation() { name=null;
age=null;
++start;}
public void setName(String username) { if(username!="")
name=username;
public String getName() { return name; }
public void setAge(String userage) { if (age!="")
{age=userage;}
public String getAge() { return age; }
public int getStart() {
return start; }Hi, Do you mean to say,
You have an HTML page in which you have a text field and an add button. If you enter anything in that text field and click on Add button the text field contents should be displayed in the same HTML page and you should be able to go on entering new values into the text field and you should be able to retain and display all the previously entered values..
and finally the list of added items are not stored in the database..
If this is the case
i. Your html form should be submitted to the same page.
ii. You need to have a Vector which holds the entered values.
iii. Bind the vector object to the request object and collect the same vector object from the request and display its contents...
I think this would help... -
Hello, all. I am sadly failing to find a library function to escape HTML in Java. I'm writing a tag that used to use JSTL as a custom tag and don't know exactly where to find the functionality the JSTL is using. Consider the old JSP:
<c:forEach items="${versions}" var="version">
<tr>
<td><c:out value="${version.version}"/></td>
<td><c:out value="${version.releaseDate}"/></td>
</tr>
</c:forEach>and the new custom tag class:
public class VersionTableTag implements Tag
private PageContext context;
private Tag parent;
public int doEndTag() throws JspException
return EVAL_PAGE;
public int doStartTag() throws JspException
JspWriter out = context.getOut();
List versions;
try
versions = (List)(context.getVariableResolver().resolveVariable("versions"));
} catch (ELException e)
versions = new ArrayList();
try
out.println("<table>");
out.println("<tr>");
out.println("<th>Version</th>");
out.println("<th>Release Date</th>");
out.println("</tr>");
for (Object o : versions)
VersionVO version = (VersionVO)o;
out.println("<tr>");
out.println("<td>");
out.println(version.getVersion()); // NOTE: not properly escaped
out.println("</td><td>");
out.println(version.getReleaseDate().toString()); // NOTE: not properly escaped
out.println("</td>");
out.println("</tr>");
out.println("</table>");
} catch (IOException e)
throw new JspException(e);
return SKIP_BODY;
}My questions are as follows:
*1.* Is it possible to define a tag using a JSP document rather than a Java class? All I'm really after is something similar to an include but I want to be able to provide attributes to it in the long run.
*2.* Is there some library function I can use to escape the HTML in the VO above?1. Is it possible to define a tag using a JSP document rather than a Java class? All I'm really after is something similar to an include but I want to be able to provide attributes to it in the long run.Yes. It was introduced with JSP2.0: tag files.
Just like a JSP lets you write a servlet easily, a tag file lets your write a Custom tag class easily.
http://java.sun.com/javaee/5/docs/tutorial/doc/bnama.html
2. Is there some library function I can use to escape the HTML in the VO above?
There is one provided in the jakarta commons "lang" library.
http://commons.apache.org/lang/
They provide a class "StringEscapeUtils" which will do most of the common escaping that you require.
How hard is it to write something that replaces & < and > though? -
Hide an HTML button using javascript
Hi,
I need to hide an html buttton using javascript. I have an radio button with values "YES" and "NO". If is select NO then i need hide the button without refreshing the page. Can anyone suggest me how to hide an button using javascript.
Thanks
PrashanthPrashanth,
The exact solution will vary based on a few factors. The basic idea is to place an event handler on the radio button item that calls a function to hide/show the button. You might also want to call that function when the page loads too.
If you put an example page on apex.oracle.com and provide the workspace/username/password I'll take a look. You can create a new account for this purpose.
Regards,
Dan
Blog: http://DanielMcGhan.us/
Work: http://SkillBuilders.com/ -
Need .exp file for Dynamic Subprocess project
Dan ,
I'm looking in to you project Dynamic Subprocess in 4 shared.com (http://www.4shared.com/get/G4DmkQ8G/Dynamic_Subprocess_Lesson_10gR.html) , can you please let me know the link , where i can download the .exp file for Dynamic SubprocessYou'll need to spend some money to convert the WMP file to a format iMovie can use:
http://www.telestream.net/flip4mac/overview.htm
The $29 version will do what you need. -
Player for dynamic live streaming
Hello. I run a FMS 3.5 Server and I do not have much knowledge about it. I want to use the dynamic streaming function that FME provides, but I do not have a player that supports the dynamic switching. I looked into ActionScript and Flex but it is all to complicated for me. Can somebody sent me a link where I can download such a player or can somebody give me help so I can figure this out? Thanks!
Thank you for the link but it does not solve my problem. In this thread they work with manifest xml files like a playlist. Which i tryed but also doesn´t work. Adobe declairs FMP with easy config and less code for non geeks. And this is exactly what i want for my project.
Does anybody can post some html sample code especially for dynamic streaming/ MBR wit Flash Media Playback??? For Live or On-Demand.
Best
Hinricht -
Escape codes for substring and bold????
i am writing a servlet to process a form i made with HTML.
The servlet works with the form data and sends an e-mail.
I use escape characters for returns, tabs and stuff like that. Is there a code to BOLD or SUPERSCRIPT a peice of the output?
THANKS!The HTML code for bold is <b>bold</b>, if that's what you were asking. And there's <sub> too. If you weren't asking that, what were you asking?
-
Online materials for learning Javascript, JSP and EJB
I am a core java programmer, not aware of J2EE stuffs. Please let me know the best online resources for learning Javascript, JSP and EJB
Thanks,
Gautamhttp://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts3.html
http://otn.oracle.com/sample_code/tech/java/codesnippet/j2ee/ejbbestpractices/ejb-best.html#pattern
http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPIntro.html
http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
http://home.cogeco.ca/~ve3ll/jstutor5.htm
http://www.pageresource.com/jscript/j_a_02.htm
I think will do -
Escape HTML content without escaping tags
How can I escape HTML content without escaping the HTML tags?
Thanks for the info. The select statement worked for me when I ran it with the inputs below but when I tried to put the statement in my code it didn't work. Can you have a look and see what I may have done wrong?
Thanks
Karen
My code looks like this:
FUNCTION escape_varchar(p_text_in IN VARCHAR2, p_encode IN NUMBER)
RETURN VARCHAR2
IS
p_text_out VARCHAR2(32767);
BEGIN
p_text_out := DBMS_XMLGEN.CONVERT(utl_i18n.escape_reference(unistr(REPLACE(p_text_in,'\','\\')),'US7ASCII'),p_encode);
RETURN p_text_out;
END escape_varchar;
p_text_in =
<html>
<head>
</head>
<body>
Make sure the following characters are getting Displayed in EIS
~`!@#$%^&*()_-+={}|[]\:;"'<>?,./ ¢ £€¥©®™‰µ >• • … §¶ß‹›«»==–—¯ ?¤¦¨¡¿ˆ˜°-±÷/×¹²³¼½¾ ƒ??8v˜?=?¬n?´¸ªº
†‡ÀÁÂÃÄÅÆÇÈÉÊËÌÎÏÐÑÒÓÔÕÖØŒŠÙÚÝÜŸÞàáâãäåæçèéêëì í î ï ðñòóôõøœšùúûüýþÿ??G????T?????????S??F??Oaß?de?????
?µ???p??st?f??????????????
</body>
</html>
p_encode = 0
p_test_out =
&lt;html&gt;
&lt;head&gt;
&lt;/head&gt;
&lt;body&gt;
Make sure the following characters are getting Displayed in EIS
~`!@#$%^&amp;*()_-+={}|[]\:;&quot;&apos;&lt;&gt;?,./ &#xa2; #&#x20ac;Y&#xa9;&#xae;&#x2122;&#x2030;&#xb5; &gt;&#x2022; &#x2022; &#x2026; &#xa7;&#xb6;&#xdf;&#x2039;&#x203a;<>==&#x2013;&#x2014;&#xaf; ?&#xa4;|&#xa8;!&#xbf;&#x2c6;&#x2dc;&#xb0;-&#xb1;&#xf7;/&#xd7;&#xb9;&#xb2;&#xb3;&#xbc;&#xbd;&#xbe; &#x192;??8v&#x2dc;?=?&#xac;n?'&#xb8;&#xaa;&#xba;
&#x2020;&#x2021;AAA&#xc3;A&#xc5;&#xc6;CEEEEIII&#xd0;&#xd1;OOO&#xd5;O&#xd8;&#x152;SUUYU&#x178;&#xde;aaa&#xe3;a&#xe5;&#xe6;ceeeei i i i &#xf0;&#xf1;ooo&#xf5;&#xf8;&#x153;suuuuy&#xfe;y??G????T?????????S??F??Oa&#xdf;?de?????
?&#xb5;???p??st?f??????????????
&lt;/body&gt;
&lt;/html&gt;
Maybe you are looking for
-
I've bought my new Macbook when i traveled to US, though i live in Brazil. I just want my keyboard to have a brazilian layout, with the special characters, and stuff. I've already tried to go to International > Input Menu, and change its configuratio
-
Direct Postings from FI to COPA
Hi! I have done configuration for PA transfer strucutre for Direct Acct Assign. fr. FI/MM. but while I am creating the FI document , unless until I click on profitability segment field, system is not posting COPA document. Is it mandatory to click o
-
Exception 50125 when report server startup
I start a in-process server with rwserver.sh comand on linux platform. But when I run a web report on browser, the browser shows: REP-56048: Engine null crashed, job Id: 1 I checked the report server trace file, find when I startup the report server,
-
Diffference between ALL_TAB_COLS and ALL_COLUMNS
What are difference use between ALL_TAB_COLS and ALL_COLUMNS?
-
Possible to record video in flex?
Hi, Does anyone know if it's possible to record a webcam stream to flv or any other format? At this point, I have a method which takes "screenshots" of the webcam every 200 milliseconds or something but this gives a very slacky performance.