Getting Parameter from a css styled jsp file to a java servlet file...
This is my code....
login page--
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">
<head>
<!--
Created by Artisteer v3.0.0.39952
Base template (without user's data) checked by http://validator.w3.org : "This page is valid XHTML 1.0 Transitional"
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Login Page</title>
<meta name="description" content="Description" />
<meta name="keywords" content="Keywords" />
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="style.ie7.css" type="text/css" media="screen" /><![endif]-->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text" src="NewServlet"></script>
</head>
<body width="100%" height="100%">
<div id="art-page-background-glare">
<div id="art-page-background-glare-image"> </div>
</div>
<div id="art-main">
<div class="art-nav">
<div class="art-nav-l"></div>
<div class="art-nav-r"></div>
<div class="art-nav-outer">
<div class="art-nav-wrapper">
<div class="art-nav-inner">
</div>
</div>
</div>
</div>
<div class="cleared reset-box"></div>
<div class="art-header">
<div class="art-header-clip">
<div class="art-header-center">
<div class="art-header-png"></div>
<div class="art-header-jpeg"></div>
</div>
</div>
<div class="art-header-wrapper">
<div class="art-header-inner">
<div class="art-headerobject"></div>
<div class="art-logo">
<h1 class="art-logo-name"><font size="10" face="Palatino Linotype">C.A.G. </font></h1>
<h2 class="art-logo-text"><font size="8" face="Palatino Linotype">Problem Solution Book</font></h2>
</div>
</div>
</div>
</div>
<div class="cleared reset-box"></div>
<div class="art-sheet">
<div class="art-sheet-tl"></div>
<div class="art-sheet-tr"></div>
<div class="art-sheet-bl"></div>
<div class="art-sheet-br"></div>
<div class="art-sheet-tc"></div>
<div class="art-sheet-bc"></div>
<div class="art-sheet-cl"></div>
<div class="art-sheet-cr"></div>
<div class="art-sheet-cc"></div>
<div class="art-sheet-body">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content">
<div class="art-post">
<div class="art-post-tl"></div>
<div class="art-post-tr"></div>
<div class="art-post-bl"></div>
<div class="art-post-br"></div>
<div class="art-post-tc"></div>
<div class="art-post-bc"></div>
<div class="art-post-cl"></div>
<div class="art-post-cr"></div>
<div class="art-post-cc"></div>
<div class="art-post-body">
<div class="art-post-inner art-article">
<div class="cleared"></div>
<div class="art-postcontent">
<div id="login-box">
<h2 class="art-postheader">
<img src="./images/postheadericon.png" width="22" height="21" alt="" />LOGIN
</h2>
<div id="login-box-name" style="margin-top:10px;">Email:</div><div id="user" style="margin-top:10px;"><input type="text" name="user" value="" size="30" maxlength="2048" /></div>
<div id="login-box-name" style="margin-top:10px;">Password:</div><div id="pass" style="margin-top:10px;"><input type="password" name="pass" value="" size="30" maxlength="2048" /></div>
<br />
<a href="NewServlet"><img src="images/images.jpg" width="103" height="42" style="margin-left:90px;" /></a>
</div>
</div>
</div>
<div class="cleared"></div>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
<div class="art-layout-cell art-sidebar1">
<div class="art-block">
<div class="art-block-body">
<div class="art-blockcontent">
<div class="art-blockcontent-body">
<p></p>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
</div>
</div>
<div class="cleared"></div>
<div class="art-footer">
<div class="art-footer-t"></div>
<div class="art-footer-l"></div>
<div class="art-footer-b"></div>
<div class="art-footer-r"></div>
<div class="art-footer-body">
<a href="#" class="art-rss-tag-icon" title="RSS"></a>
<div class="art-footer-text">
<p>Copyright �© 2012. All Rights Reserved.</p>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared"></div>
</div>
</div>
<div class="cleared">
<p class="art-page-footer">Design & Developed by www.cmcltd.com</p></div>
</body>
</html>
java servlet file--
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author 3688895
*/
public class NewServlet extends HttpServlet {
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
String us= request.getParameter("user");
String ps= request.getParameter("pass");
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet NewServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>");
out.println(us);
out.println(ps);
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
Output--
Servlet NewServlet at /WebApplication2
null null
Why is it not getting the parameter??? How do i accept the value in the servlet file???
View Answers
January 18, 2012 at 4:04 PM
Related Tutorials/Questions & Answers:
Getting file size - JSP-ServletGetting file size Hello friends,
I am doing a
jsp project... type information
from JSP Request Header
String contentType... Uploading in
JSP
Choose the
file To Upload
Advertisements
Getting File path error - JSP-ServletGetting File path error I have a requirement where i need to get certain properties on application login page start itself. I an currently using
String str = request.getRealPath("/")+"a" + System.getProperty( "file.separator
write to file from servlet - JSP-Servletwrite to
file from servlet Hi,
I have a
jsp file where I input data and retrive data through
servlet. However; when I edit data it is not showing right data on the web site. I am also trying to write this data to
file retrieving of value from excel file - JSP-Servlet this message to all the employees when i upload a
file then it fetch a data
from... now i want a single content that should take the
parameter values
from the excel
file so please help me how to take a
parameter after uploading a
file...
Thanks
retrieving of value from excel file - JSP-Servlet this message to all the employees when i upload a
file then it fetch a data
from... now i want a single content that should take the
parameter values
from the excel
file so please help me how to take a
parameter after uploading a
file Generated java file - JSP-ServletGenerated
java file Hello friends,
At run time
JSP files will be translated as
JAVA SERVLET files.
I got this error at run time... in the generated
java file
Syntax error on token ";", delete this token
retrieving of value from excel file - JSP-Servletretrieving of value
from excel file Dear sir,
Thanks for sending a code now i am
getting a particular column value i.e EmailId column for snding a massmails,now i have to get a particular column values i.e Name(A),EL(B
Generated java file - JSP-Servlet to compile class for
JSP:
An error occurred at line: 7 in the generated
java file...Generated
java file Hello friends,
At run time
JSP files will be translated as
JAVA SERVLET files.
I got this error at run time
jsp file - JSP-Servletjsp file org.apache.jasper.JasperException: /
jsp/admin/UserRegistration.jsp(155,4) According to the TLD or the tag
file, attribute valu
e... ERROR [[action]] Servlet.service() for
servlet action threw exception
not able to get values from jsp file - JSP-Servletnot able to get values
from jsp file hi thanks for u feedback,
her am sending the
file jsp and
servlet but in the
servlet file am not able to get... remove encrtype
from form tag its work fine
please go through the
file callig jsp file from javascript function - JSP-Servletcallig
jsp file from javascript function I want to call a
jsp file... data, no button and no links.
Is it possible to call
jsp page
from static html... to call either
jsp pge or html page
from one html form.
even u dont need to open
pass parameter - file - Java Beginnerspass
parameter - file Hi, I want to pass paramter
file to method...,
If you are working with the
JSP and
Servlet then this code can be understood immediately.
file.jsp
==========
File Parameter Use
File uploading - JSP-ServletFile uploading i am using
file uploading code for multiple
file and aslo for single
file but i am
getting problem that No such
file found....
http://www.roseindia.net/
jsp/
file_upload/Sinle_upload.xhtml.shtml
file uploading - JSP-Servletfile uploading Hi, thanks a lot for your kind answer. Now my program is running after I add the "
servlet-api.jar" lib. Now, im facing another problem. Im not geeting the full output for the program. Even, the
file getting values from database - JSP-Servletgetting values
from database I tried the following code
abc.html
aaa.jsp
I am not
getting exceptions now. But I am not
getting output also.
Plz help.
Hi Friend,
Run your
Sending File - JSP-ServletSending File How to use tag in
Jsp, & How read a
file fom Client Hi Friend,
We used tag to upload a
file.
Please visit the following links:
http://www.roseindia.net/
jsp/fileupload.shtml
http
file size - JSP-Servlet coding in the roseindia at the following url:
http://www.roseindia.net/
jsp/
file_upload/Sinle_upload.xhtml.shtml.
But, this
jsp action
file will not check....
http://www.roseindia.net/
jsp/
file_upload/employee_upload_profile_image.shtml
File upload - JSP-ServletFile upload Hello Friends,
In my
JSP project i want...;%
//to get the content type information
from JSP Request Header
String...
File Uload Using
JSP
Choose the
file To Upload
File upload - JSP-Servlet type information
from JSP Request Header
String contentType...
File upload I am trying to do a
file upload program. But, it shows... that.
1.Input
file sending program
FILE UPLOADING - JSP-ServletFILE UPLOADING Hi ,
I want Simple program for
file upload using html and
servlet
plese help me hi friend pls try this code
**********
try{
String type="";
String boundary="";
String sz
.cvs file - JSP-Servlet.cvs file how can i update the contents of .cvs(coma seperated)
file to database? reading of cvs
file and insert each value in database. how can i update the contents of .csv(coma seperated)
file to database? reading
delete a file - JSP-Servletdelete a file How can we read a
file which is stored in a server when read write operations for this particular
file is closed
File Upload - JSP-ServletFile Upload Hi everyone,
I am facing
file uploading problem.the multiple
file upload code of roseindia is working on localhost but the same code is not working on server.i think the package commons-fileupload-1.2.jar
delete a file - JSP-Servletdelete a file Correct question::::How can we delete a
file which is stored in a server when read write operations for this particular
file is closed. http://www.communigate.com/CommuniGatePro/WebFiles.html
file uploadind - JSP-Servletfile uploadind had pasted the provided 2 files(1.index_single_upload.jsp, 2.Sinle_upload_page.jsp) for
file uploading it is showing errors in the apache tomcat like
"content type cannot be resolved to a type"
pls help
Dbclass.java file - JSP-Servlet = "select empid
from new_user";
stmt = con.createStatement... password
from new_user";
stmt = con.createStatement();
rs... vsql="select max(Deptcode)+1 as Deptcode
from Department";
stmt
Image upload file - JSP-ServletImage upload file I want a code for image upload
jsp or
servlet. Hi friend,
For image upload
jsp or
servlet visit to :
http://www.roseindia.net/
jsp/
file_upload/employee_upload_profile_image.shtml
http
JSP file download - JSP-ServletJSP file download Hi!
I am saving (webapp/docs/sample.docx) path of the word
file in database. when i want to download that
file i am eliminating...
file_data
from file ");
if(rst.next())
{
Content=rst.getString("
file_data
Multiple file Uploading - JSP-Servlet() for
servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for
JSP:
An error occurred at line: 9 in the generated
java file...Multiple
file Uploading Hello everyone
I am using
jsp and my IDE
File Upload in FTP - JSP-ServletFile Upload in FTP hi sir,
i am doing upload files in FTP using
java application.
is there any jar
file to use the privileges of sun.net.ftp.
i am writing my program in
java servlet. i am
getting errors like
1.cannot Find
bad class file - JSP-Servletbad class file (
from the
JAVA SERVLET PROGRAMMING - O'Reilly) and got a "bad class
file...): myservlet.java:9: cannot access HttpServlet bad class... api.jar
file that you have downloaded
from class path.Find
servlet-api.jar
from file upload error - JSP-Servletfile upload error Hello friends,
In my project when i am trying to upload a
file i used the roseindia.net coding
from URL:
http://www.roseindia.net/
jsp/
file_upload/employee_upload_profile_image.shtml
creating a jar file - JSP-Servlet a servlet.class
file in classes folder
2. web.xml
file
my questions are
1. where to place the html or
jsp files
2. how to create a jar
file and how can i create it for a single servlet.class
file
how can i run my
servlet file getting contacts from gmail - JSP-Servletgetting contacts
from gmail hi there,
would you please tell me step by step how can i integrate the gmail contacts with my web application. please reply me asap. I'll be greatfull to you.
Rajesh
file upload error - JSP-Servletfile upload error Iam doing
jsp project.
File uploading is one part...,
I think jar problem. so Please add
servlet-api.jar
file in lib folder...
file while checkin
file size.
I am not able to understand this problem