File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Login application B from application A Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Login application B from application A" Watch "Login application B from application A" New topic

Login application B from application A

Caly LeeAnn
Ranch Hand

Joined: Nov 22, 2005
Posts: 55
I have application A (A.war) and application B (B.war) deployed in my JBoss server. There is a page at application A that I can choose a product and click the button GO. And it is supposed to direct me to the login page at application B. The product information needs to be carried on to the login page.

Currently I am using HttpURLConnection to send a request to the servlet bServlet at application B. And I got the following exception: http://localhost:8080/B/bServlet
at Source)
at productServlet.doPost(

Line 250: BufferedReader brd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line = null;
StringBuffer sb = new StringBuffer();
while ((line = brd.readLine()) != null) {
// Process line...
System.out.println(">>>received: " + line );
sb.append( line );

I think the reason of the exception thrown is that the bServlet doesn't have a output stream to write back to productServlet. But if I comment out the above code, it seems bServlet doesn't receive the request since the testing printout at bServlet doesn't show up. How should I solve this problem?

Are there any other ways to implement what I describe at the first paragraph? Thank you.

PS. When I put http://localhost:8080/B/bServlet at the url of the browser, it shows the information correctly.
I agree. Here's the link:
subject: Login application B from application A
It's not a secret anymore!