Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Fresher Job


 

Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

Tutorials

Java Server Pages

JAXB

Java Beans

JDBC

MySQL

Java Servlets

Struts

Bioinformatics

Java Code Examples

Interview Questions

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting

Linux

Beginner Guide to Linux Server

Frameworks

Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers

Softwares

Adware & Spyware Remover

Open Source Softwares

Servlet service method
Expert:sri harsha
Hi EveryOne ,
I have a simple problem but i dont know whether the approach me going is correct or not, i will explain u my problem

I have two classes one is servlet and the other one is normal java class ,What i want to do is that i want to send path of the servlet from servlet to normal class .And in the second class(i.e normal java class) i want to get this path, i wrote the code for stand alone applications it is working fine but for servlet its not working

here is my servlet code....

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class TestServlet extends HttpServlet {
String path;
String path1="adadfafasfdsafasfasfasf";
public void service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
path=getServletContext().getRealPath("/");
Two t=new Two();

}
public String retPath(){
this.path1=path1;
return path1;
}
}

here is my normal java class


public class Two {
public Two(){
System.out.println("Called the Test With Class");
TestServlet one=new TestServlet();
String pathFromServet=one.retPath()
System.out.println("From the Test With Class---->"+pathFromServet);
}
}


is there any way to send the path from servlet to normal java class this is very urgent for me
Answers
Hi friend,


If You want to send the path from servlet to normal java class then

use Setting and getting JavaBean properties in JSP and after it set the path
in Java Bean Class and visit to :


http://www.roseindia.net/jsp/java-bean-example-jsp.shtml

Thanks




More Questions
Post Answers
 
Ask Question Facing Programming Problem?
Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.