Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

how to assign variable in text area?

 
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>
 
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.
 
Sheriff
Posts: 21950
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu 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 .....
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic