Get Browser informations in JSP/Servlets

How can I get informations (name...) about the browser who call my servlet ??
Please help me

Hi,
Use the HTTP Request Headers
eg, to get the browser request the User-Agent header
request.getHeader("User-Agent");You can enumerate through headers
Enumeration headers = request.getHeaderNames();
while (headers.hasMoreElements()) {
String name = (String)headers.nextElement();
// the header name
out.print(name + ": ");
// the headers value
out.println(request.getHeader(name));
}Richard

Similar Messages

  • Can't get EntityManager access in JSP/Servlet

    Hi all,
    our team has started a EJB project (EJBs + JPA configurations)
    we managed to access the configured JPA (EntityManager etc) within the EJB instance; however we don't know how to access the EntityManager within JSP/Servlet
    Our project's structure:
    1 EJB project (EJB classes, EntityBean classes, JPA configuration + eclipselink)
    1 Web project (for JSP, Servlets)
    the main problem is ... we can't access EntityManager(s) in JSP / Servlets (and we already tried using Struts2.0 to replace servlets/jsp... the problem is the same... so it is not ... the matter of choosing the view technology...)
    Jason

    Hi Jason,
    How i tried to get EntityManager is as following:
    Suppose I want to define my Persistence unit like Following:
    *<Your-EAR>/APP-INF/classes/MyEmployee.java*
    "*MyEmployee.java*"
    package entityA;
    import java.io.Serializable;
    import org.apache.commons.lang.builder.EqualsBuilder;
    import org.apache.commons.lang.builder.HashCodeBuilder;
    import org.apache.commons.lang.builder.ToStringBuilder;
    import javax.persistence.*;
    @Entity()
    @Table(name="MYEMPLOYEE")
    public class MyEmployee implements Serializable {
         //default serial version id, required for serializable classes.
         private static final long serialVersionUID = 1L;
         private Long empno;
         private String empname;
    public MyEmployee() {
         @Id()
         @Column(name="EMPNO", unique=true, nullable=false, precision=22)
         public Long getEmpno() {
              return this.empno;
         public void setEmpno(Long empno) {
              this.empno = empno;
         @Basic()
         @Column(name="EMPNAME", length=15)
         public String getEmpname() {
              return this.empname;
         public void setEmpname(String empname) {
              this.empname = empname;
         public boolean equals(Object other) {
              if (this == other) {
                   return true;
              if (!(other instanceof MyEmployee)) {
                   return false;
              MyEmployee castOther = (MyEmployee)other;
              return new EqualsBuilder()
                   .append(this.getEmpno(), castOther.getEmpno())
                   .isEquals();
         public int hashCode() {
              return new HashCodeBuilder()
                   .append(getEmpno())
                   .toHashCode();
         public String toString() {
              return new ToStringBuilder(this)
                   .append("empno", getEmpno())
                   .toString();
    And I have Placed My "*persistence.xml*" file in *"<Your-EAR>/APP-INF/classes/META-INF/persistence.xml"*
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
         version="1.0">     
         <persistence-unit name="JPA_A_EJB" transaction-type="RESOURCE_LOCAL">
              <provider>org.hibernate.ejb.HibernatePersistence</provider>
              <class>entityA.MyEmployee</class>
              <properties>
                   <property name="hibernate.dialect" value="org.hibernate.dialect.OracleDialect"/>
                   <property name="hibernate.connection.driver_class" value="oracle.jdbc.OracleDriver"/>
                   <property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:xe"/>
                   <property name="hibernate.connection.username" value="jack"/>
                   <property name="hibernate.connection.password" value="password"/>
              </properties>
         </persistence-unit>     
    </persistence>
    ***********************************HOW I Access The Above Unit from my EJB mentioned Below*******************************
    "*EmployeeSessionBean.java*"
    package sfsbA;
    import entityA.*;
    import javax.ejb.*;
    import javax.persistence.*;
    @Stateless
    public class EmployeeSessionBean implements EmployeeSessionRemoteIntf
    *@PersistenceContext*
    protected EntityManager entityManager;
    *///NOTE: Using the Above Technique You can access the "EntityManager" Object in your Servlets As well...Just write the Above two Lines inside your Servlet*
    public void createEmployee(Long empno,String empname) throws Exception{
              System.out.println("\n\tcreateEmployee() called. EntityManager entityManager = "+entityManager);
              MyEmployee employee = new MyEmployee();
    employee.setEmpno(empno);
    employee.setEmpname(empname);
    entityManager.persist(employee);
              System.out.println("\n\t Entity Manager has persisted the Employee Information...");
    int count = 0;
    public EmployeeSessionBean() {
    System.out.println("\n\t EmployeeSessionBean--> EmployeeSessionBean() invoked");
    @Init("create")
    public void initMethod() throws CreateException {
    System.out.println("\n\t EmployeeSessionBean--> public void initMethod() invoked");
    @Remove(retainIfException=true)
    public void removeWithRetain() throws Exception{
    System.out.println("\n\t EmployeeSessionBean--> removeWithRetain() invoked");
    @Remove
    public void removeWithoutRetain() throws Exception{
    System.out.println("\n\t EmployeeSessionBean--> removeWithoutRetain() invoked");
    public String printRemoteIntf () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printRemoteIntf () invoked");
         return "ReplicableSFSRemoteObjectIntf";
    public String printLocalIntf () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printLocalIntf () invoked");
         return "ReplicableSFSLocalObjectIntf";
    public String printBean () {
    System.out.println("\n\t EmployeeSessionBean ---> public String printBean () invoked");
         return "EmployeeSessionBean";
    public int testIncrement() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int testIncrement() invoked");
    count=count+5;
    return count;
    public int testDecrement() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int testDecrement() invoked");
    count=count-2;
    return count;
    public int getCount() throws Exception
    System.out.println("\n\t EmployeeSessionBean ---> public int getCount() invoked");
    return count;
    "*EmployeeSessionRemoteIntf.java*"
    package sfsbA;
    public interface EmployeeSessionRemoteIntf {
    public void createEmployee(Long emono,String empname)     throws Exception;
    public void removeWithRetain()throws Exception;
    public void removeWithoutRetain() throws Exception;
    public String printBean ();
    public int testIncrement() throws Exception;
    public int testDecrement() throws Exception;
    public int getCount() throws Exception;
    *"ejb-jar.xml"*
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
    <enterprise-beans>
    <session>
    <ejb-name>EmployeeSessionBean</ejb-name>
    <business-remote>sfsbA.EmployeeSessionRemoteIntf</business-remote>
    <ejb-class>sfsbA.EmployeeSessionBean</ejb-class>
    <session-type>Stateless</session-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    *"weblogic-ejb-jar.xml"* (I am writing these file Just because i want my Own JNDI Simple name...Not the Container Generated Complex JNDI name)
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/90" xmlns:j2ee="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">
    <weblogic-enterprise-bean>
    <ejb-name>EmployeeSessionBean</ejb-name>
    <stateless-session-descriptor>
         <business-interface-jndi-name-map>
    <business-remote>sfsbA.EmployeeSessionRemoteIntf</business-remote>
    <jndi-name>EmployeeSessionBean</jndi-name>
         </business-interface-jndi-name-map>
    </stateless-session-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    "*application.xml*"
    <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
    <application>
    <display-name>JPAs_Demo_Jason</display-name>
    <module>
    <ejb>AccessEntityManager.jar</ejb>
    </module>
    </application>
    NOTE: The Jar "" Contains
    1). EmployeeSessionBean
    2). EmployeeSessionRemoteIntf
    3). META-INF/ejb-jar.xml
    4). META-INF/weblogic-ejb-jar.xml
    Thanks
    Jay SenSharma
    http://jaysensharma.wordpress.com  (Real WebLogic Stuff...Not less Than a Magic...Here)
    Edited by: Jay SenSharma on Dec 16, 2009 10:59 PM
    Edited by: Jay SenSharma on Dec 16, 2009 11:00 PM

  • How to get browser cookies in a servlet

    Hi,
    I need to use the browser cookie in my servlet, how can i get the browser cookies in a servlet
    Thanks in advance

    Thank you for ur reply, now i can create the cookies from the servlet,
    and now i need to create the cookies from the javascript, i have the code, and it can also create the cookies, but they can be accessible for Encrypted connections only, but the cookies which will be created from java servlets can be accessible for any type of connections,
    so please help me how to create cookies from the javascript and that should be accessible for any type of connections

  • Get Thread information in a Servlet

    Hi,
    I'm wondering if there is a way to get the running thread information in a Servlet, Something like an ID. For example, each time the Servlet receives a new request, the Servlet container will create a new thread to run the code, I want to know and log the information of this Thread.
    Any ideas?
    Thanks in advance

    Not sure why you want to know what thread it is. The container multi-threads for you. If you want to store a value for use later in the thread, use ThreadLocal. If you want to spin off other threads, J2EE frowns on this, but you can do so. I'm not at all clear why the name or ID is important, since it is normally arbitrary and implementation-dependent on the J2EE container. If you are simply trying to log which thread is doing what, Log4J and the Logging API allow you to specify a pattern that will include the thread name without any coding on your part. So, I am having trouble understanding why you think you have this requirement.
    - Saish

  • How to get an ArrayList Object in servlet from JSP?

    How to get an ArrayList Object in servlet from JSP?
    hi all
    please give the solution for this without using session and application...
    In test1.jsp file
    i am setting values for my setter methods using <jsp:usebean> <jsp:setproperty> tags as shown below.
    After that i am adding the usebean object to array list, then using request.setAttribute("arraylist object")
    ---------Code----------
    <jsp:useBean id="payment" class="com.common.PaymentHandler" scope="request" />
    <jsp:setProperty name="payment" property="strCreditCardNo" param="creditCardNumber" />
    <%-- <jsp:setProperty name="payment" property="iCsc" param="securityCode" /> --%>
    <jsp:setProperty name="payment" property="strDate" param="expirationDate" />
    <jsp:setProperty name="payment" property="strCardType" param="creditCardType" />
    <%--<jsp:setProperty name="payment" property="cDeactivate" param="deactivateBox" />
    <jsp:setProperty name="payment" property="fAmount" param="depositAmt" />
    <jsp:setProperty name="payment" property="fAmount" param="totalAmtDue" /> --%>
    <jsp:useBean id="lis" class="java.util.ArrayList" scope="request">
    <%
    lis.add(payment);
    %>
    </jsp:useBean>
    <%
    request.setAttribute("lis1",lis);
    %>
    -----------Code in JSP-----------------
    In testServlet.java
    i tried to get the arraylist object in servlet using request.getAttribute
    But I unable to get that arrayObject in servlet.....
    So if any one help me out in this, it will be very helpfull to me..
    Thanks in Advance
    Edward

    Hi,
    Im also facing the similar problen
    pls anybody help..
    thax in advance....
    Litty

  • New To Iplanet app server.Can some one help me getting started by delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with iplanet docs..didnt quite get it. thanx

     

    Hi,
    What is that you are trying to accomplish ? Is it deployment or
    trying to develop applications ? Are you getting any errors ? If so,
    please post them to help you. I think the documentation is the best place
    for you to begin with.
    Regards & Happy New Year
    Raj
    Arif Khan wrote:
    New To Iplanet app server.Can some one help me getting started by
    delpoying and calling one of each of these:JSP,Servlet,EJB.Tried with
    iplanet docs..didnt quite get it. thanx
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • Ias support for EJB, JSP/servlets,JDBC, connection pooling, XML, SOAP, load balancing etc

    Please let me know where I can find more information regarding iPlanet usage/deployment/configuring/tuning etc for support of technologies - like EJB, JSP/servlets, JDBC, connection pooling, XML, load balancing, JDBC & Transactions
    (I have already read the 'Getting Started with the iPlanet Application Server' part five and six - http://developer.iplanet.com/appserver/testdrive/partfive.jsp and partsix.jsp)(I am using the ias testdrive version).

    Hi,
    It's difficult to explain unless the J2EE architecture is understood. Also, explaining things like load balancing, Transactions, tuning, are bit vague and could blow the disk space of this site.
    To get started, the best way is to test the sample applications and the best part is you don't require internet connection to follow each steps. Install iWS and iAS, open browser, type in http://hostname:port/ias-samples/index.html. You can find links to the sample applications bundled. Please follow the steps given on deploying the application. This will enable you to a higher level.
    Regards
    Ganesh .R
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support

  • Using jFreeCharts with JSP-Servlet Web App

    Can someone please help me to get started on using the jFreeCharts in mt JSP Servlet we app? So far I have this in my servlet but I do not know what to do from here.
    protected void doPost(HttpServletRequest arg0, HttpServletResponse arg1) throws ServletException, IOException {
    //          create a dataset...
              double[][] data = new double[][] {
              { 1.0, 4.0, 3.0, 5.0, 5.0, 7.0, 7.0, 8.0 },
              { 5.0, 7.0, 6.0, 8.0, 4.0, 4.0, 2.0, 1.0 },
              { 4.0, 3.0, 2.0, 3.0, 6.0, 3.0, 4.0, 3.0 }
              //DefaultCategoryDataset dataset = new DefaultCategoryDataset(data);
              //return DatasetUtilities.createCategoryDataset("Series ", "Factor ", data);
              CategoryDataset dataset = DatasetUtilities.createCategoryDataset("Series ", "Factor ", data);
              JFreeChart chart = ChartFactory.createBarChart(
         "Bar Chart Demo 2", // chart title
         "Category", // domain axis label
         "Score (%)", // range axis label
         dataset, // data
         PlotOrientation.HORIZONTAL, // orientation
         true, // include legend
         true,
         false
         }

    the JFreeChart documentation has examples doing just that.
    And if you don't know how to get a browser to call some resource from some html you should get a beginner's tutorial to html.

  • JSP/SERVLETS NOT UNDERSTANDING JAAS SECURITY CONTEXT

    Hi ,
    Instead of using the default form action "j_security_check" for form based authentication
    .I have a custom JAAS loginmodule which is a servlet that gets calls when the
    user clicks on "OK" in the login form..
    Scenario1:
    I have a servlet(unprotected) which calls a EJB(which is protected).
    Depending on who has privileges to execute methods on the EJB bean , the authentication
    happens correctly..
    Scenario2:
    I have a PROTECTED servlet.
    When I execute the servlet in the browser , the login-form comes up .Once I click
    on OK,what is happening is I call my
    custom-loginmodule servlet which then calls the protected servlet.
    Now ..from the custom-loginmodule servlet when the request goes to the PROTECTED
    servlet ,the login-page again comes up...for some reason the servlets or JSPs'
    don't understand that the security context has already been created..
    But if the currently protected servlet is made unprotected and if it is made to
    call a protected EJB, the EJB bean gets the security context.
    I am thinking that security context is propagating but for some reason the JSP/servlet
    domain does not seem to get the already created security context.
    Another thing I noticed was with the default approach of using form-auth as "j_security_check"
    does not seem to work with URL rewriting.
    Any hints is greatly appreciated..
    Thanx,
    krish.
    Krishnan.Venkataraman
    Symphoni Interactive
    Technical Lead.
    [email protected]
    412 414 5385(mobile)
    412 446 2219(Work)
    1 800 439 7757 (# 2219) (Work)
    412 343 6549(Res)
    WEB:http://members.123india.com/krishnan

    hi,
    you may set a <servlet-mapping> in web.xml or you may use
    <form action="/servlet/HelloWorldExample" method=post>
    instead of
    <form action="/HelloWorldExample" method=post>
    the <servlet-mapping> should be:
    <web>
    <servlet>
    <servlet-name>HelloWorldExample</servlet-name>
    </servlet>
    <servlet-mapping>
    <servlet-name>HelloWorldExample</servlet-name>
    <url-pattern>/helloWorld.html<url-pattern>
    <servlet-mapping>
    </web>
    after you add the servlet-mapping, you can access the servlet with the url-pattearn, that is:
    <form action="/helloWorld.html" method=post>
    the internal operation of the first and second methods are different, and you should use second one(user servlet-mapping), and the <url-pattern> has may way to use, if you want learn more, see servlet spec. for more.

  • Extract HTML Meta information in the servlet ?

    Guys,
    I am using the following meta information in my HTML .
    <META HTTP-EQUIV="msisdn" CONTENT="99999999">
    <META HTTP-EQUIV="name" CONTENT="XXXXXXXX">
    However, I unable to extract the header information in my Servlet class using the
    String msisdn = request.getHeader("msisdn") and
    String name = request.getHeader("name");
    Can anybody please guide me ???

    No it is not a professional or meaningful(to you) reply. But I'd have to say its about what you deserved.
    You have to have patience on a forum like this. The community is not here to respond to your questions immediately. If you want an immediate answer, then you have to pay for one elsewhere. Bumping the topic after only 1/2 an hour demonstrates a lack of respect on your part, whereas if you had waited someone would probably eventually have taken a look at it, and known enough to give you a response. I would bump it after a day or two if nobody had responded.
    Its basic forum etiquette. Useful link on [how to ask questions the smart way|http://www.catb.org/~esr/faqs/smart-questions.html]
    'nuff said.
    Now with regards to your question, if I understand correctly the <meta> tags are the equivalent of response headers to the html. ie they are information sent to the browser to be used for rendering the page. Not bits of information to send with the next request.
    So having <META> tags on your page won't result in anything you can read in your servlet.
    Cookies are the normal way that you get the browser to send information to a server for you.
    Cheers,
    evnafets

  • How to get DBconnection from a custom servlet

    Hi all:
    In my JHeadstart Struts application, if we will using javascript to call a custom servlet program when some html event occur,
    than how can we get db connection in our Servlet because we need get some database data through this Servlet,
    we hope this Servlet can share dbconnection pool with JHeadstart that is consider for performance issue.
    thanks a lot !

    Ting Rung,
    JHeadstart is based on the Model-View-Controller (MVC) principle. This means that the Model layer is responsible for communication with the database (and thus database connection pooling). Accessing the database directly from a JSP or Servlet is against the principles of MVC. JHeadstart uses BC4J as the technology to implement the model layer. By going through an BC4J Application Module to do some database action (for example calling a stored procedure as you mentioned in another thread) you automatically get the database connection pooling.
    So, in the JHeadstart philosophy, we do not access the database from a servlet, instead we would do the following:
    - write a method on the BC4J app module that performs the database action
    - add a method to the apporpriate handler that calls this AM method
    - write a custom Struts action that calls the handler method
    Having said this, nobody will stop you from doing database access in a servlet. But JHeadstart might not be the right choice for you if you do not want to stick with the principles of MVC.
    Here is a link that provides you with some more background information about MVC, may be it can help you deciding what the best approach for your application is:
    http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier5.html
    You can also "google" on model-view-controller if you like.
    Steven Davelaar,
    JHeadstart Team.

  • Different Classloader for JSP, Servlets?

    Hi!
              Does the WL5-JSP-servlet use an other classloader then the other
              servlets??
              I've previous posted an article with the subject "JSP - Servlet - Static
              Code in Classes".
              I will try to describe my problem better:
              At server startup I pass information to my startup servlet, for example
              the user and pw for our connection pool. The startup servlet instanciates
              the class Global which creates a db-pool with the user and pw getting
              from
              the startup-servlet.
              startup-servlet {
              public void init(ServletConfig config)
              Global.init("user","pw");
              The class Global looks like this:
              class Global {
              static {
              // register jdbc driver
              // store file informations
              static public init(string, string) {
              // init the connection pool with user and pw
              static public getConnection() {
              // returns connection from pool
              All our other servlets then just use the methode Global.getConnection()
              and other methods from the class Global.
              All servlets works perfect and can access the db-pool.
              When a jsp-file is called which also uses the methode
              Global.getConnection(), a new Instance of the class Global will be made.
              In order to init all values again, I would have to call the
              Global.init(user, pw) methode again.
              So my question is: Why does the jsp file causes a new instance of the
              class Global?
              Does the WL5-JSP-servlet use an other classloader then the other
              servlets??
              

    I am seeing the problem is sp3. I can't use sp4 becuase form based
              authentication, FBA, was broken. I can only hope that FBA will be
              re-fixed in sp5.
              Kumar Allamraju wrote:
              >
              > If you are seeing this problem in SP4, yes this is a regression in SP4 &
              > SP5. We are already aware of this
              > problem. SP5 will be out in a week or so. But this fix won't be available
              > in SP5. Follow-up with
              > support.
              >
              > --
              > Kumar
              >
              > "Bryon G. Rigg" wrote:
              >
              > > I have an application which has a servlet that controls page navigation
              > > via an xml file. The servlet class is located beneath the
              > > WEB-INF/classes as is the xml file. When I have weblogic pointing to
              > > the app directory, my servlet finds the xml file, using the
              > > Class.getResourceAsStream() method, without a hitch. But when I
              > > package everything up into a war file, and point weblogic at the war
              > > file instead, the servlet can not locate the xml file.
              > >
              > > What gives? Is there some kind of brain-dead classloader being used
              > > for war files versus a normal classloader used for directories? Any
              > > workarounds? And when will sp5 be released? I have been hearing a
              > > week or two for weeks.
              [bryon.vcf]
              

  • Conversion of Vedio file to FLV using Java/JSP/Servlets/Struts

    Hi all,
    This is N.Sridhar and I am working on file transcoding.Does any one have any idea about video conversion tools/API which can be used to programitically with JSP/Servlets/Struts or Java to convert any video file to FLV so that it can be viewed in the Web Browser.Kindly let me know if any one of u have worked on it.You can also get me at [email protected]
    Thank you all
    Sridhar.N

    Hi all,
    This is N.Sridhar and I am working on file transcoding.Does any one have any idea about video conversion tools/API which can be used to programitically with JSP/Servlets/Struts or Java to convert any video file to FLV so that it can be viewed in the Web Browser.Kindly let me know if any one of u have worked on it.You can also get me at [email protected].
    Thank you all
    Sridhar.N

  • Examination system using JSP/SErvlet and MySQL

    Hi
    I am new to JSP /servlet.
    I am designing online examination system using JSP/Servlet and MySQL ,where multiple choice questions would be selected randomly from the database. After completion of the examination user gets the results ,also the results would be stored in the database for the future reference.
    Can anyone guide me for this? If possible give me the code for similar type of application.
    Thanks

    Sounds like you want someone else to do your homework for you, did you not read this:
    "This forum works so much better when you try to program the code yourself, then let us know where it doesn't work. Otherwise you learn very little, and we work a whole lot."
    and this
    "If you want free code, have you tried searching Google for it? You may want to consider looking for survey software. It will give you the question/answer capabilities then all you have to do is find a way to grade the survey (if you will)...
    If you are using Tomcat as your server, which you probably are, there is a jdbc tutorial included in the documentation, that is the fastest way to set up your database.
    As for your random selection, have a look at Math.random(), this is one way to generate random numbers, you will need an algorithm to convert this value (between 0.0 and 1.0) into a form that can be used to select information from your database.

  • Get client information

    Hello...
    I want to write servlet which get client information
    IP,OS,DATE,TIME,BROWSER,SCREEN SIZE, COUNTRY and send all information
    on server.
    If source code possible plzzz give me..
    thankx in advance...

    If you write a HttpServlet (just subclass it) you have the request as a HttpServletRequest. From this object you can get information such a browser etc. Try (inside your servlet code):
    PrintWriter out = res.getWriter();
    out.println("<HTML><BODY>");
    out.println("<H1>Client information</H1>");
    out.println("<B>Client address: </B>" + req.getRemoteAddr() + "<BR>");
    out.println("<B>Client host: </B>" + req.getRemoteHost() + "<BR>");
    out.println("<B>Client user: </B>" + req.getRemoteUser() + "<BR><BR>");
    out.println("<B>Server name: </B>" + req.getServerName() + "<BR>");
    out.println("<B>Server port: </B>" + req.getServerPort() + "<BR>");
    out.println("<B>Requested URL: </B>" + req.getRequestURL().toString() + "<BR>");
    out.println("<B>Path info: </B>" + req.getPathInfo() + "<BR>");
    out.println("<B>Method: </B>" + req.getMethod() + "<BR>");
    out.println("<B>Protocol: </B>" + req.getProtocol() + "<BR>");
    out.println("<B>Query string: </B>" + req.getQueryString() + "<BR><BR>");
    out.println("<B>Session ID: </B>" + req.getRequestedSessionId() + "<BR>");
    out.println("<B>Valid session: </B>" + req.isRequestedSessionIdValid() + "<BR>");
    out.println("<B>Secure connection: </B>" + req.isSecure() + "<BR>");
    out.println("<B>Authentication type: </B>" + req.getAuthType() + "<BR>");
    out.println("<B>Character encoding: </B>" + req.getCharacterEncoding() + "<BR>");
    out.println("<B>Content length: </B>" + req.getContentLength() + "<BR>");
    out.println("<B>Content type: </B>" + req.getContentType() + "<BR>");
    out.println("<B>Context path: </B>" + req.getContextPath() + "<BR>");
    out.println("</BODY></HTML>");
    Where req and res are the HttpServletRequest and HttpServletResponse objects passed to your servlet with doGet() or doPost().
    If if doesn't work out for you - give me you e-mail and I'll send over a complete example. Please notice that screen resolution etc. isn't available in the request object. For that you need to get them with for example JavaScript and then send then as parameters to the servlet.
    Good luck!

Maybe you are looking for

  • The connection was reset + Secure connection failed

    Hello, I am using firefox on the web and I keep encountering the same error message that the connection was reset when I try to access webpages. Following the article at https://support.mozilla.org/en-US/questions/1024256 did not solve the problem as

  • Slideshow quality is poor

    Successfully completed a many menued slideshow. On screen colour and clarity is great. When burnt to DVD, quality is quite terrible. Contrast is too high and sharpness and detail is reduced. Looks like the rendering from computer to DVD is loosing to

  • Converting SVG's to PNG's

    Hi So I'm trying to convert all these SVG's to PNG's via ImageMagick. If I'm not wrong, the command is 'convert -define /path/to/icon.svg /path/to/icon.png'. Well that takes a long time with all those icons in yasis, so I thought that a script would

  • Difference - PB00 and PBXX

    Hello Can somebody help me to identify the difference between condition type PBXX and PB00. Why is it that, SAP has given two condition types? What is the significance of access sequence for these two condition types? Thanks for all your help. Best R

  • How do I cancel a storage subscription for iCloud please?

    How do I cancel a subscription for iCloud storage please?