I am trying to send mails to user who signup through our portal. Everything works fine except that image is not visible in the mail. here is the snippet of code
<html>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" bgcolor='#E5E5E5' >
<STYLE>
.headerTop { background-color:#FFCC66; border-top:0px solid #000000; border-bottom:1px solid #FFFFFF; text-align:center; }
.adminText { font-size:10px; color:#996600; line-height:200%; font-family:verdana; text-decoration:none; }
.headerBar { background-color:#FFFFFF; border-top:0px solid #333333; border-bottom:10px solid #FFFFFF; }
.title { font-size:16px; font-weight:bold; color:#295EA0; font-family:arial; line-height:110%; }
.subTitle { font-size:11px; font-weight:normal; color:#666666; font-style:italic; font-family:arial; }
.defaultText { font-size:12px; color:#000000; line-height:150%; font-family:arial; }
.footerRow { background-color:#FFFFCC; border-top:10px solid #FFFFFF; }
.footerText { font-size:10px; color:#996600; line-height:100%; font-family:verdana; }
a { color:#00F; color:#00F; color:#00F; }
</STYLE>
<table width="100%" cellpadding="10" cellspacing="0" class="backgroundTable" bgcolor='#E5E5E5' >
<tr>
<td valign="top" align="center">
<table width="550" cellpadding="0" cellspacing="0">
<tr>
<td style="background-color:#FFFFFF;border-top:0px solid #333333;border-bottom:10px solid #FFFFFF;"><center><IMG id=editableImg1 SRC="#banner#" BORDER="0" title="Reppify" alt="Reppify" align="center"></center></td>
</tr>
I think you need to write the image full path
<tr>
<td style="background-color:#FFFFFF;border-top:0px solid #333333;border-bottom:10px solid #FFFFFF;"><center><IMG id=editableImg1 SRC="**http://www.www.com/banner.jpg**" BORDER="0" title="Reppify" alt="Reppify" align="center"></center></td>
</tr>
Related
I am using openhtmltopdf to generate paginated tables rendering in a pdf document,
Below template rendering extra header and footer in an additional page, which shouldn't be, as there are no more rows left.
<html>
<head>
<style>
#page {
size: 400px 350px;
}
table {
width: 100%;
font-size: 16px;
border-collapse: collapse;
/* The magical table pagination property. */
-fs-table-paginate: paginate;
/* Recommended to avoid leaving thead on a page by itself. */
-fs-page-break-min-height: 1.5cm;
}
tr,
thead,
tfoot {
page-break-inside: avoid;
}
td,
th {
padding: 6px;
border: 1px solid gray;
}
tfoot td {
background-color: aqua;
}
thead th {
background-color: coral;
}
</style>
</head>
<body>
<table>
<caption>
<p>This example shows how to use table pagination.</p>
<p>The table header and footer are automatically reproduced on each page.</p>
</caption>
<thead>
<tr>
<th>Title 1</th>
<th>Title 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Hello</td>
<td>World!</td>
</tr>
<tr>
<td>Hello</td>
<td>World!</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Footer 1</td>
<td>Footer 2</td>
</tr>
</tfoot>
</table>
</body>
</html>
Here is the output document screenshot for reference.
Can you please help, how to eliminate that rows?
FYI, Here is the sandbox link for quick testing : https://sandbox.openhtmltopdf.com/
I'm trying to write a code that stores images into database, then later display it on the webpage using the rollnum to retrieve it from the database. I've tried all i could but still no good, i tried reading some tutorials but still no good, anyways here's the code i'm working on. I'd be very grateful if someone could help, Thanks in Advance.
<%#page import="java.sql.*" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration Page</title>
<style>
body{
background-image: url('bg.png');
background-repeat: repeat;
font-family: Courier New;
margin:auto;
width: 1000px;
}
.wrap{
margin-top:10px;
border:solid 1px #000;
height:900px;
}
.header{
font-size: 50px;
font-weight: bold;
font-family: Courier New;
text-align: center;
}
.border{
border-bottom: solid 1px #000;
margin-left: 30px;
margin-right: 30px;
}
.box{
border: solid 1px #000;
padding: 8px;
margin: 30px;
}
</style>
</head>
<body>
<div class="wrap">
<table>
<form method="post">
<br/>
<tr>
<td> Roll Number:</td> <td><input type="text" name="rollnum"/></td>
</tr>
</div>
<tr>
<td> First Name:</td> <td><input type="text" name="fname"/></td>
</tr>
<tr>
<td> Last Name:</td> <td><input type="text" name="lname"/></td>
</tr>
<tr>
<td> Course Name:</td> <td><input type="text" name="course"/></td>
</tr>
<tr>
<td> Gender:</td> <td>Male:<input type="radio" name="gender" value="Male"/> Female:<input type="radio" name="gender" value="Female"/></td>
</tr>
<tr>
<td> Address:</td> <td><input type="text" name="addr"/></td>
</tr>
<tr>
<td> State:</td> <td><input type="text" name="state"/></td>
</tr>
<tr>
<td> Photo:<input type="file" name="photo"/></td>
</tr>
<tr>
<td> <input type="submit" value="Submit" name="submit"/></td>
</tr>
</form>
</table>
<%
try{
if(request.getParameter("submit") != null){
Connection conn;
PreparedStatement prep;
String sql;
String url = "jdbc:derby://localhost:1527/reg";
Class.forName("org.apache.derby.jdbc.ClientDriver");
conn = DriverManager.getConnection(url,"uname","pass");
sql =
"insert into student (rollnum,fname,lname,course,gender,addr,state,photo)"
+"values(?,?,?,?,?,?,?,?)";
ResultSet rs = null;
prep = conn.prepareStatement(sql);
prep.setInt(1, Integer.parseInt(request.getParameter("rollnum")));
prep.setString(2, request.getParameter("fname"));
prep.setString(3, request.getParameter("lname"));
prep.setString(4, request.getParameter("course"));
prep.setString(5, request.getParameter("gender"));
prep.setString(6, request.getParameter("addr"));
prep.setString(7, request.getParameter("state"));
//prep.setString(8, request.getParameter("photo"));
Blob blob = rs.getBlob(request.getParameter("photo"));;
prep.setBlob(8, blob);
int n = prep.executeUpdate();
if(n>0){
%>
<div class="box">Registration Successful!! <b>Login Now!!</b></div>
<%
}
}
}
catch(ClassNotFoundException e){
}
catch(NumberFormatException n){
}
%>
</div>
</body>
You can follow this way:
Get the image
Convert the image with the base64 rappresentation
Store the base64 into your db
when you need the image convert again the base64 into the image
<html>
<head>
<title>HR WorkWays</title>
<SCRIPT LANGUAGE="JavaScript">
if(window.history.forward(1) != null) window.history.forward(1);
</script>
<script language="JavaScript" src="/theme/disabledRightclick.js""></script>
<SCRIPT LANGUAGE=JavaScript FOR=window EVENT=onbeforeunload>
if (window.event.clientY < 0 && window.event.clientY < -80) {
valuex=window.event.returnValue = "";
}
</script>
</head>
<body>
</body>
</html>
<!-- Added for GSFIX -->
<div style="font: bold 12px Arial; color:#FF0000"></div>
<html>
<head>
<title>PAN NO</title>
<style type="text/css">
div#rolltipDiv {
position:absolute; visibility:hidden;
left:0; top:0; z-index:1000;
font:Arial, Helvetica, sans-serif;
width:220px; padding:3px; font-size:11px;
background-color:#dee7f7; border:1px solid #336;
}
.aceTextField {
border-width: 1;
border-style: single;
font-size: 2.5 mm;
font:Arial, Helvetica, sans-serif;
font-weight :normal;
text-align : right;
}
.aceNoTextField {
border-width: 0;
border-style: single;
font-size: 2.5 mm;
font:Arial, Helvetica, sans-serif;
font-weight :normal;
text-align : right;
}
.buttStyle {
background-color: #EEEEEE;
border-width: 1;
border-color: #DDDDDD;
font-size: 7pt;
font:Arial, Helvetica, sans-serif;
font-weight: bold;
}
</style>
<style type="text/css">
<!--
.style10 { font:Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; font-weight: bold; }
.style15 { font:Arial, Helvetica, sans-serif; font-size: 12px; color: #0000ff; font-weight: bold; }
.style20 { font:Arial, Helvetica, sans-serif; font-size: 9px; color: 2; }
a {
font-family: tahoma;
font-size: xx-small;
}
.style42 {color: #FFFFFF; font:Arial, Helvetica, sans-serif;}
.style58 { font:Arial, Helvetica, sans-serif; font-size: 9px; color: #FFFFFF; font-weight: bold; }
.style65 {color: #000000 font:Arial, Helvetica, sans-serif;}
body {
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
body,td,th {
color: #000000;
}
.style79 {color: #666666 font:Arial, Helvetica, sans-serif;}
.style86 {font-size: 14px;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
}
.style87 {font-size: 14px; color: #000000; }
.style88 {font-size: 14; }
.heading
{
border-width:0;
border-color:#185081;
text-align:left;
font-size: 8pt;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
foreground-color:#ffffff;
}
.msgStl
{
border-width:0;
border-color:#185081;
text-align:center;
font-size: 8pt;
font-weight: bold;
font:Arial, Helvetica, sans-serif;
foreground-color:#ffffff;
}
-->
</style>
<SCRIPT language="javascript">
// VJK: Later we can remove
if(window.parent.contents == null) {
window.showModalDialog('/New_Window_error.html','window','title:Error ; dialogWidth:400px;dialogHeight:310px; status:no');
if(navigator.appName == 'Netscape'){
window.stop();
} else {
document.execCommand('stop');
}
}
// VJK: Later we can remove
function doValidate()
{
myFrm = document.forms.panNo;
var str_pan = allTrim(myFrm.pan_no.value);
if(validate_pan(str_pan) == false)
{
return false;
}
if(myFrm.pan_no.value == 'APPPP1234W')
{
alert('Please enter a new PAN value.');
return false;
}
document.forms.panNo.flag.value='P';
**document.getElementById("cuen").value="hc|aa|faaf|offaa||faa{a||f^aaaafafafaff||afa|fafff|a}o^f#}c^";**
document.getElementById("url").value="/pan.jsp";
document.forms.panNo.action="/pan.jsp";
document.forms.panNo.submit();
}
function allTrim(string)
{
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
{
temp += splitstring[i];
}
return temp;
}
function validate_pan(str_pan1)
{
var str_pan = allTrim(str_pan1);
//var str_pan = str_pan1;
if (str_pan.length == 0)
{
alert("Pan Number cannot be blank.");
document.getElementById("pan_no").focus();
return false;
}
if(str_pan.length!=0 && str_pan!="APPLIEDFOR" && str_pan!="PANAPPLIED" && str_pan!="PANINVALID" && str_pan!="PANNOTAVBL")
{
var reg= new RegExp("[A-Z][A-Z][A-Z][A-Z][A-Z][0-9][0-9][0-9][0-9][A-Z]");
if(reg.test(str_pan)==false)
{
alert("The first 5 characters of Pan No should be alpha in caps, the next 4 should be numerals and the last charater an alphabet in caps OR it should be APPLIEDFOR in capital letters.");
document.getElementById("pan_no").focus();
return false;
}
if(str_pan.charAt(3)!='P')
{
alert("The fourth character of the PAN Number should be aplhabet P ");
return false;
}
}
}
function resizePan(obj)
{
if(obj.value == 'PAN NOT AVAILABLE / PAN APPLIED')
{
obj.size = '12';
obj.maxLength = '10';
}
document.getElementById('pan_no').value = "";
}
</script>
<style type='text/css'> body { scrollbar-face-color:ghostwhite; scrollbar-highlight-color:darkgray; scrollbar-3dlight-color:lightblue; scrollbar-darkshadow-color:gray; scrollbar-shadow-color:darkslateblue; scrollbar-arrow-color:midnightblue; scrollbar-track-color:gainsboro; } </style>
<link href="/theme/Styles_Modified.css" rel="stylesheet" type="text/css" />
</head>
<body >
<form name="panNo" method="post" action="/pan.jsp">
<INPUT TYPE="hidden" NAME="cuen" id="cuen" VALUE="">
<INPUT TYPE="hidden" NAME="url" id="url" VALUE="">
<center>
<div align="center"></div>
<table width="43%" border="0" align="center">
<tr>
<td height="168" colspan="3">
<table bgcolor="#F2F3F4" width="418" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" rules="none">
<tr bgcolor="#185081" >
<td colspan="2"><div align="center" class="tableHeader13">Update PAN </div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="143" class="tableContent11b"><p> Employee ID</p></td>
<td width="269" class="tableContent11"><p align="left">21865275</p></td>
</tr>
<tr>
<td width="143" height="24" class="tableContent11b"><p> Employee Name</p></td>
<td width="269" class="tableContent11"><p align="left">ABC21865275</p></td>
</tr>
<!--
<tr bgcolor="#FFFFFF" class="style58">
<td width="143" height="24"><p class="style87"> Existing PAN</p></td>
<td width="269"><p align="left" class="style88">AGOPR99999</p></td>
</tr>
-->
<tr>
<td height="26" class="tableContent11b"><span> PAN</span></td>
<td width="269" class="tableContent11"><input name="pan_no" id="pan_no" type="text" size='12' maxlength='10' value="APPPP1234W" onFocus="resizePan(this)" class="textBoxEntryNo11L" >
</td>
</tr>
</table>
</td>
</tr>
</table>
<table align="center">
<tr>
<td>
<input type="button" name="Submit" value="Confirm PAN" onClick="doValidate()" class="buttonStyle12">
</td>
</tr>
</table>
</center>
<table align="center" width="434">
<tr>
<td width="434" height="10"></td>
</tr>
<tr>
<td height="40">
<div class="messageBlue11b">This screen is enabled from
01/05/2014
to 15/11/2014
</div>
</td>
</table>
<INPUT TYPE='hidden' NAME='jspName' VALUE='pan'>
<input type="Hidden" name="flag" VALUE="">
</form>
</body>
</html>
[1]: http://i.stack.imgur.com/SS7BO.jpg
For the following response code during get request,i need to extract the value document.getElementById("cuen").value="#aaoacaaaaafaaaaaaaa}ck#|o##cfff##k^c#c{a^{ko{{}|{f{c{c{o}{{"; and this need to post to next HTTP request. I used following parameters
![Regular Expression Extractor in Jmeter][10]
please elaborate to extract the regex
Try this,
document.getElementById\(\"cuen\"\)\.value=\"(.*)\";
you need to escape special characters.
I have tried it, working on my machine.
Try bypass marks . ( ) " before value="(.+?)" by mark /
Like: document\ .getElementById\ (\"cuen\"\ )\ .value="(.+?)" <- try without spacebar's
Use below mentioned Regular expression:
.document\.getElementById\(\"cuen\"\)\.value="(.+?)".
Also keep Match No. as "1"
Hope this will help.
In my jsp page i have following code snippet. This page is coming recursive way during my flow. I am getting a duplicate bean id error while execution of the jsp in the middle of the flow. Can you anyone help me how to check whether bean id already exist or not for the following code?
The full code has been given
code.jsp
<%# page language="java" %>
<%# page import="com.ubsw.risk.AUT_Authenticator.*" %>
<%
String path= System.getProperty("dev_property_path");
System.out.println("dev_property_path----->"+path);
%>
<jsp:useBean id="orbinfra" scope="session" class="com.ubsw.risk.Creation.web.OrbinfraBean" >
<jsp:setProperty name="orbinfra" property="propertiesFile" value="<%=path%>"/>
<%
System.out.println("B4 init of Orbinfra");
try {
orbinfra.init();
System.out.println("after init of Orbinfra");
} catch( Exception ex ) {
System.out.println("error in Orbinfra"+ex);
ex.printStackTrace();
%>
<html>
Caught exception while creating orbinfra <%= ex %>
</html>
<%
}
%>
</jsp:useBean>
<jsp:useBean id="security" scope="session" class="com.ubsw.risk.Creation.web.AuthenticatorBean" >
</jsp:useBean>
<%
boolean showLogin;
showLogin = true;
boolean additionalMessage = false;
String message = "Warning - Users login has expired";
boolean hasAdminRights = false;
// is there a command being sent
String checkcommand = request.getParameter("command");
// does user want to login
if( checkcommand != null ) {
if( checkcommand.equals("login") ) {
try {
String authenticatorModuleLookupValue= System.getProperty("authenticatorModuleLookupValue");
String cookieNamevalue= System.getProperty("cookieNamevalue");
System.out.println(request.getParameter("User_Name"));
System.out.println(request.getRemoteAddr());
System.out.println(request.getLocalAddr());
System.out.println("hello P");
//HttpSession session1 = request.getSession(true);
System.out.println(authenticatorModuleLookupValue+":"+cookieNamevalue);
security.setloginInfo(authenticatorModuleLookupValue,cookieNamevalue);
security.logon(request.getParameter("User_Name"), request.getParameter("Password"), request.getRemoteAddr(), response );
System.out.println("what happened?");System.out.println(security);
showLogin = false;
} catch( LogonFailure le ) {
additionalMessage = true;
message = "Logon failed : " + le.reason;
} catch( Exception ex ) {
additionalMessage = true;
message = "Failed, caught an exception : " + ex;
}
}
}
if( showLogin ) {
try {
showLogin = !security.hasPermission( request );
if( ! showLogin ) {
hasAdminRights = security.hasAdminPermission( request );
}
} catch( TicketIsExpired te ) {
additionalMessage = true;
message = "Warning - Users login has expired";
} catch( Exception ex ) {
additionalMessage = true;
message = "Exception - " + ex;
}
}
//System.out.println("showLogin"+showLogin);
// do we need to show login or not
if( showLogin ) {
%>
<html>
<body>
<FORM NAME="loginForm" ACTION="index.jsp" METHOD="post">
<center>
<%
if( additionalMessage ) {
%>
<b> <%= message %> </b><br>
<%
}
//System.out.println("showLogin"+showLogin);
%>
<br>
<br>
<center>
<table cellspacing="0" cellpadding="0" border="2" bordercolor="#60A0A0">
<INPUT TYPE='hidden' NAME='command' VALUE='login'>
<body>
<tr bgcolor="#60A0A0">
<td align="left" height="17"><font face="Verdana" color="white"><span
style="color: white; font-weight: bold; font-variant: normal; font-size: 10pt; text-align: left">
<center>
Creation Web Application
</center>
</span></font></td>
</tr>
<tr bgcolor="#60A0A0">
<td align="left" height="17"><font face="Verdana" color="white"><span
style="color: white; font-weight: bold; font-variant: normal; font-size: 10pt; text-align: left">Please
Login</span></font></td>
</tr>
<tr>
<td align="left" height="166">
<table border="0" height="116" width="460">
<tbody>
<tr>
<td height="16" width="70"></td>
<td height="16" width="87"></td>
<td height="16" width="164"></td>
<td height="16" width="136"></td>
</tr>
<tr>
<td height="25" width="70"></td>
<td height="25" width="87"><span
style="color: black; font-style: normal; font-family: Verdana; font-weight: bold; font-size: 10pt; text-align: center">Username:</span></td>
<td height="25" width="164"><input type="text"
name="User_Name" maxlength="20"
style="height: 25px; font-family: Verdana; width: 153px"></td>
</tr>
<tr>
<td height="1" width="70"></td>
<td height="1" width="87"></td>
<td height="1" width="164"></td>
<td height="1" width="136"></td>
</tr>
<tr>
<td height="25" width="70"></td>
<td height="25" width="87"><span
style="color: black; font-style: normal; font-family: Verdana; font-weight: bold; font-size: 10pt; text-align: center">Password:</span></td>
<td height="25" width="164"><input type="password"
name="Password"
style="height: 25px; font-family: Verdana; width: 153px"
maxlength="25"></td>
<td height="25" width="136"></td>
</tr>
<tr>
<td height="19" width="70"></td>
<td height="19" width="87"></td>
<td height="19" width="164"></td>
<td height="19" width="136"></td>
</tr>
<tr>
<td height="27" width="70"></td>
<td height="27" width="100"></td>
<td height="27" width="136">
<center><input type="submit" name="Login"
value="Login"
style="height: 25px; bottom: auto; right: auto; font-family: Verdana; background-color: #60A0A0; width: 62px; top: auto; left: auto"></center></td>
</tr>
<tr>
<td height="1" width="70"></td>
<td height="1" width="87"></td>
<td height="1" width="164"></td>
<td height="1" width="136"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</center>
</FORM>
</body>
</html>
<%
return;
}
%>
As you are saying This page is coming recursive way during my flow.
Try changing scope="page" to scope="request"
Or try renaming beanId to "orbinfra1"
<jsp:useBean id="orbinfra1" scope="session" class="com.ubsw.risk.Creation.web.OrbinfraBean" >
<jsp:setProperty name="orbinfra1" property="propertiesFile" value="<%=path%>"/>
</jsp:useBean>
I want to use Android java "emulate" a browser and post Login data. I tried this How to submit HTML form data (method=POST) using JAVA
But I failed.....
url:http://192.168.254.34/Control?id=1000
Here are the html source:
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>欢迎使用WLAN无线宽带</title>
<style><!--
a {text-decoration: none}
.f1 { font-size: 10.5pt; font-family: Verdana; line-height: 12pt }
.f2 { font-size: 8pt; font-family: Verdana; line-height: 12pt }
.btn {
BORDER-LEFT: #7b9ebd 1px solid;
BORDER-RIGHT: #7b9ebd 1px solid;
BORDER-TOP: #7b9ebd 1px solid;
BORDER-BOTTOM: #7b9ebd 1px solid;
PADDING-LEFT: 2px;
PADDING-RIGHT: 2px;
PADDING-TOP: 2px;
FONT-SIZE: 10.5pt;
CURSOR: hand;
COLOR: black;
FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde);
}
-->
</style>
<base href="http://192.168.254.34/pageset/131/PDA/">
</head><body topmargin="0" leftmargin="0">
<!-- 本地动态密码开始-->
<script>
function submitform2(){
if (form1.strAccount.value==""){
alert("请填入用户名!");
return;
}
form2.num.value=form1.strAccount.value;
form2.submit();
}
</script>
<iframe scr="about:blank" width="0" height="0" name="a"></iframe>
<FORM name="form2" method=post action="http://218.204.223.213:8080/cmpp/service.do?id=newuser" target="a">
<input size=12 type=hidden name="num" maxlength=26 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="14"></td>
<INPUT value="172.31.18.199" type=hidden name=ip>
</FORM>
<!-- 本地动态密码结束 --><form name=form1 method=post action="/Control?id=2000">
<center>
<table width=600 border=0 height=800>
<tr>
<td height=800>
<div align=center>
<center>
<table width=600 border=0 height=800 bgcolor=#FFFFFF cellspacing=0 cellpadding=0 style="border-collapse: collapse" bordercolor=#111111>
<tr>
<td height=800 width=600 background="a02.jpg" align="center">
<table border="0" width="288" cellspacing="0" cellpadding="0" height="97%">
<tr>
<td height="82" colspan="2">
<p align="center" class="f1">
</td>
</tr>
<tr>
<td height="295" align="center" colspan="2">
<table border="0" width="104%" cellspacing="0" cellpadding="0" height="106%">
<tr>
<td height="148" colspan="2">
<p align="center">
<font color="#333399" style="font-size: 10.5pt">
欢迎使用WLAN无线登陆页面</font></td>
</tr>
<tr>
<td width="32%" height="33" align="right" class="f1">
用户帐号</td>
<td height="33" width="68%">
<input name=strAccount maxlength=26 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="21"></td>
</tr>
<tr>
<td width="32%" align="right" class="f1">用户密码</td>
<td width="68%">
<input type=password name=strPassword maxlength=16 style="border:1px solid #999999; FONT-SIZE: 10.5pt; BACKGROUND: #ffffff; COLOR: #333399; FONT-FAMILY: verdana; 1px:" size="21"></td>
</tr>
<tr>
<td height="96" colspan="2" align="left">
<p align="center">
<input type="button" value="登 录" width="86" height="23" name="I1" onclick="javascript:form1.submit();" class="btn">
<input type="reset" value="重 置" width="86" height="23" name="I2" class="btn"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="f1" width="255">
<p align="center"> </td>
<td class="f1" width="33">
</td>
</tr>
<tr>
<td class="f1" height="91" width="255">
<p align="center" class="f1">
</td>
<td class="f1" height="91" width="33">
</td>
</tr>
<tr>
<td height="108" colspan="2">
<p align="center">
<br>
</td>
</tr>
</table>
</td>
</tr>
</table></center></div></td></tr></table></center></form></body></html>
the header I get:(use chrome)
Request URL:http://192.168.254.34/Control?id=2000
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:28
Content-Type:application/x-www-form-urlencoded
Cookie:JSESSIONID=45129DDCC372B780F65344DB9DB107FB
Host:192.168.254.34
Origin:http://192.168.254.34
Referer:http://192.168.254.34/Control?id=1000
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1
Query String Parametersview URL encoded
id:2000
Form Dataview URL encoded
strAccount:username
strPassword:password
Response Headersview source
Cache-Control:no-cache
Content-Length:2202
Content-Type:text/html;charset=GBK
Date:Mon, 08 Aug 2011 11:04:25 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:No-cache
Server:Apache-Coyote/1.1
Set-Cookie:intPageSetID=131; Expires=Mon, 08-Aug-2011 11:04:55 GMT
anybody know how to post login data?????????
Here's how I do it:
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("www.server.com/dologin.php");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("username", "KennyStarfighter");
nameValuePairs.add(new BasicNameValuePair("password", "SecretPassword");
nameValuePairs.add(new BasicNameValuePair("redirect", "?controller=login&view=loggedonpage"));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
HttpEntity he = response.getEntity();
Then I can for instance handle the response as XML.
xmlReader.parse(new InputSource(he.getContent()));
Use HttpClient. I can do the post and handle authentication. Doc here