TEXTAREA with servlets
Hi,
I am writing a servlet where I need to retain the text the user entered in an HTML TEXTAREA after a page refresh.
Upon page refresh, I send the value of the TEXTAREA to the servlet via the URL. I then populate the TEXTAREA's default value with req.getParameter(<my textarea value>).
My problem is this: carriage returns are lost. How can I retain them when I pass the value using only Javascript?
Below is a bit of my code. ldifHeaders contains the value of the TEXTAREA captured via Javascript <field>.value.
out.println("function refreshPage(mailPlatform)");
out.println("{");
out.println(" window.location.replace('"+sServletPath+"/MailSystemDetails?LDIFHeaders='+ldifHeaders);");
out.println("}");
Hi,
Try using the escape sequence to translate the URL
As far as I remember, the carriage return will be
translated into "%0D"
/SlashWould you know how to break up the value returned from the javascript <textarea>.value?
If I can break this value up into tokens, I can manually build the URL like you mentioned. Thanks.
Similar Messages
-
Textarea with HTML editor is not working
Hi all,
This is producing me a real headache.
I created the simplest application in the world with one Textarea with HTML editor, and the editor control does not show the usual tool bar for fonts, color, alignment, etc. Just a ordinary textarea.
Moreover, this was working before... I moved to another location in my work (me, not the server). Yes, I thought about the Internet Explorer, but Firefox has the same issue.
So any idea I can try to make this work?
I have another applications already in production with the same issue.
Need help!!!!!!!!!
Thanks in advance.
Lukas.
Application Express 2.1.0.00.39
Oracle Database 10g Express Edition Release 10.2.0.1.0
Internet Explorer 7.0.5730.11
Firefox 1.5.0.11
Windows XP Service Pack 2
1 G Ram
Pentium D CPU 2.80GHzLukas,
I would go and integrate FCKEDITOR (http://www.fckeditor.net/ ) into your application.
Here are instructions on how to achieve this (sorry but only in German):
http://www.oracle.com/global/de/community/tipps/einbinden_fckeditor/index.html
It basically means:
1) copying the files from fckeditor under the /images directory
(you can use the instructions here: http://daust.blogspot.com/2006/03/where-are-images-of-application.html)
2) creating two shortcuts INCLUDE_EDITOR_SCRIPTS and EDITOR
3) placing the shortcut INCLUDE_EDITOR_SCRIPTS into the page html header and
4) placing the shortcut EDITOR into the post element text of your plain textarea element
That's it.
BTW, FCKEDITOR has been included in Apex 3.0 as a standard item type.
Regards,
~Dietmar. -
Read Only TextAreas with Carriage Return, Line Breaks and Word Wrapping
Hi all,
I know there are a few posts around this subject but I cannot find the answer to the exact problem I have.
I have a page that has a 'TextArea with Character Counter' (4000 Chars) that is conditionally read only based on the users credentials (using the 'Read Only' attributes of the TextArea item).
When the field is editable (not Read Only) everything works fine but when I make the field Read Only I start to have problems:
The first problem is that the Carriage Return and Line Breaks are ignored and the text becomes one continuos block. I have managed to fix this by adding pre and post element text of pre and /pre tags. This has made the Carriage Return and Line Breaks word nicely and dispaly correctly.
However, it has introduced a second problem. Long lines, with no Carriage Returns or Line Breaks, now extend to the far right of the page with no word wrapping, making my page potentially 4000+ characters wide.
How can I get the field to be display only, with recognised Carriage Returns and Line Breaks, and Word Wrapping inside a fixed width of, say, 150 characters?
Many thanks,
MartinHi,
Just a cut and paste of yours with the field name changed:
htp.p('<script>');
htp.p('$x("P3_COMMENTS").readonly=true;');
htp.p('</script>');I also have the following in the page HTML Header, could they be conflicting?
<script type="text/javascript" language="JavaScript">
function setReleaseToProd(wpTypeCode){
//setReleaseToProd($v(this))
var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=set_release_to_prod',0);
get.addParam('x01',wpTypeCode);
gReturn = get.get();
if(gReturn) {
$s('P3_RELEASE_TO_PROD',gReturn);
get = null;
</script>I am a long way from knowing much about Javascript (this page code was written by someone else) so all help is much appreciated.
Martin -
Communicate with servlet after using Java Web Start?
Is it possible to communicate with servlet to get data back and forth
after using Web Start to download the client application?
The demos come with Java Web Start are applications which are
standalone, don't need communicate with the servlet on Web server
after being launched. I am wondering if it is possible, and how (HTTP
& JAX-RPC)?
Thanx in advance.I've done this using HTTP. I get the server and port from the codebase:
BasicService bs = null;
try {
bs = (BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
String codeBase = bs.getCodeBase().toString();
and use the java.net.HttpURLConnection and java.net.URL classes to send HTTP parameter values to the servlet and to receive results from the HttpURLConnection's input stream. -
Displaying *.pdf file on browser with servlet
hi all
this RAMESH,struggling to display a pdf file on browser from a remote mechine
earlier i tried with servlet
response.setContentenType("application/pdf")
out.println();
by this i am getting only some data as below
endobj
4 0 obj
<<
/ProcSet [ /PDF /Text /ImageB ]
/Font << /Fo0 21 0 R /Fo12 24 0 R /Fo13 27 0 R /Fo16 30 0 R /Fo18 33 0 R /Fo19 36 0 R >>
>>
endobj
For this purpose i have gone thru www.lowagie.com
and gone thru all examples but i am not getting how to display on browser or at least awt frame
please requesting all for suggest me some way
tanks all
-Rameshare you trying to
a) create a PDF dynamically
b) send an existing PDF -
Hi
i was trying to do some example with JNI. I can use JNI with standalone Java application but I just cannot figure out how I can use JNI with Servlet.
Can some one show me a sample code using JNI with Servlets.
thanks very muchhi,
I am also facing the same problem,
when I am using JNI with stand alone application it works fine but when i tried to use it with a servlet It gives unsatisfied linker error
stack: java.lang.UnsatisfiedLinkError: createSocket
at RelayConnector.createSocket(Native Method)
at RelayServlet.doGet(RelayServlet.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.iplanet.server.http.servlet.NSServletRunner.invokeServletService(NSServletRunner.java:891)
at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunner.java:458)
It seems i have to do some path settings in my iplenet web server.
If some one have faced the problem i would be glad to know the solution for this, i am literally bugged up,.... -
Hi,
I am Tejas , a newbie with servlets. Now, I have a servlet which contains a Javascript method. On clicking a link , the Javascript method is called.
But however, I find that there is some trouble. I created a class called MainFrames.java, the object of which I am instantiating in the Javascript method.
But this code doesnt work properly. I have given the snippet below
out.println("<script type='text/javascript'>");
out.println("function threader()");
out.println("{");
out.println("alert('Inside Threader');");
out.println("<%@ page import=\"XcForm.MainFrames\"%>"); //I have a hunch that this statement is the problem
out.println("<%");
out.println("MainFrames mainframes = new MainFrames();"); //without the import statement above, the MainFrames.java class is not being recognised
out.println("%>");
out.println("}");
out.println("</script>");
Thanks in advance,
TejasDo not put presentation code in servlets. Put them in JSPs. And mixing serverside code (scriptlets) and clientside code (javascript) this way is indeed not going to work. That code will certainly not be executed in the order as you write. Serverside code is executed at the server and is finished when the response is completed. So any serverside code inside clientside code is alreay executed. Clientside code is executed at the client and will only execute when the response is completed (onload, etc) or when the client invokes it (onclick, onsubmit, etc). Further on, do not put business code in presentation code. Put them in servlets.
-
JSF 1.2 with SERVLET 2.3
Hi, i've download the latest JSF 1.2 RI but i can't see any page as i get the following error:
ava.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getContentType()Ljava/lang/String;
at com.sun.faces.context.ExternalContextImpl.getResponseContentType(ExternalContextImpl.java:277)
at com.sun.faces.renderkit.RenderKitImpl.createResponseWriter(RenderKitImpl.java:167)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:131)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
The getContentType method that the exception describes is only available in servlet 2.4 but i'm using a servlet 2.3 only container. Can i use JSF 1.2 with servlet 2.3 ?
ThanksI'm 90% sure that you cannot. JSF 1.2 is intended to be part of Java EE 5.0. Since Servlets 2.3 are part of J2EE 1.3, I don't think that it will work.
Adam -
Some problems with servlet.jar and tomcat 4.1.27
Hello everybody,
I used to work with tomcat 3.3.1 and i've decided to use tomcat 4.1.27 now. The manual explains that we have to change de version of servlet.jar, it's done with servlet-2.3.jar but on tomcat starting i have this message:
jar not loaded. See servlet spec [...]. Offending class: javax/servlet/Servlet.class
what can i do, i've red all de documentation and i think all versions a OK??
thanks per advance
antoineI am running Tomcat 4.1.18, so your configuration may be slightly different. I found the Servlet.class file you are missing residing in the Tomcat/common/lib directory in the Servlet.jar file. Check your path and also make sure your Servlet.jar file contains the missing class.
-
Use of javascript and textarea with HTML editor
Hi all,
I have been trying to use some onchange javascript in the HTML Form Element Attributes of an item which is a textarea with an HTML Editor. It just seems to ignore the code. When you "view source" the code does not seem to be there.
What I am attempting to do is described in thread: detecting changes to items prior to submitting page
i.e. to warn a user that if they leave the page without saving they will lose their changes. It works fine with most of the other items on the page i.e. text boxes, select lists but not the textarea with html editor.
Is there somewhere else I should be putting my js for items of this type? I have spent some time looking through the forum posts but cannot find an answer so far.
Thanks,
BrianI'm having the same problem.
Would like to use the onChange event in a textarea with html editor.
This works in Firefox (where I don't get the html editor but only a textarea) but doesn't seem to work in IE.
Is there another way of detecting the user has changed the text in the html editor?
Thanks,
Pieter -
APEX - Textarea with HTML Editor.
All,
I am working with Application Express Version 2.2.1.00.04
I have the following problem:
I have an item "Textarea with HTML Editor" which I am inserting
information CLOB in a table.
This data is consulted by a Region Report of APEX which has a Link that
will be a popup. Inside the report, I use wwv_flow_utilities.URLENCODE
(here the column is a CLOB) where it gives me the error "ORA-06502:
PL/SQL: numeric or value error: character string buffer too small".
I started to investigate which might be the problem and saw that the
item "Textarea with HTML Editor" usually inserts special characters.
I show an example of the special character that inserts and which is the
error.
SELECT wwv_flow_utilities.URLENCODE(' ')
FROM dual;
This character, which is like a space in target, is bringing problems to
be able to execute the report.
A provisional solution to solve this problem is to put a REPLACE into
the Query.
Has anyone this problem.???? Do you know why this character can be
inserted??????
Thx..Thanks Dimitri!
I'm trying to find this place in the application but I don't have enough privileges. Here, we are working with Application Express 2.2.1 and we have to upgrade to 3.1.1.
In order to improve the behaviour of HTML Editor Standard, I think we should integrate FCK to our application, do you know about any step by step explanation to achieve this? Because I was searching this information in the forums, but I can't find anything. Please, any information you can share with me will be very helpful
Thanks again! -
Custom Popup - Passing values back to Textarea with HTML Editor
I have created a Custom Popup which is to populate a "Textarea with HTML Editor".
I have found that the Custom Popup works fine if the target item is defined as a "Textarea", or "Textarea (auto-height)", or "Textarea w/Character Counter" (although the counter is not automatically updated), or "Textarea w/Character Counter & Spellcheck", or "Textarea with Spell Checker".
However, if the target item is defined as "Textarea with HTML Editor" the Custom Popup does not populate the target item. No error message is produced. If the target item already had data, the data is unchanged.
Is this a known bug?"Textarea with HTML Editor" is actually two objects on the screen with javascript keeping the data in the two objects in sync as you type in the editor.
You have to populate both objects as you try to syncronize the data from your popup.
I built a screen using dHTML that switches between the HTML Editor and the Text with Spell check and use Javascript to keep the two (actually three objects in sync)
My button that switches from one view to the other uses the following syntax:
javascript:setEqual('P9904_HTML_MESSAGE','P9904_MESSAGE','P9904_MESSAGEDiv');
'P9904_HTML_MESSAGE' is the HTML view of the data with spell check
'P9904_MESSAGE' is the html editor view of the data
'P9904_MESSAGEDiv' is the extra object that Oracle uses for the editor
This is the fuction that keeps the data in sync:
function setEqual(fromObjectID,toObjectID,htmlObjectID)
document.getElementById(toObjectID).value = document.getElementById(fromObjectID).value;
document.getElementById(htmlObjectID).innerHTML=document.getElementById(fromObjectID).value;
I hope this helps.
Michael Snyder -
Communicating with Servlets....
hi!
Wat are all the different ways in which the JSP used to communicate with Servlet?
Thanx,
Rgds,
SasiJsp page communication with Servlets....
web.xml -- Servlets loaded during application startup
struts config -- Servlet mapping (w.r.t struts).
and u can import servlets in jsp and can use it... there are so many possible ways of using servlets coz jsp pages inturn convert into servlets and got executed..... -
Im using tomcat 4.06 and i have some problems with servlets and forwarding:
This is my servlet:
import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
public class NTenant extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String email = request.getParameter("tenant");
//insert new tenant into database.
System.out.println("Redirigiendo");
ServletContext sc = getServletConfig().getServletContext();
RequestDispatcher rdNext = sc.getRequestDispatcher("/tenantForm.html");
rdNext.forward(request, response);
System.out.println("Redirigido");
I get this error:
type Status report
message Servlet invoker is currently unavailable
description The requested service (Servlet invoker is currently unavailable) is not currently available.
This is my dir structure:
webapps\form\NewTenant.html
webapps\form\tenantForm.html
webapps\form\WEB-INF\web.xml
webapps\form\WEB-INF\classes\NTenant.class
webapps\form\WEB-INF\classes\TenantServlet.class
The problem is that i cannot find my html, what must i write here? sc.getRequestDispatcher("/tenantForm.html"); <-----
Thank you very muchI heve tried with "../tenantForm.html"
java.lang.IllegalArgumentException: Path ../tenantForm.html does not start with a "/" character
at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:572)
at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:174)
at NTenant.doPost(NTenant.java:19)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
Now Im trying with:
RequestDispatcher rdNext = sc.getRequestDispatcher "/../tenantForm.html");
And I got:
type Exception report
message Internal Server Error
description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
at NTenant.doPost(NTenant.java:20)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:465)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
Any other idea? -
Hi
Does anyone know how to use dialogs with servlets? I'd like to show a confirm dialog on the client machine. My first idea was to use JOptionPane.showConfirmDialog as such in the servlet, but then of course de dialog pops-up on the server side, and not on client side.
Many thanks for the help,
NicYou need to use javascript to confirm, ask questions, etc...
You can see :
http://www.webreference.com/programming/javascript/confirm/
Or
http://www.bodo.com/javacool.htm
Fred
Maybe you are looking for
-
Selected Table Cell Border in 1.4.2
Hi All!! I am facing a problem with JDK 1.4.2_01 & Windows L&F. I am unable to see the yellow border around the selected cell in JTable. Was working fine with 1.4.1_03. A bug with id: 4674205 was reported with 1.4.0 stating : " In the Windows Look an
-
IDOC INVOIC02 in outbound - segment E1EDP05
I'm making some test with the IDOC INVOIC02, i try to generate a invoice idoc for from another SAP system for generate SD invoice with the GN_INVOICE_CREATE. I view that the idoc created dont generate the segment E1EDP05 with the pricing procedure co
-
Chart totalsDisplay is not work on "DataSelection"
Hi all I want to show that selected four data. (Chart Property > Data Binding > Data Selection) and then how to show this selected data total display ? I try to this DS_1.setTotalsDisplay("00A01CLWSAYP8FTIBQCIGWHCX", TotalsDisplay.SHOW); DS_1.setTot
-
Lucid keypad locks and gets into a loop
Does anyone else have a problem with putting a pin # in the Lucid to lock the screen? After entering my pin it works at first, but I usually shut it down overnight to conserve the battery - usually the next day when I try to put the pin it, it accep
-
In Indesign CC, when I exported a file to pdf and checked 'view file after exporting', the pdf file always opened in Acrobat Pro (YAY). Since installing updates, all files now open in Reader (NOOO). Is there a setting to ensure it always opens in Acr