• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to assign variable in text area?

 
karthik ekantha
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can assign textarea in the <%= add> is not working in the jsp page .it ll not working



<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page language="java" import="java.util.*" %>
<%@ page language="java" import="java.sql.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Personnel Details</title>
</head>
<body>
<center>
<%!

String name="";
String fname="";
String mno="";
String comp="";
String add="";
String City="";
String States="";
%>
<%

HashMap personalDetailsMap2 = (HashMap)session.getAttribute("paramlist");


if(personalDetailsMap2.get("name")!=null && personalDetailsMap2.get("name")!="")
{


name = personalDetailsMap2.get("name").toString();
fname=personalDetailsMap2.get("fname").toString();
mno=personalDetailsMap2.get("mno").toString();
comp=personalDetailsMap2.get("comp").toString();
add=personalDetailsMap2.get("add").toString();
City=personalDetailsMap2.get("City").toString();
States=personalDetailsMap2.get("States").toString();
}

%>

<%if(session.getAttribute("paramlist").equals(null)) {%>


<form action="/person/Person" method="post">

<tr><td colspan=2 style="font-weight:bold;" align="center"> User Information<br></td></tr>
<tr><td colspan=2 align="center" height="10px"></td></tr>
<tr><td>NAME </td><td><input type="text" name="name" value="name"><br></td></tr>
<tr><td>FatherName </td><td><input type="text" name="fname" value="fname"><br></td></tr>
<tr><td>MobileNO </td><td><input type="text" name="mno" value="mno"><br></td></tr>
<tr><td> Company </td><td><input type="text" name="comp" value="comp"><br></td></tr>
<tr><td>Address </td><td> <textarea type="text" name="add" value="add"></textarea><br></td></tr>

City:
<select name="City">
<option value="Bangalore">Bangalore</option>
<option value="Chennai">Chennai</option>
<option value="Hyderbad">Hyderbad</option>
<option value="Mumbai">Mumbai</option>
</select>
<br>

States:
<select name="States">
<option value="Kanataka">Kanataka</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Andrapradesh">Andrapradesh</option>
<option value="Maharastra">Maharastra</option>
</select><br>

<input type="submit" name="b1" value="Save" >
<input type="submit" name="b1" value="Edit"> <br>

</form>

<% } else {%>
<form action="/person/Person" method="post">

<tr><td colspan=2 style="font-weight:bold;" align="center"> User Information<br></td></tr>
<tr><td colspan=2 align="center" height="10px"></td></tr>
<tr><td> NAME </td><td><input type="text" name="name" value=<%= name%>><br></td></tr>
<tr><td>FatherName </td><td><input type="text" name="fname" value=<%= fname%>><br></td></tr>
<tr><td>MobileNO </td><td><input type="text" name="mno" value=<%= mno%>><br></td></tr>
<tr><td> Company </td><td><input type="text" name="comp" value=<%= comp%>><br></td></tr>
<tr><td>ADDRESS </td><td> <textarea type="text" name="add" value=<%= add%>></textarea><br></td></tr> how can specify text area ??? this is not working

City:

<% if( City.equals("Bangalore")) {%>
<select name="City">
<option value="Bangalore" selected = "selected">Bangalore</option>
<option value="Chennai">Chennai</option>
<option value="Hyderbad">Hyderbad</option>
<option value="Mumbai">Mumbai</option>
</select>
<% } %>
<% if( City.equals("Chennai")) {%>
<select name="City">
<option value="Bangalore" >Bangalore</option>
<option value="Chennai" selected = "selected">Chennai</option>
<option value="Hyderbad">Hyderbad</option>
<option value="Mumbai">Mumbai</option>
</select>
<% } %>
<% if( City.equals("Hyderbad")) {%>
<select name="City">
<option value="Bangalore" >Bangalore</option>
<option value="Chennai" >Chennai</option>
<option value="Hyderbad"selected = "selected">Hyderbad</option>
<option value="Mumbai">Mumbai</option>
</select>
<% } %>
<% if( City.equals("Mumbai")) {%>
<select name="City">
<option value="Bangalore" >Bangalore</option>
<option value="Chennai" >Chennai</option>
<option value="Hyderbad">Hyderbad</option>
<option value="Mumbai"selected = "selected">Mumbai</option>
</select>
<% } %>
<br>

States:
<% if( States.equals("Kanataka")) {%>
<select name="States">
<option value="Kanataka"selected = "selected">Kanataka</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Andrapradesh">Andrapradesh</option>
<option value="Maharastra">Maharastra</option>
</select>
<% } %>
<% if( States.equals("Tamilnadu")) {%>
<select name="States">
<option value="Kanataka">Kanataka</option>
<option value="Tamilnadu"selected = "selected">Tamilnadu</option>
<option value="Andrapradesh">Andrapradesh</option>
<option value="Maharastra">Maharastra</option>
</select>
<% } %>
<% if( States.equals("Andrapradesh")) {%>
<select name="States">
<option value="Kanataka">Kanataka</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Andrapradesh"selected = "selected">Andrapradesh</option>
<option value="Maharastra">Maharastra</option>
</select>
<% } %>
<% if( States.equals("Maharastra")) {%>
<select name="States">
<option value="Kanataka">Kanataka</option>
<option value="Tamilnadu">Tamilnadu</option>
<option value="Andrapradesh">Andrapradesh</option>
<option value="Maharastra"selected = "selected">Maharastra</option>
</select>
<% } %>


<br>

<input type="submit" name="b1" value="Save" >
<input type="submit" name="b1" value="Edit"> <br>

</form>
<%}%>

</center>
</body>
</html>
 
Karthik Ponnusamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Karthik,

Please use the below as syntax for using text area in jsp pages.

<input type="textarea" name="textarea" value="Find in Jsp">

in your case it might be,

<tr>
<td>ADDRESS </td>
<td> <input type="textarea" name="add" value=<%= add%>> </td>
</tr>

Please verify & let me know for any suggestions.

Thanks,
Karthik.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
56
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With textarea elements, the value comes between the opening and closing tags:
 
karthik ekantha
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you i got it ..thank your response .....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic