Regexp and ampersand
Hi all,
I am using regexp to substring a clob of data. The data contains an ampersand (&) so i will need to add this to my regexp. The trouble is it doesnt take it as a literal character (even when using the escape [\] char before it), instead it thinks i am trying to define a variable input field.
Any ideas?
Thanks for your time,
James
Hi!
Read and try this:
SQL*Plus
When issuing SQL from within SQL*Plus several considerations need to be made.
An ampersand (&) will be treated as a define variable so should it appear in the
pattern as a text literal, you will be prompted to enter it's value. This behaviour can
be removed by setting the SQL*Plus variable DEFINE to be OFF.
If the SQL*Plus variable ESCAPE is set to ON then any instance of the escape
variable will be stripped. This is unfortunate for regular expressions as the default
escape character is backslash (\) which is a common metacharacter. To be safe it is
best to ensure that ESCAPE is set to OFF before issuing a regular expression
query.
link: http://www.oracle.com/technology/products/database/application_development/pdf/TWP_Regular_Expressions.pdf
Hope this helps!
Similar Messages
-
Hi
One of my BLOB column contains a text which I need to check in my SQL Query.
Can we achive this by using REGEXP?
Is there is any other way to determine the value of fields/data inside BLOB in SQL Query (Not in Procedure or Function)?
KapilkYou mean CLOB ? BLOB is binary type you can't get reasonable text out of it.
Yes, Regular Expressions works with CLOB
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14251/adfns_regexp.htm#sthref534
Oracle Database Implementation of Regular Expressions
Oracle Database implements regular expression support with a set of Oracle Database SQL functions and conditions that enable you to search and manipulate string data. You can use these functions in any environment that supports Oracle Database SQL. You can use these functions on a text literal, bind variable, or any column that holds character data such as CHAR, NCHAR, CLOB, NCLOB, NVARCHAR2, and VARCHAR2 (but not LONG). -
Hi,
I need to place ampersands in tree node text property. To get the text
rendered right I need to provide the text as, for example, Bed '&+amp+;'
Breakfast.
This tree node is rendering well in the browser as "Bed & Breakfast".
But if an action is associated with the tree node and I run the app
the tree node is rendering to "Bed '&+amp+;' Breakfast".
"&+amp+;" means the well formed XHTML for ampersand, if I had written this as it should be it would render in this post as &.
Is there any workaround?
Thanks.
StephanThe Tree Node is now rendering right, but I run into another problem. After selection I need to display the Tree Node text in a static text component. which worked with this code:
public String node_action() {
String fullId = tree1.getCookieSelectedTreeNode();
String id = fullId.substring(fullId.lastIndexOf(":")+1);
TreeNode selectedNode = (TreeNode) this.getForm1().findComponentById(id);
String category = selectedNode.getParentTreeNode((TreeNode) selectedNode).getText();
if ( category.indexOf("&") != -1 ) {
getSessionBean1().getClassified().setCategory(category.replace("&", "&"));
else {
getSessionBean1().getClassified().setCategory(category);
String subCategory = selectedNode.getText();
if ( subCategory.indexOf("&") != -1 ) {
getSessionBean1().getClassified().setSubCategory(subCategory.replace("&", "&"));
else {
getSessionBean1().getClassified().setSubCategory(subCategory);
categoryTextfield.setText(getSessionBean1().getClassified().getSubCategory());
categoryTextfield.setVisible(true);
return null;
}(some & in the code section are original meant to be the XHTML for ampersand.)
but for the few Tree Nodes which are prerendered now, the call
String subCategory = selectedNode.getText(); returns null.
How can I get the text of for those prerendered Tree Node?
Thanks.
Stephan -
Regular Expressions and variables OR RegExp and var
Sorry about that, my browser hiccuped and sent three
times....Newlines are only a problem if you're reading the
text line-by-line and applying the regexp to each
line. It wouldn't catch expressions that span
lines.
@sabre150: your note re: CharSequence -- so what
you're suggesting is to implement a CharSequence that
wraps the file contents, and then use the regexps on
the whole thing? I like the idea but it seems like
it would only be easy to implement if the file uses a
fixed-width character set. Or am I missing
something...?You are correct for the most basic implementation. It is very easy to create a char sequence for fixed width character sets using RandomAccessFile. Once you go to character sets such as UTF-8 then more effort is required.
While ever the regex is moving forward thought the CharSequence one char at a time there is no problem because one can wrap a Reader but once it backtracks then one needs random access and one will need to have a buffer. I have used a ring buffer for this which seems to work OK but of course this will not allow the regex to move to any point in the CharSequence.
'uncle_alice' is the regex king round here so listen to him.
:-( I should read further ahead next time!
Message was edited by:
sabre150
Message was edited by:
sabre150 -
response.sendRedirect("showAddAMember?cntry=" + country + "&stte=" + state + "&city=" + city + "&course=" + course + "&coursename=" + coursename + "&messagename=" + messagename + "&TFM=" + worker + "&admin_type=" + admin_type);I am using a response.sendredirect() to pass parameters from one servlet to another. Above is one such case I am using in my program. The problem I am having is that I have an ampersand (&) as part of a variable string I am passing. When the next servlet is called and the variables are passed, the '&' is reached in the content of the string and is recognized as the start of the next variable to be passed. Hence, any remaining part of the string is chopped off or severed right before the ampersand.
For example,
"... &messagename=The Raven G&CC&TFM=green&admin_type=4");only 'The Raven G' gets passed instead of the entire string that I want passed, which is 'The Raven G&CC'.
What can I do to pass a string with an ampersand within it without it getting severed? As you can see the variable string content is variable, so it must not work just for a one time pass but be adaptable depending on the content of the current variable string.
There must be a java object that takes care of this problem or you could never pass a variable string with an ampersand in its content.
If anyone knows of the generally accepted method for solving this problem that would be of great help to myself. My program depends on it and can not operate without it.
Thank-You for your help.
Derek Z.I tried your suggestion but it did not work I still had the same problem.
Here is the code I tried;
response.sendRedirect(response.encodeRedirectURL("showAddAMember?cntry=" + country + "&stte=" + state + "&city=" + city + "&course=" + course + "&coursename=" + coursename + "&messagename=" + messagename + "&TFM=" + worker + "&admin_type=" + admin_type));Anything after the ampersand got severed just like before.
Do you have a coded example that works that I could view. -
Tricky Regexp and string to column-row SQL
Hi All,
I am TRYING to build an SQL that will convert a string passed as
HP|250 GB * 2 + 80 GB * 3 + 100 GB | SATAto
HP | 250 GB | SATA
HP | 250 GB | SATA
HP | 80 GB | SATA
HP | 80 GB | SATA
HP | 80 GB | SATA
HP | 100 GB | SATAMy attempt so far is (which tells me to learn more about regexp)
WITH T AS
( SELECT q'[HP|250 GB * 2 + 80 GB * 3 + 100 GB | SATA]' str FROM DUAL
t2 AS
(SELECT trim(regexp_substr(str,'[^|]+',1,level)) val
FROM T
CONNECT BY level <= LENGTH (str)-LENGTH(REPLACE(str,'|'))+1
),t3 AS
(SELECT DISTINCT trim(regexp_substr(val,'[^+]+',1,level)) val
FROM t2 WHERE VAL LIKE '%*%' OR VAL LIKE '%+%'
CONNECT BY level <= LENGTH (val)-LENGTH(REPLACE(val,'+'))+1
),t4 as
(SELECT VAL,ROWNUM RN FROM T2 A1
WHERE VAL NOT LIKE '%*%' OR VAL NOT LIKE '%+%'),
t5 as
(SELECT A.VAL MK, T3.VAL CONFG, B.VAL TYP
FROM T3, (SELECT VAL FROM T4 WHERE RN = 1)A,(SELECT VAL FROM T4 WHERE RN = 2) B)
SELECT *
FROM T5;And output I got so far is:
MK CONFG TYP
HP 80 GB * 3 SATA
HP 250 GB * 2 SATA
HP 100 GB SATA Please suggest what more shall I do to get the desired output(An SQL)?
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production Thanks for reading this post
*009*with t1 as (
select 'HP|250 GB * 2 + 80 GB * 3 + 100 GB | SATA' str from dual union all
select 'INTEL|40 GB + 55 GB| IDE' from dual
t2 as (
select regexp_substr(str,'^[^|]+') mk,
trim(regexp_substr(replace(str,'|','+'),'[^+]+',1,column_value + 1)) element,
regexp_substr(str,'[^|]+$') typ
from t1,
table(
cast(
multiset(
select level
from dual
connect by level <= length(regexp_replace(str || '+','[^+]'))
as sys.OdciNumberList
select mk,
trim(regexp_replace(element,'\*.*$')) val,
typ
from t2,
table(
cast(
multiset(
select level
from dual
connect by level <= substr(regexp_substr(element,'\*.*$'),2)
as sys.OdciNumberList
MK VAL TYP
HP 250 GB SATA
HP 250 GB SATA
HP 80 GB SATA
HP 80 GB SATA
HP 80 GB SATA
HP 100 GB SATA
INTEL 40 GB IDE
INTEL 55 GB IDE
8 rows selected.
SQL> SY.
P.S. Post your version. If 11.1 it can be simplified. If 11.2 can be simplified even more. -
ahoj!
i want to create an index on a column that i query via an regular expression, for example ...where regexp_like(phone.extension_col, whitelist.extension_col)...
phone.extension_col is the column with the phonenumber-extensions i want to query and whitelist.extension_col is a list of extension that are allowed. whitelist contains extensions like 2450 AND extensions as regular expressions like ^8...$!
i tried to create an index on phone.extension, but it doesn't work:
create index idx_extension on phone (regexp_like(extension_col, '^8...$'));
-> ORA-00904 column name not valid
someone can help me? thx!
bye,
christianhi,
i think u have given a wrong column name,
create index idx_extension on phone (regexp like('phone.extension_col', 'whitelist.extension_col'));
I dont know above would work or not, but u havae to look for correct column name by looking at the error
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm
regards
Jafar -
ReplaceAll regexp and JavaScript
I want to write a function that will escape special characters in a String so that they render correctly in JavaScript.
For example, if a string contains a tab, I want the tab to be replaced by \t and so on for all the escape characters : \', \", \\, \b, \f, \n, \t and \r.
Here is my function so far :
public static String JSStringFormat(String value) {
String result = "";
if (value != null) {
result = value;
result = result.replaceAll("\'", "\\\\'");
result = result.replaceAll("\b", "\\\\b");
result = result.replaceAll("\f", "\\\\f");
result = result.replaceAll("\n", "\\\\n");
result = result.replaceAll("\t", "\\\\t");
result = result.replaceAll("\r", "\\\\r");
return result;
}So far, this works... But I can't find the solution for \\ and \"... I've tried many things but nothing works...
Anyone can help ?replaceAll("\"", "\\\""); // I thinkIt throws compilation error on this line itself. If
you are using an IDE, it wont allow you to go further
with that line.
replaceAll("\\\\", "\\\\\\\\"); // I think.
I had a slight error in the quote one the replacement string needed two more quotes. This works: String str = "\\a \"xyz\" \\ b";
System.out.println(str);
//System.out.println(str.replaceAll("\\" , "\\\\\\"));
System.out.println(str.replaceAll("\"", "\\\\\""));
System.out.println(str.replaceAll("\\\\", "\\\\\\\\"));Your line (commented above) gives Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
^
regEx is particular about special characters like $
and \.Yes, I know.
So when you are using replaceAll, you have to
be careful with regex, and replace them. For example,
if you have a $ to be replaced, you have to replace
it the following way.
str.replaceAll("\\$", "\\\\\\$");Yes.
>
so, instead of directly using the $, you have to use
"\\" that tells the regEx, yes this is a special
character and treat it normally, like any other
character.Yes.
Along those same lines, like I said, you need \\ to get a single \ in a Java String. Then, if you want a literal \ in the regex, you need to provide the regex compiler with \\, which means your Java String literal must be \\\\. -
Hi,
I 've trouble with capturing group as mention in the example below
String s = "KLASSE3";
Pattern p = Pattern.compile("KLASSE(\\d)");
Matcher m= p.matcher(s);
System.out.println( m.groupCount());
System.out.println( m.group(1));
Running this gives :
1
Exception in thread "main" java.lang.IllegalStateException: No match found
at java.util.regex.Matcher.group(Matcher.java:421)
Tried with 1.5.0_08 and 1.6.0-b105
Thanks for any hintshame on me !!!
thanks very much dude -
Hi,
today i've got to know how i'll find out whether or not a line ends with an \n.
I am parsing a csv file with 10 semicolon seperated values.
So, here's my (working) regEx so far:
Pattern p = Pattern.compile("((.*)(;{1})){10}");BUT..... i'd like to add the '\n' parsing at the end of my expression and do not know how. Maybe the whole expression mentioned before is rubbish, so pls help...
thxI made a test program, but I really don't know if it is what the OP is expecting. Please, check it out:
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class CSVTest {
public static void main(String[] args) {
String
csv =
"337;111;55dfg3;247;61;528;470;117;312;379\n"+
"294;131;566;511;339;424;140;498;444;5dfg96\n"+
"276;54;589;510;44;160;68;268;105;112\n"+
"42;393;195;442;591;11;261;407;340;1 dfg 44\n"+
"448;492;297;185;204;66;390;518;584;36\n"+
"406;452;464;24;535;542;156;256;349;226\r\n"+
"294;18;499;451;212;260;266;84;331;229\n"+
"22;128;309;88;3;257;413;94;532;95\r\n"+
"197;81;350;164;419;528;349;457;277;172\n"+
"420;267;555;108;182;274;335;40;187;67",
regex = "([\\n\\r])*((?:[^;]*;){9}[^\\r\\n]*)"
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(csv);
int i = 1;
while(m.find()) {
System.out.println(
"Match #" + i++ + "[" + m.group(2) + "]"
}I hope it helps you -
Hi I'm currently working on an IDL compiler and was wondering if somebody can help me with a regular expression I use to read out methods from an IDL file.
this.methodPattern = Pattern.compile("\\s*" +
"(\\w+)" +
"\\s+(\\w+)\\s*" +
"[\\(]\\s*" +
"(?:(?:\\s*?(\\w+)\\s*(\\w+)\\s*?[,]?)?)*" +
"[\\)]" +
"\\s*(?:\\s*raises\\s*(\\w+))?;");
Now this is supposed to match something like
String abc(int a, int b, int c) raises RemoteException
which it does :)
The problem lies with the '+' quantifier which overwrites my parameters, now it only stores the last parameter in this case it would store:
group(i) -> int
group(i+1) -> c
The problem only lies in the highlighted part of the code, the rest is matched and stored properly.
it overwrites the previous parameters, is there a way to store all parameters instead of only the last one? I thought the + quantifier wouldn't cause issues like that.
I'm using JRE 1.6
If someone has an idea as to what I can do in this situation I would be most grateful for suggestions.
- I know I could just match the whole contents and the split the String into an Array, however I would prefer to keep it to one Pattern.You probably want a compiler generator like
ANTLR or
JavaCC.Note that JavaCC has an IDL grammar; you can get it here:
https://javacc.dev.java.net/servlets/ProjectDocumentList?folderID=110&expandFolder=110&folderID=0
To use it, download it and do something like this:
$ cat Hello.idl
module HelloApp
interface HelloCallback
void callback(in string message);
interface Hello
string sayHello(in HelloCallback objRef, in string message);
$ javacc IDL.jj && javac *.java && java IDLParser Hello.idl
Java Compiler Compiler Version 4.0 (Parser Generator)
(type "javacc" with no arguments for help)
Reading from file IDL.jj . . .
File "TokenMgrError.java" does not exist. Will create one.
File "ParseException.java" does not exist. Will create one.
File "Token.java" does not exist. Will create one.
File "SimpleCharStream.java" does not exist. Will create one.
Parser generated successfully.
Note: IDLParser.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
IDL Parser Version 0.1: Reading from file Hello.idl . . .
IDL Parser Version 0.1: IDL definitions parsed successfully.You can either add syntactic actions to collect the method names or convert this to a JJTree grammar and use a Visitor; the latter is the cleaner technique but the former may be a bit simpler. -
JS for search and creation of automated hyperlinks from the results
Hi,
Is it possible to create a javascript that searches a PDF document for a part of phrase (with regexp) and then creates a hyperlink of the whole row where the phrase is?
I'll explain a little bit more....
In a PDF catalog I have part numbers of 10 digits that always starts with "5010" and then there's a short describing text of the product and finally a price at the end. The part no and the short description is separated with two spaces and a "pipe" (|) and so is also the price separated from the describing text.
Example: 5010101538 | This is the describing text for the product | $4996
Now, I want create a hyperlink to my website so each product row is clickable in Acrobat. The link is static at first and at the end the product no (10 digits) comes. After the product no there is also the extension .aspx (http://www.myweb.com/pd_5010.......aspx.
I know that this should be done at the creative stage but the DB connection plugin for the parts does not support url linking in InDesign..... so I'm stuck with Acrobat for my 900 links that needs to be created. ;)
Since I'm new to JS in Acrobat I hope there is help out there!
Kindly
MagnusHi Magnus,
It's a bit tricky, but it can be done. Contact me by email for more info. -
EXTERNAL HARD DRIVES AND FORMATTING
I am using 10.6.4 / Intel Macbook Pro
I have to format a drive so it can be used on both PC and Mac. In the default, store bought hard drives come formatted NTFS (I believe) - I can mount the drive but not copy to it as I only have read permission.
I am well familiar with the MSDOS fat 32 format and it is worthless.
I have to use large 1tb external drives batch copying tens of thousands of multiple files. I am constantly getting errors because of characters or the names are too long even though NTFS supports it. So even though I can mount an NTFS disk and copy the files onto a FAT32 drive, that drive still rejects a lot of the files.
So my questions are:
Do you know of a format (other than fat32) that supports both Mac and PC and can handle longer naming conventions and "&-" ampersand characters?
Or - How can I adjust permissions to write to an NTFS disk without erasing all the info on the disk?
Or - is there an app so I can read/write/mount to PC disks without futzing with permissions?
If I format standard Mac HFS will PCs be able to read write? Does journal formatting affect PCs read or write? Anyone? ThanksWindows cannot read Mac formatted drives without third-party software like MediaFour's MacDrive. Macs can read NTFS and MSDOS but cannot write NTFS. You can modify OS X to both read and write to an NTFS formatted drive. You need two pieces of freeware:
MacFUSE-2.0.3
ntfs-3g-2010.10.2-macosx
Look for them at CNet Downloads or MacUpdate. You will also find one or two alternatives by searching for "ntfs." -
JSP Servlet and convert the result set of an SQL Query To XML file
Hi all
I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
thisis my servlet which will call the jsp page and the jsp just behind it.
//this is the servlet
import java.io.*;
import java.lang.reflect.Array;
import java.sql.*;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.naming.*;
import javax.sql.*;
public *class *Campaign *extends *HttpServlet
*private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
*private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
*private* DataSource _dataSource;
*public* *void* setDataSource(DataSource dataSource)
_dataSource = dataSource;
*public* DataSource getDataSource()
*return* _dataSource;
*public* *void* init()
*throws* ServletException
*if* (_dataSource == *null*) {
*try* {
Context env = (Context) *new* InitialContext().lookup("java:comp/env");
_dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
*if* (_dataSource == *null*)
*throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
} *catch* (NamingException e) {
*throw* *new* ServletException(e);
protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
Connection conn = *null*;
*try* {
conn = getDataSource().getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
// out.println("Le résultat :<br>");
ArrayList <String> Lescomments= *new* ArrayList<String>();
ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
ArrayList <String> Lesnoms = *new* ArrayList <String>();
*while* (rs.next()) {
Lescomments.add(rs.getString("comments"));
request.setAttribute("comments",Lescomments);
Lesidentifiant.add(rs.getString("post_id"));
request.setAttribute("id",Lesidentifiant);
Lesnoms.add(rs.getString("postname"));
request.setAttribute("nom",Lesnoms);
rs.close();
stmt.close();
*catch* (SQLException e) {
*finally* {
*try* {
*if* (conn != *null*)
conn.close();
*catch* (SQLException e) {
// les paramètres sont corrects - on envoie la page réponse
getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
}///end of servlet
}///this is the jsp page called
<%@ page import="java.util.ArrayList" %>
<%
// on récupère les données
ArrayList nom=(ArrayList)request.getAttribute("nom");
ArrayList id=(ArrayList)request.getAttribute("id");
ArrayList comments=(ArrayList) request.getAttribute("comments");
%>
<html>
<head>
<title></title>
</head>
<body>
Liste des campagnes here i will create the xml file the problem is to display all rows
<hr>
<table>
<tr>
</tr>
<tr>
<td>Comment</td>
<td>
<%
for( int i=0;i<comments.size();i++){
out.print("<li>" + (String) comments.get(i) + "</li>\n");
}//for
%>
</tr>
<tr>
<td>nom</td>
<td>
<%
for( int i=0;i<nom.size();i++){
out.print("<li>" + (String) nom.get(i) + "</li>\n");
}//for
%>
</tr>
<tr>
<td>id</td>
<td>
<%
for( int i=0;i<id.size();i++){
out.print("<li>" + (String) id.get(i) + "</li>\n");
}//for
%>
</tr>
</table>
</body>
</html>
This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
<%@ page import="java.sql.*" %>
<%@ page import="java.io.*" %>
<%
// Identify a carriage return character for each output line
int iLf = 10;
char cLf = (*char*)iLf;
// Create a new empty binary file, which will content XML output
File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
//outputFile.createNewFile();
FileWriter outfile = *new* FileWriter(outputFile);
// the header for XML file
outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
try {
// Define connection string and make a connection to database
Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
Statement stat = conn.createStatement();
// Create a recordset
ResultSet rset = stat.executeQuery("Select * From posts");
// Expecting at least one record
*if*( !rset.next() ) {
*throw* *new* IllegalArgumentException("No data found for the posts table");
outfile.write("<Table>"+cLf);
// Parse our recordset
// Parse our recordset
*while*(rset.next()) {
outfile.write("<posts>"+cLf);
outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
outfile.write("</posts>"+cLf);
outfile.write("</Table>"+cLf);
// Everything must be closed
rset.close();
stat.close();
conn.close();
outfile.close();
catch( Exception er ) {
%>Please state your problem that you are having more clearly so we can help.
I looked at your code I here are a few things you might consider:
It looks like you are putting freely typed-in comments from end-users into an xml document.
The problem with this is that the user may enter characters in his text that have special meaning
to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
and re-displayed correctly.
Also, it looks like you are putting business logic in your JSP page (creating an xml file).
The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client. -
Select list and hidden display issue
Hi all,
I am using a dynamic value select list, which when a button is pressed sets the value of a hidden display item. The next page then uses the hidden display item as part of an SQL query.
It strangely sometimes works and sometimes doesn't - it often struggles with the values in the select list which are over 30 characters.
Does anybody have any idea what's going on?
Many thanks,
TomHi
I just re-ran the debug feature and have found an issue which could be the cause of the problem:
Som of the data items in the dynamic select list have and ampersand (&) symbol. If I run the page once the hidden item displays the value properly:
0.22: binding: ":HIDDENREGION"="HIDDENREGION" value="Tech Comms Media Utilities & Hi-tech" if I re-run the page after navigating around the application for a bit is displays this value:
0.22: binding: ":HIDDENREGION"="HIDDENREGION" value="Tech Comms Media Utilities & Hi-tech"Please notice the "& amp;" bit which has been added... Is there any way of getting rid of this? as it is interfering with the query on the next page.
Many thanks,
Tom
Edited by: new_to_apex on Mar 2, 2009 3:13 AM
Edited by: new_to_apex on Mar 2, 2009 3:14 AM
Maybe you are looking for
-
I want to transfer pictures and music from my iphone 4S to a 5c. My pictures are not stored on icloud. Also, I would like to keep my apps and settings. Is all of this possible?
-
Files stick to cursor when dragging and won't let go!
Hi all. Not sure if this is a question for the hardware forum or the OS forums. I seem to have a problem that happens frequently. If I click and drag a file when I unclick (drop the file) the mouse/cursor won't let go of the file. The file kind o
-
How to show time in Mail?
In Mail, timestamps only display for the current day. Is there a way to make these show for anything before today also?
-
Implementing BADI ALM_ME_001_ORDER
Hi All, <i>MAM30 SR1</i> <i>MI25 SP15</i> I followed the guide for implementing BADI ALM_ME_001_ORDER to get more fields for the ORDER_OPERATION details. In the MI server, merep_mon says my fields and values are there and enhancement flags, and so as
-
Retrieving voice mail, error message on first attempt, success on second?
When I first call voice mail and enter my password, I receive an error message, but I am successful on the second attempt. What is the problem, I changed the PW but still have the same problem?