Results 1 to 5 of 5
- 06-29-2009, 01:47 PM #1
Member
- Join Date
- Jun 2009
- Posts
- 3
- Rep Power
- 0
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.
- 06-29-2009, 03:47 PM #2
Like this java-forums u embed the string in code tag and try .
Ramya:cool:
- 06-29-2009, 05:19 PM #3
Member
- Join Date
- Jun 2009
- Posts
- 3
- Rep Power
- 0
Hi,
Thanks for your reply.
Let me know in detail of "string in code tag ". I can't understand.
-vishnukumar
- 06-30-2009, 10:22 AM #4
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.
Java 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:cool:
- 06-30-2009, 10:37 AM #5
Member
- Join Date
- Jun 2009
- Posts
- 3
- Rep Power
- 0
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
Similar Threads
-
TextArea with Unicode
By Java Tip in forum javax.swingReplies: 0Last Post: 04-16-2008, 10:53 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
TextArea Bug?
By Soda in forum New To JavaReplies: 2Last Post: 12-07-2007, 12:37 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM -
textarea
By ubuntu in forum AWT / SwingReplies: 4Last Post: 05-12-2007, 09:54 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks