Javascript
Dera sir,
Here is my compose mail page.How to integrate attach file(text or excel) in this page.How to store in the database.How to download it in another page.please help.This is mighty part left in the mail page.Your help is paramount.
Thank You
Debasis
jsp page--
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ include file="/security/authenticate.jsp"%>
<%@ include file="/security/TopAndLeftTrans.jsp"%>
<%@ page import="java.text.SimpleDateFormat" %>
<jsp:useBean id="tmsBean" scope="request" class="pms.administration.MailServer"></jsp:useBean>
<jsp:setProperty name="tmsBean" property="*"/>
<link rel="stylesheet" type="text/css" href="/tms/misc/rounded.css"></link>
<link rel="stylesheet" type="text/css" href="/tms/misc/stylemain.css"></link>
<link rel="stylesheet" type="text/css" href="/tms/misc/button.css"></link>
<link rel="stylesheet" type="text/css" href="/tms/misc/report.css"></link>
<title>MAIL INBOX</title>
<%
String messageFromtmsBean="";
String display="";
String userName=request.getParameter("userName");if(userName==null)userName="";
//System.out.println("userName:"+userName);
try{
display = request.getParameter("display");
//System.out.println("Hi:"+display);
String fetchPressed = request.getParameter("fetchPressed");
if(display==null)display="";
if(fetchPressed != null )
{
if(fetchPressed == "yes")
{
tmsBean.setFetchPressed("yes");
}else if(fetchPressed == "no")
{
tmsBean.setFetchPressed("no");
}
}
}catch(Exception e){}
try{
if(display.equals("draft"))
{
tmsBean.draftMail(request);
}else if(display.equals("send"))
{
tmsBean.sendMail(request);
}
}catch (Exception e)
{
//out.println("reached herer");
}
%>
<script type="text/javascript" language="JavaScript1.2" src="/tms/misc/Validate.js" ></script>
<script language="javascript" type="text/javascript" src="/tms/misc/datetimepicker.js"></script>
<head>
<style type="text/css">
.mouseOut {
background: #708090;
color: #FFFAFA;
}
.mouseOver {
background: #E6E6FA;
color: #000000;
}
</style>
<script language="JavaScript1.2">
var globalVar = "";
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function initVars() {
inputField = document.getElementById("names");
nameTable = document.getElementById("name_table");
completeDiv = document.getElementById("popup");
nameTableBody = document.getElementById("name_table_body");
}
function findNames() {
//alert("gb nm "+globalVar);
initVars();
var inptVal = inputField.value;
if(globalVar.length > 0){
var rev = inptVal.split("").reverse().join("");
var commPosition = rev.indexOf(",");
var cStr = rev.substr(0,commPosition);
var corrStr = cStr.split("").reverse().join("")
//alert("reverse "+rev);
var srchStr = corrStr;//rev.substr(1, inptVal.substr(1,inptVal.reverse().indexOf(","));
//alert("scch string "+srchStr);
//alert(srchStr);
}else
{
srchStr = inptVal;
}
//alert("not global var "+srchStr.length);
if (srchStr.length > 0) {
createXMLHttpRequest();
var url = "user.jsp?val=" + escape(srchStr);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = callback;
//alert("after call back ");
xmlHttp.send(null);
}else
{
clearNames();
}//end of if
}//main function
function callback() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.data;
//alert("after set names");
setNames(xmlHttp.responseXML.getElementsByTagName("name"));
} else if (xmlHttp.status == 204){
clearNames();
}
}
}
function setNames(the_names) {
clearNames();
var size = the_names.length;
setOffsets();
var row, cell, txtNode;
for (var i = 0; i < size; i++) {
var nextNode = the_names[i].firstChild.data;
row = document.createElement("tr");
cell = document.createElement("td");
cell.onmouseout = function() {this.className='mouseOver';};
cell.onmouseover = function() {this.className='mouseOut';};
cell.setAttribute("bgcolor", "#E6E6FA");
cell.setAttribute("border", "1");
cell.onclick = function() { populateName(this); } ;
txtNode = document.createTextNode(nextNode);
cell.appendChild(txtNode);
row.appendChild(cell);
nameTableBody.appendChild(row);
}
}
function setOffsets() {
var end = inputField.offsetWidth;
var left = calculateOffsetLeft(inputField);
var top = calculateOffsetTop(inputField) + inputField.offsetHeight;
completeDiv.style.border = "black 1px solid";
completeDiv.style.left = left + "px";
completeDiv.style.top = top + "px";
nameTable.style.width = end + "px";
}
function calculateOffsetLeft(field) {
return calculateOffset(field, "offsetLeft");
}
function calculateOffsetTop(field) {
return calculateOffset(field, "offsetTop");
}
function calculateOffset(field, attr) {
var offset = 0;
while(field) {
offset += field[attr];
field = field.offsetParent;
}
return offset;
}
function populateName(cell) {
inputField.value = globalVar+cell.firstChild.nodeValue+",";
globalVar=document.getElementById("names").value;
clearNames();
}
function clearNames() {
var ind = nameTableBody.childNodes.length;
for (var i = ind - 1; i >= 0 ; i--) {
nameTableBody.removeChild(nameTableBody.childNodes[i]);
}
completeDiv.style.border = "none";
}
</script>
</head>
<form method="GET" name="ComposeMail" action="ComposeMail.jsp" autocomplete="off">
<table align="left" bgcolor="White" width=80% >
<tr>
<td>
<table align="left" width="20%" cellpadding="15" bgcolor="#D0D0E0" >
<tr>
<td>
<FONT size="6" color="Maroon"><b><U>TTMS Mail</U> </b>
</td>
</tr>
<tr>
<td>
<input type="button" name="Compose" value="Compose" style="width:100;" onClick="document.location.href='/tms/administration/ComposeMail.jsp?userName=<%=userName%>'">
</td>
</tr>
<tr>
</tr>
<tr><td>
<input type="button" name="Inbox" value="Inbox" style="width:100;" onClick="document.location.href='/tms/administration/MailInbox.jsp?userName=<%=userName%>'"></input>
</td></tr>
<tr>
</tr>
<tr><td>
<input type="button" name="Draft" value="Draft" style="width:100;" onClick="document.location.href='/tms/administration/DraftMail.jsp?userName=<%=userName%>'"></input>
</td></tr>
<tr>
</tr>
<tr><td>
<input type="button" name="Sent" value="Sent" style="width:100;" onClick="document.location.href='/tms/administration/SentMail.jsp?userName=<%=userName%>'"></input>
</td></tr>
</table>
<table align="center" width="20%" border="0" cellpadding="0" cellspacing="0"
style="border-collapse:collapse;border-color:black;">
<br></br>
<tr>
<td>
<div class="ContentContainer" id="CenterContainer">
<div class="WideSectionContainer" id="WideSectionContainer1">
<div>
<div>
<div id="hpmebaag">
<div class="cchprcp_container">
<div class="hprcp_n">
<div class="hprcp_e">
<div class="hprcp_w"></div>
</div>
</div>
<div class="hprcp_head">
<div>
<span class="mtitle">
<font style="titletext" class="mtitle" size="3">Mail Details</font>
</span>
</div>
</div><div class="hprcp_mid">
<table class="formfields" border="0" align="center" cellpadding="2" style="border-collapse: collapse"
bordercolor="#111111" cellspacing="1">
<tr>
<td colspan="2">
<table border="0">
<tr>
<td>
<table align="center" >
<tr>
<td>
<fieldset id="master" title="Asset Index No." style="width=600">
<legend>TTMS MAIL</legend>
<table align="center" border="0" >
<tr>
<td align="left">Mail From:
<b> <%= userName %>
</td>
</tr>
<tr>
<td align="left">Mail To:
<input type="text" size="70" name="inputText" id="names" onkeyup="findNames();" style="height:50;"/>
<div style="position:absolute;" id="popup">
<table id="name_table" bgcolor="#E6E6FA" border="0"
cellspacing="0" cellpadding="0"/>
<tbody id="name_table_body"></tbody>
</table>
</div>
<tr align="center">
<td>
<input type="button" name="Add cc" value="Addcc" style="width:60" onClick="document.location.href='/tms/administration/MailInbox.jsp?userName=<%=userName%>'">
<input type="button" name="Add Bcc" value="AddBcc" style="width:75" onClick="document.location.href='/tms/administration/MailInbox.jsp?userName=<%=userName%>'">
</td>
</tr>
<tr>
<td align="left">Subject:
<input type="TEXT" name="sub" size="50"></input>
</td>
</tr>
<tr align="center">
<td>
<input type="button" name="Attach File" value="Attach File" style="width:100;" onClick="document.location.href='/tms/administration/MailInbox.jsp?userName=<%=userName%>'"></input>
</td></tr>
</table>
</fieldset>
</td>
</tr>
</table>
<fieldset id="mst" title="Mail">
<legend>Your Mail</legend>
<table>
<tr>
<td><textarea name="remarks" id="remarks" cols="70" rows="20" value="<jsp:getProperty name="tmsBean" property="remarks" />"><jsp:getProperty name="tmsBean" property="remarks" /></textarea></td>
</tr>
<tr>
<input type="HIDDEN" name="userName" value="<%=userName%>"></input>
<input type="HIDDEN" name="display" value="">
<td align="center">
<input type="button" name="Discard" value="Discard" style="width:100;" onClick="document.location.href='/tms/administration/MailInbox.jsp?userName=<%=userName%>'">
<input type="button" name="Send" value="Send" style="width:100;" onclick="javascript:submitClick()">
<input type="button" name="Draft" value="Draft" style="width:100;" onclick="javascript:DraftMail()">
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
View Answers
Related Tutorials/Questions & Answers:
javascriptjavascript
javascript code to dynamically add table on button click.../
javascript/javascriptexamples/
javascript-add-row-dynamically.shtml
http://www.roseindia.net/
javascript/
javascript-add-row-to-table.shtml
http://www.roseindia.net
Advertisements
JavascriptJavascript How validations are done using
javascript ,with example? and interview questions on
javASCRIPT JavaScript should use
JavaScript?
Thanks
Hi,
JavaScript is scripting language that runs on browser. You have to embed
JavaScript in HTML page.
Please see
JavaScript tutorial.
Thanks
JavaScriptJavaScript how to get full path of a file type in
javascript javascriptjavascript Hi deepak,
how to write form validation on
javascript javascriptjavascript write a program to display implement about browsers using
javascript javaScriptjavaScript How to open a browser window that cannot be resized? (HTML +
Javascript javascriptjavascript i have just learned
javascript...
can you tell me what kind of applications can be made by
javascript??
thank you
javascriptjavascript how to set the request or session attribute in
javascript head part of jsp page
javascriptjavascript Hi sir,
This is sinduri, i want to learn
javascript, so plz can u help me.how to learn
javascriptjavascript hi sir,
if i want to learn
javascript. what concepts i want to know
JAVASCRIPTJAVASCRIPT I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a
javascript for that ?
thanks in advance
Javascript Javascript Javascript to check Numeric entry in checkbox.....
Hi Please find the following code for numeric entry validation in
javascript
function validateBox(){
var data=document.myForm.someText.value
javascriptjavascript hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using
javascript, and when i click on button then number of days should be display in textbox
javaScriptjavaScript . Print a table like below in
JAVASCRIPT
5 x 1 = 5
5 x 2 = 10
���.
5 x 20 = 100
javascriptjavascript passing
javascript values to jsp
Hi Friend,
Try the following code:ADS_TO_REPLACE_1
form.jsp:
<html>
<script>...
Javascript value In JSP">
<%
String st=request.getParameter("msg");
if(st
Javascript this format xxx-xxx-xxxx, i want the code in
javascript. as a function.
Javascript Phone Number Validation
<html>
<script>
function..." method="post" onsubmit="
javascript:return validate();">
Phone Number:<
JavascriptJavascript Dear Sir,
Thank You a lot for your continuos support.Again i am in need of your help.
What is the
javascript code to disable a link,once...
javascript or css
Please help me.Urgent
Regards
Debasis
Hello Friend
JavascriptJavascript <html>
<head>
<script type="text/
javascript">
function validateForm() {
var sname=document.getElementById('spocname');
var scontact=document.getElementById('spoccontact');
if(sname.value.length
javascriptjavascript how to create random question using
javascript?
<html>
<script>
function displayQuestions() {
document.getElementById("text").value=" ";
var Questions = new Array(20
javascriptjavascript Hi deepak,
sample example on
javascript form validation
<html>
<script>
function checkName(text) {
if(isNaN(text)){
return 1;
}
else{
alert("Please enter a valid name. The only charachters
javascript doubtjavascript doubt How to retrieving the values from Database by using
javascript javascript validationjavascript validation validation of comparing dropdownlist and textbox in
javascript JavaScript - JavaScript Tutorial
JavaScript Tutorials is one of the best Quick
reference to the
JavaScript. In this
JavaScript reference you will find most of
the things about java script.
JavaScript tutorial is classified into sections
with examples. This tutorial
JavaScript - JavaScript Tutorial
JavaScript Tutorials is one of the best Quick
reference to the
JavaScript. In this
JavaScript reference you will find most of
the things about java script.
JavaScript tutorial is classified into sections
with examples. This tutorial
javascript and databasejavascript and database i want to connect
javascript pages with msaccess (as a database)how can i do so
javascript queryjavascript query how to get
javascript variable value into java variable??
i have one value in
javascript variable(var name = value )
i want this name variable value in java variable (string name1
javascript validationjavascript validation How to do
javascript validations to check whether the entered primary key is present in the database or not .Iam using jsp language
javascript validationjavascript validation How to do
javascript validations to check whether the entered primary key is present in the database or not .Iam using jsp language
What is JavaScript?What is
JavaScript? Hi,
Sometime the students trying to know make... is Java script and other java related queries. How to define what is
JavaScript... is
JavaScript" and How it will help the developer in Java Program?
Let me
Javascript and PHPJavascript and PHP Hello,
I want to know how to call
javascript...
Here is a simple example of php that calls
javascript function.
<script language="
javascript">
function hello()
{
alert("Hello World");
}
<
JavaScript - JavaScript TutorialJavaScript -
JavaScript Tutorial
JavaScript Tutorials is one of the best Quick
reference to the
JavaScript. In this
JavaScript reference you will find most of
the things about java script.
JavaScript tutorial is classified
Acrobat JavascriptAcrobat Javascript i want to know about complete tutorial of Acrobat
javascript in brief
settimeout in javascriptsettimeout in javascript How to call the settimeout() function in
JavaScript after a specified time
Javascript QuerryJavascript Querry How to export the ms access header data to excel using java script
javascript - XMLjavascript HI,
Greetings....
I want to call
javascript file i.e. ".js" from xml file. If it is possible tell me how to do that. and i want to know how to call
javascript function from xml...
Please help me in this regard
timespan in javascripttimespan in javascript How to calculate timespan in Java and
JavaScript?
stringToDate: function(string) {
var matches...;
};
}
Timespan in
Javascript JavaScript basicJavaScript basic What does "1"+2+4 evaluate to?
Since "1" is a string, everything is a string, so the result is a string of "124
Embedded JavaScript
Embedded
JavaScript
Embedded
JavaScript (EJS) is an open source
JavaScript template library.
Read full DescriptionADS_TO_REPLACE_1