Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


debasis
Javascript
0 Answer(s)      4 years and 2 months ago
Posted in : Design concepts & design patterns


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>
&nbsp;&nbsp;
</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>
&nbsp;&nbsp;
</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>
&nbsp;&nbsp;
</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:
&nbsp; <b> <%= userName %>
</td>
</tr>

<tr>
<td align="left">Mail To:&nbsp;&nbsp;
<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:&nbsp;&nbsp;

<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>




Advertisement
View Answers

Related Tutorials/Questions & Answers:
JavaScript
JavaScript  clone JavaScript
javascript
javascript  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
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  write a program to display implement about browsers using javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
JavaScript
JavaScript  how to get full path of a file type in 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
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
javascript
javascript  Hi sir, This is sinduri, i want to learn javascript, so plz can u help me.how to learn
javascript
javascript  hi sir, if i want to learn javascript. what concepts i want to know
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
JAVASCRIPT
JAVASCRIPT  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
javaScript
javaScript  . Print a table like below in JAVASCRIPT 5 x 1 = 5 5 x 2 = 10 ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦. 5 x 20 = 100
javascript
javascript  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
javascript
javascript  passing javascript values to jsp   Hi Friend, Try the following code: form.jsp: <html> <script> function getMsg...;/script> <input type="button" onclick="getMsg();" value="Get Javascript value
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:<
Javascript
Javascript  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
Javascript
Javascript  <html> <head> <script type="text/javascript"> function validateForm() { var sname=document.getElementById('spocname'); var scontact=document.getElementById('spoccontact'); if(sname.value.length
javascript
javascript  how to create random question using javascript?   <html> <script> function displayQuestions() { document.getElementById("text").value=" "; var Questions = new Array(20
javascript
javascript  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 types
JavaScript types  What are JavaScript types
javascript validation
javascript validation  validation of comparing dropdownlist and textbox in javascript
JavaScript and ECMAScript
JavaScript and ECMAScript  What?s relationship between JavaScript and ECMAScript
javascript doubt
javascript doubt  How to retrieving the values from Database by using 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
Prototypes for JavaScript
Prototypes for JavaScript  What's Prototypes for JavaScript
 

 

 

DMCA.com