How to push back a message to browser using JSP or Servlet?
Hi,
I am coding some JSP and Servlet codes, and want to push back a mssage to browser and don't let browser first send a request to server like chat. Who can help me for that?
Thanks,
Wise
You wrote:
Not quite correct - see Pushlets:I wrote:
"...to have code running on the client (eg an applet or a flash movie)"
I add "...(eg an applet or a flash movie OR JavaScript)..." ;-)
Similar Messages
-
Showing various images on browser using JSP and Servlet
Hello Guys!
I am starting to develop in Java and already I am facing a big problem.
If somebody will have some tip or suggestion, will be very well comings!
The application must present in browser images originnally of format TIF. As it is not a native format of the I.E. , I converted the image for JPG (without saving it on disk) and send it to the browser a encoded image (encode) using JAI library in one servlet had access by a JSP. Then, the structure of my application is thus:
1) an archive JSP draws the initial screen in browser and presents one input text.
2) later that the user places the parameter, I make an access to the database and read a quantity of images to be presented.
3) From there in the proper JSP, I use de tag img src to send image to the browser in agreement archive the amount of images.
It follows the code of the JSP:
<%
int intI=0;
int intCont=0;
if(blnImagem == true){
out.println("<br>");
out.println("<table border=0 STYLE=border-collapse:collapse>");
out.println("<tr>");
for(intI=0;intI < Processo.intQtdImagens;intI++){
Imagem.strImgTif = Imagem.IndicarImagem(Processo.strNmPath,Processo.strSubPath,Processo.intNuImagem,intI);
out.println("<th>");
out.println("<table border=1 STYLE=border-collapse:collapse rules='cols'>");
out.println("<tr>");
out.println("<th>");
%>
<img src="ShowImg" WIDTH=100>
<%
out.println("</th>");
out.println("</tr>");
out.println("</table>");
%>and code on the ShowImg servlet:
response.setContentType("image/jpeg");
ServletOutputStream sos = response.getOutputStream();
RenderedOp src = JAI.create("fileload", Imagem.strImgTif);
ImageEncoder encoder = ImageCodec.createImageEncoder("JPEG",sos,null);
encoder.encode(src);
sos.close();The problem is if I have 10 images to present, it WILL BE it is executed 10 times and it passes 10 names of different archives, but in the page only the last image is presented 10 times. It is as if it processed the TAG to the end of everything in way that the value of the static variable Imagem.strImgTif was chore only with the last value and the same loaded image 10 times. How I make to solve this? Somebody has some idea?
THANK YOU !
EmidioIf I understand correctly what your problem is:
Do this in the jsp:
out.println("<img src=\"ShowImg?image=" + intI + "\" WIDTH=100>");
In the image servlet, get the "image" parameter and parse it as an int. Move the Imagem.IndicarImagem() call to the image servlet. -
How to go back on page by not sending request to servlet
Hello,
I have create web application using JSP and servlets. When I press a button I send request to servlet and it redirects me to jsp page where the results are displayed, then in that page I press a button and go to other servlet which redirects me to other JSP.
I want to make a button on the third JSP page to go back to second JSP page by not sending request to servlet. For e.g. in FireFox, I press back button and it takes me back. But I want that the same action like in firefox would work with my created button.
How can I do that?
Edited by: peliukasss on Sep 14, 2010 3:28 PMevnafets wrote:
You wnat your created button to act the same as the "back" button in the browser?Yes, thats exactly what I need.
Then all you need to do is invoke some javascript on it.
After a quick google search, the most commonly suggested solution appears to be:
onclick="history.go(-1)"
Thanks for your reply. -
How can I open and close private browsing using an IPAD mini in IOS 7?
How can I open and close private browsing using an iPad mini in ios7?
Tap the '+' to the right of the URL field to open a new tab, and at the bottom left of the screen there should be a 'Private' button - tap that and you can then go to the site that you want to go to
-
How to upload the image and diplay the image in the browser using jsp
How to upload the image and diplay the image in the browser using jsp
thanks
shani'll suggest looking for sample code or tutorial with a relevant query in google, which as far more time than us to answer this type of reccurent question
-
How to open a pdf file in a web browser using jsp
Hi,
I have a problem opening pdf file in browser using jsp.the following is my code.Can anyone help me.Thanks
response.setContentType("application/pdf");
String filename="C:\\FictPos\\mypdf.pdf";
File file = new File(filename);
FileInputStream in = new FileInputStream(file);
OutputStream out1=response.getOutputStream();
byte[] buf = new byte[4096];
int count = 0;
while ((count = in.read(buf)) >= 0)
out1.write(buf, 0, count);
in.close();
out1.close();
}Don't know the problem specifically, but here are some suggestions to investigate:
Does it show anything in the page when you view source on it?
I would recommend using a servlet rather than a JSP page for this, if only for the fact the JSPs can insert carriage returns into places where you might not want them to. This might screw up the PDF file format?
Try setting the a link to the jsp, right-click and "save target as..." just to see if it gets any response at all - ie bypass the browser display.
Good luck,
evnafets -
I am very new to this JDeveloper & BPEl Process , please could some one help in ersolving my problem that is , how to upload a file in BPEL Console Using JSP in JDeveloper.
Hi,
ADF Faces provides you with the file upload component
http://download-uk.oracle.com/docs/html/B25947_01/web_complex006.htm#CEGCEDHF
http://download-uk.oracle.com/docs/html/B25947_01/appendixa007.htm#CHDEDCFA
This gives you a handle to the file content. However, uploading files through a service is different and I suggest to consult teh BPEL forum for this BPEL
Frank -
How to upload a file in BPEL Console Using JSP in JDeveloper, please help..
Please I am new to Jdeveloper and to BPEL Process of OASuite,I want to know , how to upload a file in BPEL process using JSP in Jdeveloper IDE.
The main aim is first we need to upload a file in JSP , it has to go to BPEL Process & it has to read the file & write the respective file in return to JSP through BPEL Process. Please I am in Urgent need of the Query , please help me ASAP.
Send to me response Please.....................................Hi,
I thin that you asked the same question before and I premember that I ointed you to the ADF BC developer guide and the SRDemo if your application uses JSF. For plain JSP - if you Google for: JSP and file upload then you find plenty of sources for JSP and Struts.
The remaining part is how to stiff the file into a BPEL service on the middle tier. For this I recommended to ask your question on the BPEL forum
BPEL
Note that the BPEL integration would be easier if it was done on the middle tier and not onthe client
Frank -
How can i upload a image file to server by using jsp or servlet.
Hi,
I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
Pls send me anyone.
Regards,
Gurumoorthy.I'm not an applet programmer so I can't give you much advice there.
If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer. -
How 2 get the path of a file Using jsp
how 2 get the path of a file Using jsp
i have tried getPath...but i'm geting the error
The method getPath(String) is undefined for the type HttpServletRequest
any idea how 2 get the path of a fileYou need ServletContext#getRealPath().
API documentation: http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRealPath(java.lang.String) -
Can I get information regarding the client browser using JSP
can I get information regarding the client browser using JSP. like.. name, screen resolutions, font type, screen width and height of the browser etc.,
if possible then please give me the samples..
thanks,can I get information regarding the client browser using JSP. like.. name, screen resolutions, font type, screen width and height of the browser etc.,
if possible then please give me the samples..
thanks, -
How do I back up messages on ZTE Open?
My Open is still running FFOS 1.0 and I want to update it. Since the 'check for updates' method keeps telling me there was a problem downloading updates I'm getting ready to try the SD card method. I've downloaded the relevant update from http://www.ztedevices.com/support/smart_phone/cba40ed6-d3ab-44c0-bdee-3a15803dc187.html and backed up my contacts using the Con Backup app from the marketplace, but I can't find a similarly easy way to back up my messages, and was hoping someone here could point me at something helpful - all I can find is https://developer.mozilla.org/en-US/Firefox_OS/Firefox_OS_build_prerequisites#Backup_the_phone_system_partition and (whilst my laptop runs Ubuntu as well as Windows so I could theoretically try that and probably will if there's no alternative) it's frankly way over my head, so something with a bit more hand-holding or would be immensely useful.
Other potentially relevant info: I own and thus have easy access to Windows 7 and XP, and Ubuntu 13.10, and could probably borrow laptops running WIndows 8.1 and OS X for a few hours/overnight if I asked nicely enough.Hello joshua.pond,
Thank you for contacting Mozilla Support. Unfortunately those instructions are the only way to back up messages for the time being. Some kind soul may work on an app similar to the backup contacts, so keep an eye out on our Marketplace.
Cheers,
Patrick -
How to display Map for viewing in browser using Java
I am fidning a solution for displaying political maps in browser using Java technology.
Is ther anybody with a solution.
Waiting for your respone.
Regards
Mithunpalanithendral wrote:
Hi,
Our application using in English, German, Franch and chinese.You have several different idioms in your application and have not accurately identified where the actual problem is. You have all of the following
-database
-http
-excel
-excel in http
-display on the target computer
The first step with these sorts of problem is to identify where the problem actually occurs.
String chineseCharacter=""; // chineseCharacter like 長长牀床東东彿佛. This chinese data coming from oracle database..A good theory. Now explain how you proved that that is what is coming from the database.
After export the data to excel show the result for é·é¿çåºæ±ä¸å½¿ä½.As another example. Presumably you are referring to what the browser on the target computer displays. Your theory is that that computer and that browser (together) will display the correct information if they had the correct data. How did you prove that? -
How to detect Browser using JSP ?
Hi friends,
I wanna to put some code to detect browser and
Other than IE6+ i have to block other browser to display login.
How do i check that ? Using JSP.
e.g.
If i open IE6+ login page should be displayed. Else on other browsers
it will check brower and deny to display login page.
How Do i check it ? please Help me.this code works for me in IE,Safari and firefox but i could not check in netscape as i dont have.
String userAgent = request.getHeader("User-Agent");
System.out.println("UserAgent:"+userAgent);
userAgent=userAgent.toLowerCase(); //convert to lowercase and then check
if(userAgent.indexOf("netscape6") != -1)
System.out.println("Netscape");
else if(userAgent.indexOf("msie") != -1)
System.out.println("IE");
else if(userAgent.indexOf("firefox") != -1)
System.out.println("Firefox");
else if(userAgent.indexOf("safari") != -1)
System.out.println("Safari");
else
System.out.println("Else");
-
How do I create a message board/forum using forms in Dreamweaver?
I want to create a forum or messageboard using the form in Dreamweaver but I don't know how to do it. Is there any guidance on how I could create a message board or forum on Dreamweaver?
I don't think it can be done with just dreamweaver,
You will have to download something like PHPBB,
If you have a host with fantastico deluxe you can easily set up a forum
with it.
Daniel
Maybe you are looking for
-
I seem to have 2 iCloud accounts with different names - a free storage that came with my MacBook and one I used when I bought some iCloud space. How can I cancel the free account? Because of this I can't access iMatch and the ICloud account I paid fo
-
Issue with Vendor Payment Terms
Hi Gurus, We're facing an issue with the Payment Terms of a Vendor in our SRM system. In R/3 the Vendor has Payment Term 'A' but when we create a PO for this vendor it appears with Payment Term 'B' (PT from SRM I think) The correct PT is 'A' (the one
-
Formula to calculate days to first non-empty cell
Hi all, I'm creating a spreadsheet to track exercise. The first column is the date, the other columns are mnemonics, one for each exercise. For each day I do some exercise, I create a row with the date and an 'x' in the column for each exercise perfo
-
Unable to import the views in RPD.
Hi, Case1:Unable to import the views in OBIEE 11g by using "Oracle inOraDb 11g_Home1" drivers but able to import the Tables in RPD. Case 2:Unable to import the Table in OBIEE 11g by using ."Data Direct 6.0 Oracle wire protocol" drivers but able to im
-
Dec 24, 2012 9:47 AM I made a article in Pages, so I exported to the desk top by PDF now I can not move it to the tash, it keeps saying can not remove. There must be a way. Please help. When I click on Desktop it does not show in a finder window b