Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-29-2009, 02:47 PM
Member
 
Join Date: Jun 2009
Posts: 3
Rep Power: 0
vishnukumar is on a distinguished road
Default getting java program from textarea
Hi,

I have a text area in my web page. Where I wrote some java program and submitted the form. While I use request.getparameter("textarea_name"); I got the text, but the break(for the next line) is not fetched.

For example,

In textarea I wrote,

class Add{
public Add(){
int a;
int b;
}
}

But, I got in the request as,

class Add{public Add(){int a;int b;}}

I need to get the same pattern.

Please, help me to achieve.

Thanks.
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 06-29-2009, 04:47 PM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
Like this java-forums u embed the string in code tag and try .
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-29-2009, 06:19 PM
Member
 
Join Date: Jun 2009
Posts: 3
Rep Power: 0
vishnukumar is on a distinguished road
Default
Hi,

Thanks for your reply.

Let me know in detail of "string in code tag ". I can't understand.



-vishnukumar
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-30-2009, 11:22 AM
RamyaSivakanth's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Chennai
Posts: 589
Rep Power: 1
RamyaSivakanth is on a distinguished road
Default
Hi Vishnu,
I have given a sample code below.Whatever you are inputting in a textarea just display it in textarea embedede with CODE tag in html.I have given a sample code.Just run it and see.


Code:
<form method ="get" action="test.jsp">
<textarea name ="codeTextArea"  > </textarea>
<input type= "submit"> 

<%
   String output = request.getParameter("codeTextArea");
   if((output != null) || output !="" || output.length() > 0)
   {
%>
      <textarea name ="outputCode"
	  value<%="<CODE>"+request.getParameter("codeTextArea")+"</CODE>"%>
	  </textarea>
<%
   }
%>
__________________
Ramya
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 06-30-2009, 11:37 AM
Member
 
Join Date: Jun 2009
Posts: 3
Rep Power: 0
vishnukumar is on a distinguished road
Default
Hi,

I got exactly, what I expect with the code. But, What I need is?. I am getting values from the textarea and storing it to the database, then retrieving from the database and displaying in the web page. I am using MySQL DB. While displaying in the web page, all carriage return are absent. I am getting the values in a single line.

I think, its better, where carriage return are replaced with "\n".

Please, guide me.

Thank you


- Vishnukumar
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TextArea with Unicode Java Tip javax.swing 0 04-16-2008 11:53 PM
How to execute an External Program through Java program Java Tip java.io 0 04-04-2008 03:40 PM
TextArea Bug? Soda New To Java 2 12-07-2007 01:37 PM
How to execute an External Program through Java program JavaBean Java Tips 0 10-04-2007 10:33 PM
textarea ubuntu AWT / Swing 4 05-12-2007 10:54 PM


All times are GMT +2. The time now is 07:49 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org