How to call a servlet in SessionBean in Netweaver
i have to a call a servlet in my sessionbean
i am using "netweaverdeveloperstudio"
tell me the procedure
thanq
Guru
Hi Guru,
I´ve read the other threads you´ve opened regarding this issue. You should better describe what you want to do. In my opinion you want to do something that can´t be solved in the way you want to do it.
Do you really want to open a browser at serverside? If you open a browser who should respond to the output?
Is the server OS Windows?
What results do you expect from the servlet. If the servlet just responses data that you want to process, you should, like I already mentioned, open a http connection.
Have a look at
http://java.sun.com/j2se/1.4.2/docs/api/java/net/URLConnection.html
and
http://java.sun.com/j2se/1.4.2/docs/api/java/net/HttpURLConnection.html
for more details.
Regards
Helmut
Similar Messages
-
How to call a servlet in new window without toolbar from OA page
How to call a servlet in new window without toolbar from a OA page?Please provide sample code
I have tried with the way suggested in Mukul's blog using javascript in Destination URI property.
I tried to open a OA Page and from which forwarded it to a servlet..
It is showing the error:
Error Page
Exception Details.
oracle.apps.fnd.framework.OAException: The application id or shortname () you entered does not exist.
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1223)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1969)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
at oa_html._OA._jspService(_OA.java:86)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162)
at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:175)
at oa_html._OA._jspService(_OA.java:96)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534)
## Detail 0 ##
oracle.apps.fnd.framework.OAException: The application id or shortname () you entered does not exist.
at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getAppId(OAWebBeanFactoryImpl.java:5391)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:969)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
at oa_html._OA._jspService(_OA.java:86)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162)
at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:175)
at oa_html._OA._jspService(_OA.java:96)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534)
oracle.apps.fnd.framework.OAException: The application id or shortname () you entered does not exist.
at oracle.apps.fnd.framework.webui.OAWebBeanFactoryImpl.getAppId(OAWebBeanFactoryImpl.java:5391)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:969)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:502)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:423)
at oa_html._OA._jspService(_OA.java:86)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162)
at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:175)
at oa_html._OA._jspService(_OA.java:96)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:385)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java:259)
at oracle.jsp.JspServlet.internalService(JspServlet.java:178)
at oracle.jsp.JspServlet.service(JspServlet.java:148)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
at org.apache.jserv.JServConnection.run(JServConnection.java:294)
at java.lang.Thread.run(Thread.java:534) -
How to call a servlet by java standalone application
//program related to calling a servlet by java standalone application and printing the response on console
import java.io.*;
import java.util.*;
import java.lang.Object;
import java.net.*;
public class Program
public static void main(String s[])
System.out.println("Hello this programm defines about how to call a servlet with a java application ");
try{
URL servlet = new URL("http://localhost:8080/anchor/studentform.html");
URLConnection conn=servlet.openConnection();
conn.setDoOutput(true);
InputStreamReader isr=new InputStreamReader(conn.getInputStream());
BufferedReader br = new BufferedReader(isr);
String str =br.readLine();
System.out.println("Source code is" +str);
catch(IOException e)
System.out.println("exception is" +e);
i am able to read only one line of the form, please help me out to read the whole form (file)You are only reading one line? Why aren't you reading the data in a loop? E.g. a while loop. (Keep reading till readLine returns null)
Kaj -
How to call a servlet from another servlet
hi everybody,
i have a problem, i have to call one servlet from another one.
Everything works on my pc, but when i install the application on the customer's server i got an error about an Uknown URL followed by the name of the machine.
Wjat i do is the folloqing :
String urlString = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/"+servletName;
URL url = new URL(urlString);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
the variable servletName is the name of the servlet i have to call.
Is there another way to call the servlet ?
All the servlet are installed in the same server.
Any suggestion ?
Cheers.
StefanoSweep is correct about requestDispatcher being another approach for inter-servlet delegation; the only issue that i recall with this approach is that it defaults the method of the destination servlet to the one it was called from...for example, calling servlet2 from within servlet1.post() resulted in the dispatcher attempting to utilize servlet2.post() - i believe that i searched for a parameterize solution to no avail :( (ended up handling the request by placing a "fake" doPost() in servlet2 that simply called servlet2.doGet())
however, if your application is functioning correctly on your pc/webserver then the problem may be external to servlet communication (e.g. client webserver's ports not configured or blocked, missing runtime classes, etc.)
my suggestion would be to set aside the programmatic concerns for the moment - what is the response if you open a browser on a client's machine and access the URL in question (i.e. http://clientserver:port/stefanoServlet)? If it will not respond to access in this manner then it certainly won't when your application calls for it.
It's possible that there is a coding error but, given the info supplied, i'd start examining the environment, first. Let us know if you have any luck with the test i recommended or not (please provide abundant detail). Or, if you've found the solution then you may want to post back with a quick blub so the next person knows how to escape the trap.
D -
How to call a servlet in a Session Bean
Hi All
I have one servlet program.And i have One Sessionbean.
I want to call the servlet in the session bean.
I am using Runtime method in java to call the servlet by giving it's full
path as it's argument.
But it is not working fine.I don't know what is the Problem.
Bye
SatyamHi,
I don't know why you want to do that? You should be doing the other way round i.e. call your session bean from servlet.
I must say that servlets are presentation tier components and session beans are middleware components related to workflow.
HTH
VJ -
How to call a servlet from Webdynpro application
Hi All,
I am new to SAP . I have requirement to call a SERVLET which is on a different application server from my webdynpro application , the servlet will return a file .. i need to display that file to the user .. can some one tell me how this can be done .. If possibel please provide some sample code.
Regards,
Tarun.Hi
Check this
1. How to access Servlet information from a webdynpro application ?
Regards
Abhijith YS -
How to call jsp /servlets running in different web application in tomcat
hello all,
i have 2 web applications(Charts and Reports) in the same tomcat,i want to call jsp/servlets running in the Reports webapp from Charts webapp.how do i achieve this.
thanx
raviYou can also use getContext(String context) in the ServletContext class to get a request dispatcher.
Using the above example it would be :
// in a servlet in the charts webapp
ServletContext context = getServletContext();
ServletContext reportsContext = context.getContext("/reports");
RequestDispatcher dispatcher = reportsContext.getRequestDispatcher("/path")
dispatcher.forward(request, response);Just note, that depending on your server's configuration getContext(...) might return null. -
How to call bapi_transaction_commit in my sessionBean when icreated sales o
hi,
how to call bapi_transaction_commit
when i am creating salesorder by BAPI_SALESORDER_CREATEFROMDAT2.
After Callng that bapi i want to commit the transaction
For that i want to know how to call TransationbapiHi kalasker,
1. just like this.
DATA : ret LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'
IMPORTING
return = ret.
regards,
amit m. -
How to calling another servlet in a servlet
In my servlet named TransferServlet I want call another servlet named PublisherServlet. So I wrote codes :
objURL = new URL("http://localhost:8080/servlet/PublisherServlet") ;
hucConnection = (HttpURLConnection)objURL.openConnection() ;
hucConnection.setDoOutput(true) ;
hucConnection.setUseCaches(false) ;
hucConnection.setRequestMethod("POST") ;
hucConnection.connect() ;
but i can't invoke PublisherServlet. Why ? pls help
Thanks a lotyou do not need hucConnection.connect(); hucConnection = (HttpURLConnection)objURL.openConnection() does this.
You need to use hucConnection.getOutputStream() and write to the stream to post and if you wanted a response you would need to read from hucConnection.getInputStream() -
How to call a servlets specific function from a link?
hi all ! Im trying to call a function callled A from a link in my JSP. Im not using any buttons. How do I make this work?
Thanks in advance.Hi,
A solution to call A might include a custom JSP element. Inside the code for the
element, you can get a reference to whatever object that "does an A", and make a call on the respective method/function/behavior. You need to extend the standard tag handler classes.
Good luck! -
Newbie question : How to call a servlet from JSP?
my web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Test</display-name>
<description>
Test
</description>
<servlet>
<servlet-name>Test1</servlet-name>
<servlet-class>Test1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Test1</servlet-name>
<url-pattern>/test1</url-pattern>
</servlet-mapping>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Group</web-resource-name>
<!-- Define the context-relative URL(s) to be protected -->
<url-pattern>/jsp/security/protected/*</url-pattern>
<!-- If you list http methods, only those methods are protected -->
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>PUT</http-method>
</web-resource-collection>
<auth-constraint>
<!-- Anyone with one of the listed roles may access this group -->
<role-name>tomcat</role-name>
<role-name>role1</role-name>
</auth-constraint>
</security-constraint>
<!-- Default login configuration uses BASIC authentication -->
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Example Basic Authentication Group</realm-name>
</login-config>
</web-app>my index.html
<html>
<body>
<a href="/test1">test</a>
</body>
</html>I put my Test1.class in ../WEB-INF/classes.
When I click the link for test1, I got the following message
HTTP Status 404 - /test1
type Status report
message /test1
description The requested resource (/test1) is not available.
Apache Tomcat/4.1.18-LE-jdk14please help. thanksHi,
You have not said if your servlet is in a package in which case which one.
you need to add the '/servlet/' to the href so it becomes
'/servlet/test1'.
Phil -
How to call java servlet using webservice in webdynpro abap?
hi all,
we have a requirement to connect to non - sap database through webservices. But they do have a java servlet which has a data to get. please help me in this regard.
Regards,
Murthy.This is not a web dynpro ABAP related question. Please only post questions in this forum that are directly related to Web Dynpro ABAP.
-
How to call a servlet from java?
your help is greatly appreciated..Welcome to the forum
You seem to be misunderstanding something. Do some googling to learn what you need about servlets. Simplified, servlets are java code that's hosted by a web container, such as Tomcat. When a servlet gets called as a consequence of someone requesting a url from the container, it takes in a request object and a response object. All the magic is then in creating an appropriate response (e.g. html) for the incoming request. -
How to call a Servlet file from a Stored Procedure?
You need to make an http request to the web server where the servlet is running. To do this you have two options:
Using object automation stored procedures (sp_OA* procedures) to create and call MSXML2.XMLHttp COM objects.
Create a CLR stored procedure that uses HttpWebRequest class.
On the other side. Making web request from stored procedures is the last resort. Have you considered other alternatives to solve the bussines problem at hand?
For example Service Broker can be an alternative for that kind of problems. The stored procedure sends a message to the queue. An external program reads messages as it arrives to the queue and process them. The external program can be written in Java and
can run in the web server where the servlet runs.
EntityLite: A Lightweight, Database First, Micro ORM -
Calling another servlet from a servlet
I'm working on a servlet and would like to know how to
call another servlet, by clicking on a form button
or a hyperlink that was generated from the first servlet,
is it only possible if the second servlet is called
in an shtml page? Can you please give me an example
of how to do this not using shtml pages?
(I'm working with JDeveloper 2.0)
When will the book be out for JDeveloper 2.0?
We're also having problems deploying the servlet
to the Java Web Server (1.1.3)
It seems to have a problem connecting to the database.
We get the first page of the servlet but the
second page is generated from the doPost()
and connects to the database using oracle JDBC thin
gives a http 500 internal server error ,
and we followed the instructions from JDeveloper
can the problem be caused from the connection string that
I used in the servlet:
Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection(
"jdbc:oracle:thin:@(description=(address=
(host=10.10.10.53)(protocol=tcp)(port=1521))
(connect_data=(sid=OR8A)))",
"im_dev","im_dev");
or the configuration of the web server?
(web server: Solaris 2.7 running on Intel)
nullHi
The sample acme video demo in JDeveloper does something similar.
It has main Servlet "WebAppServlet.java" which overides the
doPost and doGet methods and this methods calls someother java
classes do perform some specific business logic which return a
html page in a String format to "WebAppServlet.java".
Open the samples directory in JDEveloper 2.0 with WebApp_81.jws
to look at the source code.
Steps to run the sample are included in the help system.
regards
argyro (guest) wrote:
: I'm working on a servlet and would like to know how to
: call another servlet, by clicking on a form button
: or a hyperlink that was generated from the first servlet,
: is it only possible if the second servlet is called
: in an shtml page? Can you please give me an example
: of how to do this not using shtml pages?
: (I'm working with JDeveloper 2.0)
: When will the book be out for JDeveloper 2.0?
: We're also having problems deploying the servlet
: to the Java Web Server (1.1.3)
: It seems to have a problem connecting to the database.
: We get the first page of the servlet but the
: second page is generated from the doPost()
: and connects to the database using oracle JDBC thin
: gives a http 500 internal server error ,
: and we followed the instructions from JDeveloper
: can the problem be caused from the connection string that
: I used in the servlet:
: Class.forName("oracle.jdbc.driver.OracleDriver");
: DriverManager.registerDriver(
: new oracle.jdbc.driver.OracleDriver());
: con = DriverManager.getConnection(
: "jdbc:oracle:thin:@(description=(address=
: (host=10.10.10.53)(protocol=tcp)(port=1521))
: (connect_data=(sid=OR8A)))",
: "im_dev","im_dev");
: or the configuration of the web server?
: (web server: Solaris 2.7 running on Intel)
null
Maybe you are looking for
-
Zen Touch issue - clock and stops playin
Every once in a while, my Touch seems to just kinda stop playing which gives me a suprise - its locked and is like nowhere near the last track, and even taht i have on repeat all that and when that happens, the clock resets - suggestions anyone?
-
My iphone4 will not sync to music. IT will sync to pictures. I uninstalled itunes and put it back in but nothing. Also, itunes does not come up when i plug my phone into the computer. I have to click on itunes for it to come up. I am not sure what to
-
Hi all, can anyone please help me with a problem I've encountered with my applet. I've been attempting to write some exception handling, simple enough you'd think? Anyway within my method(for retrieving a byte array from my card), I check to ensure t
-
How to save a flattened pdf from a form
I feel like this should be easy, but for some reason I cannot get it to work, nor have any of the other help documents worked. My apoligies in advance if this is a silly question. I am using Acrobat Pro X (10.1.2) on a Mac running LION. I have a pdf
-
I would appreciate of someone would give me some troubleshooting tips. I just go my iPod on Thursday and now my apps don't seem to work. When I click it, it sends me right back to the home screen please help asap