Forwarding request from JSP/Servlet to EJB
Is it possible to forward the HttpRequest,HttpResponse objects from a Servlet/JSP to an Entity/Session bean ?
ie To forward the call using RequestDispatcher/forward to a Session bean which in turn calls the entiy bean for updating DB
Ramesh
I don't think that's possible and even if it is there's an easier way. Normally you just create an instance of the session bean in a servlet and pass it the information. The session bean then calls the entity bean which updates the database. You don't have to forward the request - just pass the data to the bean.
Similar Messages
-
Trouble forwarding request from a servlet to a JSP in OAS 4.0.8.1 on NT
The OJSP release notes state that:
"Servlets and JSP cannot coexist as the same application" and "Requests cannot be passed between two separate applications."
Does this mean that my attempts to use the
the servlet RequestDispatcher to forward a request to a JSP are futile? If so, is this a problem that will be fixed in the future? I would like to use this feature!
This is the code (based on a sample from Sun's JSWDK 1.0.1) that doesn't work:
servletToJsp.java
import javax.servlet.*;
import javax.servlet.http.*;
public class servletToJsp extends HttpServlet {
public void doGet (HttpServletRequest request,
HttpServletResponse response) {
try {
getServletConfig().getServletContext().getRequestDispatcher("/jsp/jsptoserv/hello.jsp").forward(request, response);
} catch (Exception ex) {
ex.printStackTrace ();
I am able to use the <jsp:forward page="/servlets/servletToJsp" /> directive to go from a JSP page to a servlet (across two OAS Applications) and I also can forward a request via the dispatcher from one servlet to another in the same OAS application.
Any help in this area would be appreciated. Thanks.I'm using OAS 4.0.8.1
You mean servlet to JSP does not work and JSP to servlet works for you????Yes - but I've only tried very simply examples.
That's different from my understanding. If you are using OAS 4081, both cases should not work.
The problem you mentioned will be fixed in future release of OAS.That's good to know - thanks!
null -
How can I call EJB from JSP/Servlets in iWS?
Hi!!
My JSP/Servlets are on iWS, and I deploy EJB on iAS.
In this case, I don't know how JSP/Servlet call EJb on iAS.
I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
I will thank you if you give me a simple example source using JSP/Servlet
and EJB.
Thanks in advance!!!
- Park-Park,
Why Are you running your JSP/Servlets in iWS instead of iAS? For whatever
reason,
look at the Converter sample from iAS. You will be doing RMI/IIOP in this
case and the sample explains in detail what to do.
hth,
-robert
"SungHyun, Park" <[email protected]> wrote in message
news:9jpfmt$[email protected]..
Hi!!
My JSP/Servlets are on iWS, and I deploy EJB on iAS.
In this case, I don't know how JSP/Servlet call EJb on iAS.
I'd like to know how I can set JNDI name in JSP/Servlet on iWS.
I will thank you if you give me a simple example source using JSP/Servlet
and EJB.
Thanks in advance!!!
- Park- -
How to pass submitted Data from a servlet to EJB Session Bean in JPA
How to pass Data User submitted Data from a servlet to EJB Session Bean when using JPA :
Hi ,
I have a jsp page in which the user fills up the Data and submits it to the servlet :
Inside servlets i am getting all the parameters and setting it to the Entity Class .
Sample Entity class is shown below :
@Entity
public class Employee {
@Id private int id;
private String name;
public Employee() {}
public Employee(int id) { this.id = id; }
public int getId() { return id; }
public void setId(int id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}After calling setters of my Entity Class .
I am using JNDI lookup to call my session Bean method and pass this Entity class to the session Bean to persist data
Please let me know what will be the right approach :
1. Passing parameters whole as a Entity Class
that is
public void insertData(Employee emp)
}Or
2. public void insertData(String Name , int ID)
}they are both right as they both work. Easy huh?
You might argue that if you have to set a lot of fields, use the entity as otherwise you get a method with a gigantic amount of parameters. -
Can we run external mail program from JSP / Servlet deployed on tomcat
Hi folks,
Had a tough time getting JavaMail API to work, finally when things seem to be working
there were some issues with the vendor's server, so finally gave up the idea.
On the server Apache and Tomcat are integrated via mod_jk and currently I redirect to a php page
which acts as a helper to send mail, however for the given business needs and server's limitations
there are potential security holes.
So I was wondering if I could directly execute the linux sendmail program from JSP/Servlet
as we would in a standalone java program or do we need special settings on Tomcat to execute external
programs.
Please let me know your views / ideas / comments on this
Thanks in advance
AbishekHi
It's not designed for you to be able to do this, it needs to run through 10gAS or 11gWeblogic.
Tony -
Cross domain requests from jsp
how to configure tomcat 5.5.x to allow cross domain requests from jsp.
Its very urgent for me. How to allow cross domain request from XMLHttpRequest. please mail me solution [email protected]
Thanks in advance
sureshFor cross domain requests from JSP, you can normally use standard java code (URLConnection etc.) or a tag like <c:import url="..."/> (see JSTL: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html)
XMLHttpRequest has nothing to do with Tomcat or JSP, it's a Javascript object, and it denies cross domain requests by design.
There are some workarounds, one of them is to send the XMLHttpRequest to the server and let the server do the cross domain requesting, for example like above. -
hi all,
Can any one help me, how can i send the mail from JSP-Servlet.
in Spring, we have a the following package to send mail,
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
Suggest me to solve the problem.
Thanx in advance.
BalaHi balu,
i already go thru that API. My problem is if i add any additional jar file for sending the mail from JSP or Servlets only. not in high technology.
i mention spring as an example.
so, kindly suggets me on that.
Bala -
Send Get request from a servlet.
Is it possible to send parameters from one servlet to another by using get? I don't want to use Post because the servlet recieving the parameters already has the post method doing something else. Any ideas?
May you can use the RequestDispatcher for your use.
Doc:
public interface RequestDispatcher
Defines an object that receives requests from the
client and sends them to any resource (such as a servlet, HTML file, or JSP file) on the server.
The servlet container creates the RequestDispatcher
object, which is used as a wrapper around a server
resource located at a particular path or given by a
particular name.
This interface is intended to wrap servlets, but a
servlet container can create RequestDispatcher objects
to wrap any type of resource.
It send the requset with the same methode to an other resource. You don't have care about the parameter.
Your code could look like this:
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
RequestDispatcher dispatcher = getServletConfig().getServletContext().getRequestDispatcher("/next");
dispatcher.forward(request, response);
}Dietmar -
Calling WLI Workflows from JSP/servlets
Hello,
I'm looking for some help with WLI workflows.
I want to create a JSP/Servlet that starts a workflow to request some
data.
I understand how to start a workflow by placing a message on a JMS
queue, but I am unsure of how to get a response back from the workflow.
How does a work flow return a result to a client?
Does the workflow place the result onto a JMS queue? If so, how does the
result message get associated with the request message? Is there any
mechanisms to do this, or do I need to write this on my own?
Would the servlet/JSP block until the response is returned, or does it
need to poll some other queue?
Any advice would be appreciated.
Thanks
AlanAlan
Currently you do not need JMS to return a result. Here is a sample jsp
based worklist, you can use this to see how to start one using the worklist
api, however, what exactly do you want to return. ?
Tony
"Alan Mangroo" <[email protected]> wrote in message
news:[email protected]..
Hello,
I'm looking for some help with WLI workflows.
I want to create a JSP/Servlet that starts a workflow to request some
data.
I understand how to start a workflow by placing a message on a JMS
queue, but I am unsure of how to get a response back from the workflow.
How does a work flow return a result to a client?
Does the workflow place the result onto a JMS queue? If so, how does the
result message get associated with the request message? Is there any
mechanisms to do this, or do I need to write this on my own?
Would the servlet/JSP block until the response is returned, or does it
need to poll some other queue?
Any advice would be appreciated.
Thanks
Alan
[worklist.zip] -
Anyone know the way to call SQLLoader utility or similar from JSP/Servlet?
Anyone know the way to call SQLLoader utility or similar from JSP or Servlet?
i would like to make a big data load from web interface, using SQL Loader or similar, because this utility allows a great performance.
I think that i can make a JSP or Servlet to open file, and create insert statement into a loop, but the performance is very bad for 30000 inpuits.
Help me please
Thanks
Note: my english is very bad. Sorry.Hi there,
I tried this codes into a Bean like this:
package com.tuxedo.beans;
import java.io.*;
public class TuxTest
public void RunTest()
try{
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("command /k c:\test.bat");
} catch (IOException e) {
System.err.println("Error: " + e.getMessage());
}and call it with a JSP like this:
<html>
<head><title>Tuxedo Test</title></head>
<body>
To run a test on local batch file
<jsp:useBean id="test1 " class="com.tuxedo.beans.TuxTest"/>
<jsp: RunTest name="test1"/>
</body>
</html>i had created folder %tomcat%\webapps\ROOT\WEB-INF\classes\com\tuxedo\beans to store the bean.
Yet the JSP file executed, but i dun see any response by calling the batch file, anyone have any idea?
the batch file is like this:
@echo off
echo
echo Hello World!
echo
pausePlease help! -
Webdispatcher to forward requests from internet to intranet?
We need to direct requests from internet to our content server which is in the intranet (so that the content server images can be seen from the internet).
We have a WAS WebDispatcher in the DMZ. Can we use this WD to provide the connectivity?
For example:
Our content server intranet URL is:
http://contenterv.com:1090/path/image.jpg
Our WebDispatcher URL is:
http://webdisp.com/app_name
http://webdisp.com/app_name should resolve to http://contenterv.com:1090/path/image.jpg
We tried WD http forwarding but it just forwards the request, does not resolve the name transparently. So the forwarding works but since http://contenterv.com:1090/path/image.jpg is not known in the internet, it fails.
Thanks>
Ghochi Elin Kuswoyo wrote:
> hi guys,
>
> you need to add parameter in your sapwebdisp.pfl (sap webdispatcher profile) :
>
> icm/HTTP/redirect_0 = PREFIX=/,TO=/path_image
>
> thanks
No, this wont work, becuase you need reverse-proxy function rather than URL redirection, because internet user wont be access the intranet server even you give them the URL.
I cannot get you the detailed confguration, but you can refer to web dispatcher cascade configuration. play with the following parameters:
wdisp/server_info_location
wdisp/group_info_location
wdisp/url_map_location
>
Cons wrote:
> So in short, get your networking guys to do this, SAP cannot help in any way.
it's not ture, web dispatcher can be used reverse proxy, of course you also can use other solution like Apache. However it's not recommened to use NAT, which might breach your network security.
Cheers,
Denny
Edited by: Denny Liao on Jan 28, 2010 11:26 PM -
Unable to forward requests from webserver
I am trying to set-up iWS 6.0sp4 to forward requests to the application server but I always get not found as the webserver is just looking at its own document root. I have deployed the fortune ear (from 6.5) and can access that via the application servers own http server perfectly well. I have added the plugin package to the webserver and added the following into the magnus.conf
Init fn="load-modules" shlib="<install_dir>/lib/webserver-plugin/solaris/iws/libpassthrough.so" funcs="init-passthrough,auth-passthrough,check-passthrough,service-passthrough" NativeThread="no"
Init fn="init-passthrough"
and to the obj.conf
NameTrans fn="assign-name" from="(fortune/fortune/*)" name="passthrough"
NameTrans fn="assign-name" from="(fortune/*)" name="passthrough"
ObjectType fn="force-type" type="magnus-internal/passthrough"
Service type="magnus-internal/passthrough" fn="service-passthrough" servers="http://<application server http listener>"
Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html"
</Object>
The webserver starts up without any errors but never forwards any requests what might I be doing wrong?I followed the instructions found in the App Server 7 documentation and everything worked fine.
The instructions I followed are in the document found at this link:
http://docs.sun.com/source/816-7156-10/agplugin.html#17655
Just FYI...
I also checked with Sun about why this process is now necessary and I asked about what happened to the web connector from 6.x. Sun had this reply:
The Web Server Plug-in is the new web connector. It just hasn't been wrapped with an installation yet ... which is why it is tedious. The old Plug-in for 6.5 would ultimately have the same type of obj.conf entries. I'm not sure if there will be an installation wrapper for it once the Enterprise Edition is released.
The Web Server Plug-in is different right now in that it doesn't 'know' about multiple instances yet. These are capabilities that will be introduced in the Enterprise Edition in March. Of course, that doesn't stop you from having multiple instances of the web server talking to multiple instances of the app server. It just means that the web server instances have to be directed to the app server instances rather than discovering them. -
How to configure bea apache plugin to forward request from apache to bea se
Hi,
I have an apache server and a bea weblogic application server. For security reasons, I wold like to configure a bea plugin on the apache server to redirect the client http/https requests from the apache2 server to bea application server.
I have gone through the bea documentation and configure my apache2 httpd.conf as follows
LoadModule weblogic_module modules/mod_wl_20.so
<IfModule mod_weblogic.c>
WebLogicHost myweblogic.server.com
WebLogicPort 7001
MatchExpression *.jsp
</IfModule>
<Location /weblogic>
WebLogicHost myweblogic.server.com
WebLogicPort 7001
SetHandler weblogic-handler
PathTrim /weblogic
</Location>
Then Restarted the apache2 and tryied to acces bea application through http://myweblogic.server.com/weblogic/
and http://myweblogic.server.com/something.jsp
It did not work
httpd is started propery.
Any help would be highly apreciated
Many Thanks
Ushas SymonI have no experience with nginx and varnish and asking configuration problems regarding these products is perhaps beyond the scope of this forum.
While configuring varnish, we are getting issues and unable to connect server from my browser if I change port 80.
You did not describe the issues, but it is possible and very common that your IP Firewall is blocking access to ports other than 80 and 22. For testing, you can simply turn it off. If you do not know how, please post your OS distribution version first, as it all depends. -
Passing data from jsp/servlet to a Tuxedo Service thru VIEW
Hi..
We are using Tuxedo10g R3 on AIX 5.3..
We have a Tuxedo Service running which takes values from the VIEW and converts that to upper case.. From the jsp page v r passing values to the VIEW fields which will be accepted by the service..
For testing v checked the service with a tuxedo client and it is working fine..
We have defined a jolt repository file for this service and finished bulkloading and coded the servlet also.. After passing the datas from the jsp, the Tuxedo service is called and it is ended.. but in the service only blank values are passed or the datas are not passed to VIEW fields.. It is not showing any error..
The repository file for this service:
service=NSIMPSRV
export=true
inbuf=VIEW
inview=sample
outbuf=STRING
param=FIRSTSTR
type=string
access=in
param=SECONDSTR
type=string
access=in
param=THIRDSTR
type=string
access=in
param=S-FIRST
type=string
access=out
param=S-SECOND
type=string
access=out
param=S-THIRD
type=string
access=out
and the servlet code for this service:
Result result1;
ServletSessionPool servletsession = (ServletSessionPool) joltsession.getSessionPool("demojoltpool");
ServletDataSet joltdataset = new ServletDataSet();
joltdataset.setValue("FIRSTSTR","Testing");
joltdataset.setValue("SECONDSTR","Tuxedo");
joltdataset.setValue("THIRDSTR","Views");
result1 = servletsession.call("NSIMPSRV", joltdataset, null);
System.out.println("FIRSTSTR:"+result1.getValue("S-FIRST",""));
System.out.println("SECONDSTR:"+result1.getValue("S-SECOND",""));
System.out.println("THIRDSTR:"+result1.getValue("S-THIRD",""));
we are not sure why the datas have not been passed.. do anyone have any idea regarding this??
Thanks..Hi Wayne,
This is my view definition:
VIEW sample
# type cname fbna count flag size null
string firststr - 1 - 10 -
string secondstr - 1 - 10 -
string thirdstr - 1 - 10 -
ENDJolt repository file:
service=NSIMPSRV
export=true
inbuf=VIEW
inview=sample
outbuf=VIEW
outview=sample
param=FIRSTSTR
type=string
access=inout
param=SECONDSTR
type=string
access=inout
param=THIRDSTR
type=string
access=inoutThe Servlet code is:
package Servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import bea.jolt.pool.servlet.weblogic.PoolManagerStartUp;
import bea.jolt.pool.servlet.*;
import bea.jolt.pool.ApplicationException;
import bea.jolt.pool.SessionPoolException;
import bea.jolt.pool.ServiceException;
import bea.jolt.pool.SessionPoolManager;
import bea.jolt.pool.*;
* Servlet implementation class ZC00582Servlet
public class VIEWServlet extends HttpServlet {
private ServletSessionPoolManager joltsession = (ServletSessionPoolManager) SessionPoolManager.poolmgr;
public VIEWServlet() {
super();
// TODO Auto-generated constructor stub
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
ServletResult result;
Result result1;
String String1 = request.getParameter("FIRSTSTR");
String String2 = request.getParameter("SECONDSTR");
String String3 = request.getParameter("THIRDSTR");
System.out.println("THE VALUES BEFORE CONVERSION");
System.out.println("FIRSTSTR:"+String1);
System.out.println("SECONDSTR:"+String2);
System.out.println("THIRDSTR:"+String3);
System.out.println("1..");
//ServletResult message;
ServletSessionPool servletsession = (ServletSessionPool) joltsession.getSessionPool("demojoltpool");
System.out.println("2..");
ServletDataSet joltdataset = new ServletDataSet();
//joltdataset.importRequest(request);
System.out.println("3..");
//joltdataset.setValue("firststr","Hi");
joltdataset.setValue("firststr",String1);
System.out.println("4..");
//joltdataset.setValue("secondstr","hello");
joltdataset.setValue("secondstr",String2);
System.out.println("5..");
//joltdataset.setValue("thridstr","fine");
joltdataset.setValue("thirdstr",String3);
System.out.println("6..");
//result = (ServletResult) servletsession.call("NSIMPSRV", joltdataset, null);
result1 = servletsession.call("NSIMPSRV", joltdataset, null);
result = (ServletResult) result1;
System.out.println("THE VALUES AFTER CONVERSION");
System.out.println("FIRSTSTR:"+result.getStringValue("firststr",""));
System.out.println("SECONDSTR:"+result.getStringValue("secondstr",""));
System.out.println("THIRDSTR:"+result.getStringValue("thirdstr",""));
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
and my server program :
IDENTIFICATION DIVISION.
PROGRAM-ID. NSIMPSRV.
AUTHOR. TUXEDO DEVELOPMENT.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
* Tuxedo definitions
01 TPSVCRET-REC.
COPY TPSVCRET.
01 TPTYPE-REC.
COPY TPTYPE.
01 TPSTATUS-REC.
COPY TPSTATUS.
01 TPSVCDEF-REC.
COPY TPSVCDEF.
* Log message definitions
01 LOGMSG.
05 FILLER PIC X(10) VALUE
"NSIMPSRV :".
05 LOGMSG-TEXT PIC X(50).
01 LOGMSG-LEN PIC S9(9) COMP-5.
* User defined data records
01 STRING-DATA.
COPY SAMPLE.
LINKAGE SECTION.
PROCEDURE DIVISION.
START-FUNDUPSR.
MOVE LENGTH OF LOGMSG TO LOGMSG-LEN.
MOVE "Started" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
* Get the data that was sent by the client
MOVE LENGTH OF STRING-DATA TO LEN.
CALL "TPSVCSTART" USING TPSVCDEF-REC
TPTYPE-REC
STRING-DATA
TPSTATUS-REC.
IF NOT TPOK
MOVE "TPSVCSTART Failed" TO LOGMSG-TEXT
PERFORM DO-USERLOG
PERFORM EXIT-PROGRAM
END-IF.
IF TPTRUNCATE
MOVE "Data was truncated" TO LOGMSG-TEXT
PERFORM DO-USERLOG
PERFORM EXIT-PROGRAM
END-IF.
MOVE FIRSTSTR TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
MOVE SECONDSTR TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
MOVE THIRDSTR TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
INSPECT FIRSTSTR CONVERTING
"abcdefghijklmnopqrstuvwxyz" TO
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
INSPECT SECONDSTR CONVERTING
"abcdefghijklmnopqrstuvwxyz" TO
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
INSPECT THIRDSTR CONVERTING
"abcdefghijklmnopqrstuvwxyz" TO
"ABCDEFGHIJKLMNOPQRSTUVWXYZ".
MOVE "Success" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
MOVE STRING-DATA TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
SET TPSUCCESS TO TRUE.
COPY TPRETURN REPLACING
DATA-REC BY STRING-DATA.
* Write out a log err messages
DO-USERLOG.
CALL "USERLOG" USING LOGMSG
LOGMSG-LEN
TPSTATUS-REC.
* EXIT PROGRAM
EXIT-PROGRAM.
MOVE "Failed" TO LOGMSG-TEXT.
PERFORM DO-USERLOG.
SET TPFAIL TO TRUE.
COPY TPRETURN REPLACING
DATA-REC BY STRING-DATA.
Thanks & Regards,
Janani. -
How can i pass the olde request from jsp to RH?
i get to jsp page from requset handler A and in the jsp page i use request.get.. to display information on the screen.
the problem is that in case that the user press on lunguage link it send u to REQUEST handler B that do some jobs and than return you to the same page but now the page dosnt work because the old request is lost and when he get into the line request.get it falls.
so any one know how to forward the old request to the request handler without putting the old request in the session???
i understand that in case that u display data to the user forward dosnt work so here begin the problem.If I understand you correctly, you build a page based on a request. The page loads and the user makes another request. In processing this second request, the user should be returned to the same page, right? This tends to happen a lot in web apps.
The model we use is to have a PageModel instance for each page in the application which contains each of the datamodels needed by the JSP. We also have a method responsible for building that PageModel from data contained in the request/session.
If you set up a PageModel for the page you want to return to you can set this into the session and when you second request comes to build the page, you can either build the page from the new request or use the one stored in the session or a combination of the two.
The advantage of this is to make getting values from the request cleaner and the building of pages somewhat easier, just a series of pageModel.set...() methods before the jsp does pageModel.get...().
Mark
Maybe you are looking for
-
OA Adapter not triggering in ESB but if the service is in BPEL its triggere
Hi All, I have used Oracle Applications Adapter and choosen a Business Event in Ebiz API this is ESB. SomeTimes this ESB service is not triggered, when i did this in bpel its working fine can any one answer to this. Thanks.
-
Background Job Not Reconnected After Offline Backup.
Hi all, Background jobs which are scheduled before Databse Offline Backup are always cancelled. Reconnect WP does not happen even if following parameters are set. We had set profile parameters in all Application Server like rsdb/reco_trials = 15
-
Itunes store won't load, no error message
got a partial page one time, now nothing; internet radio loads fine, passed network diagnostics after a bit of a wait....
-
Hai i have 70 tables integrated with foreign and child key constraints. i have on delete cascade for all the child tables. if i delete the parent table automatically child table record get deleted. Kindly tell me how can i check howmany child record
-
Populating one Internal table from two internal tables.
Hello Gurus, iam having 3 internal table with same structure , 1st internal table having some records 2nd internal table is also having some records what i need to do is to populate the records to the 3rd internal table which the common records in th