Can Servlet embed in Jsp files?
Dear Friends,
I am new to jsp
Can embed HttpServlet in my jsp page ?
my java program contains outputstream, printwriter etc.,
please help me.
Thanks a lot.
Yours Iee
hi
to enable u to see your codes more clearly, i would suggest that u separate ur docs into JSP and servlet.
this allows u to correct ur errors easily too.
cos currently i am usin both JSP and servlet too.
u just need to call ur servlet from ur JSP page..
btw both JSP and servlet can be used for designin websites.. but usin JSP might be easier..
wonder if the above helps..
regards
Similar Messages
-
Can Servlet embed flash??
hi,all
Recently,I've start write servlet code,and client UI which use flash application.But I have problem with write out page through servlet.
I want to know can servlet embed flash (swf.file).Below I post some section of my code.
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<meta http-equiv=Content-Type content='text/html>");
out.println("<title>XXX</title>");
out.println("<script language='JavaScript'>");
out.println("function openNewWindow(URLtoOpen, windowName, windowFeatures){");
out.println("newWindow=window.open(URLtoOpen, windowName, windowFeatures); } </script>");
out.println("<script language='JavaScript' type='text/JavaScript'>");
out.println("<!-- ");
out.println("function setFlashVars() {");
out.println("enterprise.SetVariable('userid'," + UserID + "); }");
out.println("function openBrWindow(theURL) {");
out.println("window.open(theURL,'desc','width=588,height=285'); }") ;
out.println("//--> </script>");
out.println("</head>");
out.println("<BODY bgcolor='#999999' onLoad=\"setFlashVars()\">");
out.println("<A HREF=javascript:top.close()></A> <A HREF=e-date.swf></A> <!-- text used in the movie-->");
out.println("<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" WIDTH='100%' HEIGHT=\"100%\" id=\"enterprise\" ALIGN=\"\">");
out.println("<PARAM NAME=movie VALUE=\"enterprise.swf\">");
out.println("<PARAM NAME=quality VALUE=high>");
out.println("<PARAM NAME=scale VALUE=exactfit>");
out.println("<PARAM NAME=devicefont VALUE=true>");
out.println("<PARAM NAME=bgcolor VALUE=#999999>");
out.println("<PARAM name=flashvars value=\"gatewayURL=" + gatewayURL + "&Userid=" + UserID + "&Today=" + today + "\">");
out.println("<EMBED src=\"enterprise.swf\" quality=high scale=exactfit devicefont=true bgcolor=#999999 WIDTH='100%' HEIGHT='100%' NAME=\"enterprise\" ALIGN=\"\" TYPE=\"application/x-shockwave-flash\" flashvars=\"gatewayURL=" + gatewayURL + "&Userid=" + UserID + "&Today=" + today + "\" PLUGINSPAGE=\"http://www.macromedia.com/go/getflashplayer\"> </EMBED>");
out.println("</OBJECT>");
out.println("</BODY>");
out.println("</html>");
out.close();You should use the path to the .swf file, i.e. /myapp/flash/whatever.swf
-
How can i access the jsp file in a asp file
Hi every one..
we have two projects one is developed in ASP and one is developed in JSP both are running in two different locations.
now i want to include a jsp file from one project to ASP file in the other project.
please tell me how can i insert the JSP file in ASP application.
thanx in advance.Wouldn't that be an ASP question for an ASP forum?
-
How can I embed a pdf file into the body of an email?
How can I embed a pdf file into the body of an email?
The problem is defining what it even means to “embed” a PDF file in the body of an e-mail, especially if you are dealing with a multiple page PDF file.
E-mail is either pure text, rich text (something akin to RTF in Word), or HTML. PDF is not compatible with any of these. Thus, to embed a PDF file, something has to be converted and that means the PDF would be converted to a less graphically rich raster format. But is that what you would really want?
I think that the MacOS and iOS e-mail clients do under some circumstances place an attached PDF file within HTML segments and by clicking on same, you get the equivalent of extracting the full PDF file, but I have no real experience with that.
Another alternative is HTML with a proxy image with a hyperlink to an external PDF file that is invoked when you click on the hyperlink.
Perhaps you can explain what you are really trying to accomplish and what the recipient of such an e-mail's actual experience would be?
- Dov -
Can a servlet read a jsp file and display its contents?
Hi,
I would like to know if Servlets can read a Jsp file and display its contents.. Right now for our website, I am using a html file to be displayed after a successful post operation through the Servlets...
-Thanks!I posted this in another thread.
Here's some code that reads using a URL. This doesn't work with JSPs as the server executes JSP when it connects but it's useful for other file types. Note that the filename is a URI</h1>This is <code>show.jsp</code></h1>
<hr>
<%! String file = null; %>
<%! java.io.InputStream is = null; %>
<%
file = request.getParameterValues("filename")[0];
try {
is = (new java.net.URL(file)).openStream();
} catch (java.io.IOException ioe) { out.write(file + " not found!<br>"); }
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(is));
String line = "";
%>
<pre>
<%
while((line = in.readLine()) != null) {
%>
<%=line%>
<%
%>
</pre> -
How can i include a jsp file in servlet?
hi
i generate a dynamic page from servlet.
i need to include a jsp file in same servlet.
i try like this --
out.println("<HTML>");
out.println("<HEAD><TITLE>First</TITLE></HEAD>");
out.println("<BODY>");
out.println("<%@ include file=\"abc.jsp\">");
out.println("<FORM>");
out.println("</FORM>");
out.println("</BODY>");
out.println("</HTML>");Replace your line with
RequestDispatcher rd = request.getRequestDispatcher("abc.jsp");
rd.include(request, response); -
How to pass a variable in a servlet to another jsp file?
The variable that I wanted to pass is in a doGet function....
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.net.*;
import java.sql.*;
import java.io.*;
import java.util.*;
public class www extends HttpServlet
public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{try{
String code = request.getParameter("Text");
String current;
response.setContentType("text/html");
PrintWriter out = response.getWriter();
URL yahoo = new URL("http://www.yahoo.com"+request.getParameter("Text"));<<not the actual
URLConnection yahooConnection = yahoo.openConnection();
DataInputStream dis = new DataInputStream( yahooConnection.getInputStream());
String inputLine;
String whole=null;
int startPos,endPos,a,b,c,d,e;
while ((inputLine=dis.readLine( ))!= null) {
whole+=inputLine;
dis.close();
a=whole.indexOf("Previous Close",0);
b=whole.indexOf("Previous Close",a+1);
c=whole.indexOf("Previous Close",b+1);
d=whole.indexOf("Previous Close",c+1);
e=whole.indexOf("Previous Close",d+1);
startPos = whole.indexOf("right>",e) + 6;
endPos = whole.indexOf(">",startPos) -4;
current=(whole.substring(startPos,endPos));
out.println(*current*);
catch (MalformedURLException me)
System.out.println("MalformedURLExc eption: " + me);
catch (IOException ioe)
System.out.println("Exception: " + ioe);
}The String CURRENT is the one that I wanted to pass to another jsp file.....Or How can I call that Current in another JSP file?
An Alternative is I wanted to directly input that String CURRENT in a mysql Database using jdbc but I dont know how to do that.....THANKS!
Edited by: tr3k on Feb 22, 2008 12:40 AMIf used this but it returns
current=(whole.substring(startPos,endPos));
out.println(current);
HttpSession session = request.getSession();
session.setAttribute("current", current);
out.println("<form action = \"mVal_pass.jsp\" method= \"post\">");
out.println("Update current Market Value of "+code+"?<p>");
out.println("<input type=\"submit\" value=\"submit\">");
out.println("</form>");This is my JSP page which supposed to be is getting the value of String CURRENT
<HTML>
<HEAD></HEAD>
<BODY>
<% String codek = request.getParameter("current");%>
<%out.println(codek);%>
</BODY>
</HTML>I am getting the value of String Current but when I passed it, it returns NULL value...Help guys! -
Can I embed a PDF file within a Pages document?
I am working with Pages '09 and would like to embed a rather long PDF document file into my Pages text. I want the reader to be able to click on the PDF file and have it open so that the reader can gather more information on the subject without making the actual Pages document text any longer. I don't want the PDF file to be an external link that sends the reader away from the document -- I want to know if I can embed the PDF file WITHIN the pages document and have it open only when clicked. I don't think I can do this. Thanks.
Small Town Gal.I found my answer within archived discussions - convert the file to a PDF and then embed the PDF file as an attachment. Thanks.
Barbara Smits -
How can I include a jsp file in other jsp from different applications?
Hi,
I'd like know if it´s possible to include jsp or servlet from different applications.
Thanks Deepak but I think you don´t understand me.
I would like the include works like a normal include. I have a jsp in my application
and , when the client requests this jsp, in the jsp should be added the result
of the other jsp ejecution that belong to other application in the same domain.
Is this possible?
Thank you very much.
Deepak Vohra <[email protected]> wrote:
> A Jsp from a different application is included with a relative url to
>th=
>e Jsp.
><%@ include file=3D"relative url" %>
>
>A Jsp could be included with request parameter.
> <jsp:include page=3D'<%=3D request.getParameter("incFile") %>' />
>
>javilla wrote:
>
>> Hi,
>>
>> I'd like know if it=B4s possible to include jsp or servlet from differe=
>nt applications.
>
-
Can i merge multiple jsp files into single jsp file
i have two jsp pages,and these two jsp pages generate different outputs,then i want merge these jsp pages output and generte new single file.
yes what the do what the previous poster said.. this can also help to limit the file size of your jsp..
-
Where can i find createuser jsp file?
Hi ,
From my xlhome dir if found XellerateFull.ear on exploding it I found xlWebApp.war. I had exploded this file but i didnt find any jsp? Is there any other location that I need to check for!
Thanks,
satHi
This is the path for createUser JSP.
Here you can serch each jsp you want.
C:\bea\user_projects\domains\your_domain\XLApplications\WLXellerateFull.ear\xlWebApp.war\tiles\tjspCreateUserTiles.JSP -
Can't open my first JSP file, need help !
Hi guys!
I just started to learn jsp issue and I can�t open my jsp file,it doesn't reacting to my opening tries.
Help me please.1.I tried to click on it but no respond
2.tried to call from html form while using server JSDK 2.1 :
<FORM ACTION= "http://localhost:8080/servlet/AccessCounts.jsp" >
but I'm getting Error: 404 "No detailed message"
Can I open jsp file like simple html file ? Or must I locate it special folder of server while it runs ?
Tank's -
Can't open .jsp files on my mac from a citrix link
I can't open any .jsp files on my mac. It's from a citrix site for work but it doesn't recognize how to open it at all. It downloads to launch-10.jsp but nothing happens. When you try to open it, it says it doesn't recognize the file type.
Go to the App store and download The Unarchiver. Its free and will open most file types.
-
Can jsp files and EJBs they use be seperated on different mahcines?
Hi,
I have a EJB on a Solaris machine, my question is:
Can I put my jsp files that use this EJB on another machine (both machine
have Weblogic Server installed) and have it look up the EJB on the first
machine and create an instance of it?
The difficulty is that in order for the jsp files to compile, you have to
include the EJB classes first, which seems to be impossible because the EJB
classes reside on a remote machine.
Thank you in advance for any suggestions!
--TiejunIt would also help to configure your JNDI on the web container host to see
the EJBs that are on the ejb container host.
Cameron Purdy
"Wei Guan" <[email protected]> wrote in message
news:[email protected]..
Put Remote Interface, Home Interface, Application Exception & Primary Key
classes in the weblogic.class.path of your jsp machine.
Cheers - Wei
tyang <[email protected]> wrote in message
news:39887ae8$[email protected]..
Hi,
I have a EJB on a Solaris machine, my question is:
Can I put my jsp files that use this EJB on another machine (bothmachine
have Weblogic Server installed) and have it look up the EJB on the first
machine and create an instance of it?
The difficulty is that in order for the jsp files to compile, you haveto
include the EJB classes first, which seems to be impossible because theEJB
classes reside on a remote machine.
Thank you in advance for any suggestions!
--Tiejun -
why i can't run my jsp file? but some of them can be run ?
i use tomcat.
this is my snippet code :
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
out.println("Hai");
%>
</body>
</html>i can't run above jsp file. why ?
am i being hacked ? i use IE 5 althought sometime i use netscape 6 or Opera 7.
i try to run another jsp file, it's succeed but with above simple jsp file, it can't.
but when i tried to run it on another computer, it runs.
HELP ME!Once again, I HAVE SAVE IT!. and i make sure that the
file name didn't mistake.
but when i run it, the link doesn't have any link to
anywhere.Maybe your link is incorrect.
>
the other step i take, save as the file to another
name and then run it again, but it still the same.
the change i have made is useless.
Just for this file (suppose we call it trouble.jsp).
for another jsp file, when i run it, it works.
but, for this trouble.jsp, i found it very weird.Weird won't help anybody fix your problem.
>
I'll repeat once again, i have save it and make sure
the name is correct, the path is correct when i run
it.Then everything's fine, I guess.
Yes, sometime we make mistake and let other people get
the blame.
but, for this, i found it weird.The machine is only doing what you told it to do, and what you told it is quite incorrect. There's nothing weird about it.
>
according to me, i have set my tomcat very well.Maybe you aren't the best judge.
from the start i use it, it works fine and give me
result the way i expected.Then why are you posting anything here? Sounds like you know everything and that all is well.
Maybe you are looking for
-
i cant download new application on my Iphone everytime i open app store then searching for the application i want to download when i Tap the FREE sign it become half square and never downloaded.
-
Problem Using File adapter(Urgent)
Hi, I have a simple ESB service where I have one Read File adapter for reading a file and other Write file adapter to write the same file to a folder. I was able to deploy it to ESB instance successfully. But when I put a file to read ESB is throwing
-
Flex Mobile Videoplayback ( GPU / CPU )
Hi, I have problems with videoplayback on Android in an Flex Mobile app. I using the pur AS3 Strobe Media Playback with OSMF. When a play in emulator the video is ok, but on my Android device there are random lines on the Videos ( streamed or local )
-
Best practice for moving images between projects?
Hey all, I have a project that has an album inside of it. I want to move the album, containing all of the photographs to a new project. If I drag the photos individually to the new project it moves them successfully although they now don't belong to
-
IMac freezes while running Adrium
Hello, I've bought my iMac 27inch i5 at the end of 2009. Right now I experience the issue as if I'm running Adrium on my Mac the HDD goes wild and most of my programs stop running and I only get the spinning rainbow At the moment I turn of Adrium, ev