Problem including html in JSP
Hi,
I am trying to include a html file in a JSP using the tag...
<%@ include file="Header.html" %>
When I keep Header.html file in the Web Server root its not able to include the file and gives an error saying "unable to load the resource.... PropertyResourceBundel error". But when i copy the same html file on the the ApplicationServer root its picking it up and gives me no error.
Can any one help me out what could be the problem.
Thanks in advance
hi
the path given in the include tag should be
relative to the JSP page from which you are
calling it. that means the mentioned thing
will work if both the files are in the same
directory. otherwise you have to give the
path where the included file resides.
About the webserver and App. server thing,
i am not sure. may be more information about
the same can help. like the servers which
you are using and all..
Paragk
Similar Messages
-
Problem including a jsp in edit mode
Hello
Somehow i have a problem while including a jsp page while displaying the edit mode.
If my doEdot just writes something like "Hello World" into the response it just works fine.
But if i try to include a jsp resource the problems start to arise:
1. The normal resource lookup request.getResource(IResource.JSP, bla) returns an unavailable resource. This seems the be because although a working instance of my portlet is used, the passed request belongs to another context.
2. Passing a precomputed resource seems to work, the page definitly gets called (-> it gets compiled and no errors show in stacktrace), but a sap dialog shows, saying that no properties exist, that can get configured cry
I even stripped the jsp page to the single line "Hello", it gets compiled, but not shown!?
edit: After the dialog a new dialog is shown sayin: The specified root item cannot be retrieved from the configuration. Correct the entry before trying again
Even IF my confoguration is wrong (higly possible), why does it only show when using include but not while writing directly into the response stream?
Solution:
Portlet gets called via doEdit and thus is in edit mode. Since jsp pages extend AbstractPortalComponent the service method does not serve via the doContent method but tries to call doEdit on itself. Since jsp pages usually do not define doEdit, the default edit behavior gets applied.
Set Default mode within the request type and the request node.
Message was edited by: Mark VollmannThank you it worked .I really doesn't have much experience in the front end.
Thank you once again.
I ahve another problem , this is alomst the same , here i have a html anchor when user clicks on that link i wnat to display the result in the same window , but it is displaying in the new window , it does not have frames , so i can not say target .
here is the code , please give me advice
<table>
<tr>
<td><jsp:include page="top.jsp" /></td>
</tr>
<tr>
<td align="left" valign="top" width="50%"><jsp:include page="paneltranscripts.jsp" /></td>
<td width="50%"><center>
<%
if(transcripts.length == 0)
out.println("<h2>No Transcripts Avialable</h2>");
else
{ %>
<% out.println("You are viewing at ");%> <b> <%= roomname%> </b> <% out.println("room transcripts"); %>
<br>
<% out.println("To <b>view</b> the transcripts click on the link"); %>
<br>
<% out.println("To <b>download</b> the transcripts right click on the link, open it in new window and save the page"); %>
<br>
<br>
<%
for(int i=0;i<=transcripts.length-1; i++)
if(transcripts.equals(""))
continue;
else
%>
<a href="/DigiChat/DigiClasses/Resources/<%= sitename%>/Transcripts/<%= roomname%>/<%= realtranscripts[i%">"><%= transcripts[i] %></a>
<br>
<br>
<%
%>
</td>
</tr>
</table>
When user clicks on the transcripts[i] i want to display the result in the same window.
Thank you</a> -
Hi ,
I have the html data and need to include in the jsp .
eg :
String htmldata = " <html><body>testdata </body></html>";
how can i display this htmldata in the jsp . I mean I need this data in html format ( testdata ) and should not see all html tags in the explorer.
Suggest me if you know anything.
Thanks in advance.
- bregotyYou have the right idea, but you need to specify the escapeXml attribute on the c:out tag to be false. It defaults to true, and this means that when c:out encounters special characters it tries to display as-is rather, which is why you saw your HTML formatting. Set the escapeXml attribute to false and this should solve your problem.
<table width=100% cellspacing=0 cellpadding=5>
<c:forEach items="${myBean}" var="myDB">
<tr height=10px>
<td>
<c:out value="${myDB.htmldata}" escapeXml="false" />
</td>
</tr>
</table> -
Problems with include where the include is a jsp
Hi ,
I have a typical problem. The iplanet server doesn't interpret the code
from a jsp which is included in another jsp. For eg.
code for main jsp
request.getParameter("username");
<%@ include file="/jsp/ui/left_nav.jsp" %>
processing code.
Now when I start the server and the first time I load this page I get a
dearranged page which has the code of the left_nav.jsp present in the html
output.
On opening this page to edit, when a small modification is made and the file
is saved, a reload of the same page gives the proper output with all the
jsp's interpreted.
Thanks to one and all,
Regards,
GurjitYou definitely want to use a jsp include action, not a directive. The directive
happens at translation time and does not process the requested page. An action
happens at request time and treats the requested page as a new request, thus
including the results of the invoked jsp.
BTW, the include action is the tags that looks line <jsp:inculde
page="included_page.jsp" flush="true"/> or something similar (parameters can
also be specified).
The JSP 1.1 spec has more details. See sections 2.7.5 & 2.7.6 (for the include
directive and a quick comparison of the directive vs the action) and 2.13.4 (for
the include action).
Matt
Gurjit wrote:
Hi ,
I have a typical problem. The iplanet server doesn't interpret the code
from a jsp which is included in another jsp. For eg.
code for main jsp
request.getParameter("username");
<%@ include file="/jsp/ui/left_nav.jsp" %>
processing code.
Now when I start the server and the first time I load this page I get a
dearranged page which has the code of the left_nav.jsp present in the html
output.
On opening this page to edit, when a small modification is made and the file
is saved, a reload of the same page gives the proper output with all the
jsp's interpreted.
Thanks to one and all,
Regards,
Gurjit -
How to include html generated by a cgi-script ?
Here's the problem:
I need to include an html-header dynamically generated by a cgi-script: "web_nav.cgi" into my jsp-page.
According to some documentation the <jsp:include page=... tag can only be used to include servlet, jsp or html files, and according to other sources it doesn't matter what technology the target uses, as long as it delivers html....
I get a "..include failed, only jsp or html files can be included" error messsage so maybe the first theory is correct.
But the problem remains: If not with the <jsp:include tag , How do I do it??
Fast help would be really appreciated.
Thnx a bunch.
/HenrikHi Henrik,
1. the <jsp:include page="local_url" flush="true"/>
works for local url which is context-relative only
(within the same server and same context -application-)
2. So where is your web_nav.cgi ? is it local or remote
(on another server)
3. You can do it, look into the jsp book or documentation
for either jsp:include action and jsp:include directive for your need.
--Paul -
hi all,
i built an web application and now i want to add a menu using frame in HTML or javascript. The problem is all my JSP pages are data dependant from one another that means sometimes i am sending the data using input boxes and sometimes using HIDDEN values in HTML. Now i tried this followig way to use frame and to send my data to other pages but it is not working can anyone please help me.
"DOES ANYONE KNOW WHETHER I CAN USE FRAME IN THE JSP PAGE OR NOT"
LOGIN.HTML
<form action="startframe.html" method="post">
<center><h2>Employee Number:</h2></center>
<center><input type="text" name="emplno" maxlength="4"size="4"></center></br>
<center><h2>Password:</h2></center>
<center><input type="password" name="pass" maxlength="6" size="6"></center></br>
<center><input type="submit" value="SUBMIT YOUR INFO"></center>
</form>
</body>
</html> DATA are GOING FROM LOGIN.HTML TO VARIFYLOGIN.JSP
Now in between these two i used an HTML file to place a frame so that i can use the frame and the code is:
<HTML>
<HEAD>
<TITLE> </TITLE>
<frameset cols="15%,85%">>
<frame name="frame1" src="buttons.html">
<frame name="frame2" src="varifylogin.jsp?emplno=<%=emplno%> &pass=<%=pass%>" >
</frameset>
</HEAD>
<BODY>
</BODY>
</HTML> "DOES ANYONE KNOW WHETHER I CAN USE FRAME IN THE JSP PAGE OR NOT"
and then it should go to VARIFYLOGIN.JSP which is:
String empl_no = request.getParameter("emplno");
String password=request.getParameter("pass");
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
Connection con = DriverManager.getConnection("jdbc:odbc:finalmp" );
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT StaffID,FirstName,LastName,Password FROM StaffDetails");...................................................etc.
i am getting this error on the RIGHT hand side frame meaning it showing the buttons on the left but this error on the right:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:367)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
root cause
java.lang.NullPointerException
org.apache.jsp.varifylogin_jsp._jspService(varifylogin_jsp.java:83)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856Can anyone please help me.
Cheersi am working in jubuilder
and have made there three forms,and
calling s-aots and st_aots in fs_aots
but when i compile
it takes fiel,d text on seprate page display result on other window
why it dosent use frame here
2nd thing
i want to enable scrolling
how i can do
or how can i display required no of records in second row
if i mention page size in any check box
<html>
<head>
<title>
fs_aots
</title>
</head>
<jsp:useBean id="fs_aotsBeanId" scope="session" class="s_aots.fs_aotsBean" />
<jsp:setProperty name="fs_aotsBeanId" property="*" />
<body>
<FRAMESET Rows="30%" Framespacing="0">
<Frame Name ="Header" SRC="s_aots.jsp" Frameborder="0" Scrolling="no">
<FRAMESET Rows="70%" Framespacing="0">
<Frame Name="data" SRC="st_aots.jsp" Frameborder="0" Scrolling="yes">
</frameset>
</frameset>
</BODY>
</html>
<html>
<head>
<title>
s_aots
</title>
</head>
<jsp:useBean id="s_aotsBeanId" scope="session" class="s_aots.s_aotsBean" />
<jsp:setProperty name="s_aotsBeanId" property="*" />
<body>
<p>update database content
<form action="st_aots.jsp" method="post">
Region<input type=text name=Regionparam><br>
Bill Month From :<input type=text name=BmonthFparam><br>
Bill Month To:<input type=text name=BmonthTparam><br>
Connection Type:<input type=text name=Conntypeparam><br>
Exchanges:<input type=text name=Exchparam><br>
Phone No:<input type=text name=PhoneNoparam><br>
<input type=Submit value="Retrive from DB">
</form>
</BODY>
</HTML>
<html>
<head>
<title>
st_aots
</title>
</head>
<jsp:useBean id="st_aotsBeanId" scope="session" class="s_aots.st_aotsBean" />
<jsp:setProperty name="st_aotsBeanId" property="*" />
<%@ page language="java" import="java.util.*"%>
<table border=1 cellpadding=0 cellspacing=0 >
<tr><td> Phone No: </td>
<td> Current Bill: </td>
<td> Net Payable: </td>
<td>Net Arrers:</td>
<td>customer Name:</td>
<td>Customer Address:</td>
<td>Connection Type:</td>
</tr>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc:odbc:AOTS4");
java.sql.Statement statement = connection.createStatement();
Enumeration parameters = request.getParameterNames();
if(parameters.hasMoreElements()){
String REGION = request.getParameter("Regionparam");
String BILL_MONTH_FROM = request.getParameter("BmonthFparam");
String BILL_MONTH_TO = request.getParameter("BmonthTparam");
String CONN_TYPE = request.getParameter("Conntypeparam");
String EXCHANGES = request.getParameter("Exchparam");
String PHONE = request.getParameter("PhoneNoparam");
//String q;
// statement.executeUpdate("INSERT INTO updatephonebook (LAST,FIRST,PHONE) VALUES ('"+LastValue+"','"+FirstValue+"','"+PhoneValue+"')");
// q= " SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS WHERE REGION_CODE='" +REGION+ "' AND BILL_PERIOD BETWEEN '" + BILL_MONTH_FROM + "' AND '"+BILL_MONTH_TO+"' AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"'";
// System.out.println(q);
java.sql.ResultSet columns = statement.executeQuery
(" SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS4 WHERE REGION_CODE='" +REGION+ "' AND (BILL_PERIOD BETWEEN '"+BILL_MONTH_FROM+"' AND '"+BILL_MONTH_TO+"') AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"' ") ;
//(" SELECT PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS4 WHERE REGION_CODE='" +REGION+ "' AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE='"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"' ") ;
// java.sql.ResultSet columns = statement.executeQuery(q);
// String sql = ("SELECT BILL_PERIOD,REGION_CODE,EXCHANGE_CODE,PHONE_NO,GROSS_CURRENT_BILL,AMOUNT_PAYABLE,NET_ARRERS_AMOUNT,NAME,ADDRESS_1,ADDRESS_2,ADDRESS_3,ADDRESS_4,CONNECTION_TYPE FROM AOTS WHERE REGION_CODE ='"+REGION+"' AND (BILL_PERIOD BETWEEN '"+BILL_MONTH_FROM+"' AND '"+BILL_MONTH_TO+"') AND CONNECTION_TYPE='"+CONN_TYPE+"' AND EXCHANGE_CODE = '"+EXCHANGES+"' AND PHONE_NO='"+PHONE+"') " );
//System.out.println("THE SQL QUERY = " + sql);
//java.sql.ResultSet columns = statement.executeQuery(sql);
while(columns.next()){
String Phone_No = columns.getString("PHONE_NO");
String G_C_Bill = columns.getString("GROSS_CURRENT_BILL");
String Amount_Payable= columns.getString("AMOUNT_PAYABLE");
String N_A_Amount= columns.getString("NET_ARRERS_AMOUNT");
String Name= columns.getString("NAME");
String Address1= columns.getString("ADDRESS_1");
String Address2= columns.getString("ADDRESS_2");
String Address3= columns.getString("ADDRESS_3");
String Address4= columns.getString("ADDRESS_4");
String C_Type= columns.getString("CONNECTION_TYPE");
%>
<TR>
<TD> <%=Phone_No %></td>
<TD> <%=G_C_Bill %></td>
<TD> <%=Amount_Payable%></td>
<TD> <%=N_A_Amount %></td>
<TD> <%=Name %></td>
<TD> <%=Address1 %>,<%=Address2%>,<%=Address3%>,<%=Address4%></td>
<TD> <%=C_Type %></td>
</tr>
<%}
}%>
</table>
</body>
</html> -
Include file in jsp not working
Hi ,
I have an include file statement in my jsp file which is not working. Not getting any error message either only the page is displayed without the jsp file included.
My include code looks like this :
<%@ include file ="Includes/hello.jsp" %>Also i tried including an html file or an image in the same place neither of the two displayed.
<!--#include virtual="includes/footer.html" -->
My jsp file is hosted on IISnb123 wrote:My jsp file is hosted on IIS
Hi ,
I have an include file statement in my jsp file which is not working. Not getting any error message either only the page is displayed without the jsp file included.
My include code looks like this :
<%@ include file ="Includes/hello.jsp" %>Also i tried including an html file or an image in the same place neither of the two displayed.
<!--#include virtual="includes/footer.html" -->
My jsp file is hosted on IIS
Check the path you've specified. It may well be;
<%@include file="hello.jsp" %>or
<%@include file="/Includes/hello.jsp" %> -
Error when using %@ include file="/test.jsp"%&
UsingNitrox version 2.1 M3 (build 419 06022005):
with jdk version: 1.5.0_03 and Tomcat 5.5.9
This is the error :cry: when using <%@ include file="/test.jsp"%> in jsp:
Severity 2
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files (test.jsp)
It used to work in previuos version of Nitrox. I can't use struts tiles because the tiles content is dynamic (run time) and I need it to be static (at compile time).
Have you encountered this problem? What is the fix? Nitrox bug?
I need your help please,
AlbertoM7,
I found the problem :wink: . In the java Build path having the default (ALL) is not picking up the content of the package. I had to use add multiple and include all the folders and subfolders (many L) in my packages. After that I added *.java and *.properties to select all the java files. Now it is working. I assume this is a bug in Nitrox. The default ALL should include the all the files in the path.
Thanks,
Alberto -
My jsp pages use some endcoding as UTF-8.
When I use <%@ include file="myfile.jsp"%> endcoding lose format UTF-8. But
if I use <jsp:forward page="myfile.jsp"/> it work fine.
Pls tell me use <%@include %>
(I use Jbuilder 6 and weblogic server 6.1)
Thanks .
From http://java.sun.com/products/jsp/tags/12/syntaxref1214.html#8828 (emphasis mine):
page="{ relativeURL | <%= expression %> }"
The relative URL that locates the resource to be included, or an expression that evaluates to a String equivalent to the relative URL.
The relative URL looks like a pathname--it cannot contain a protocol name, port number, or domain name. The URL can be absolute or relative to the current JSP page. If it is absolute (beginning with a /), the pathname is resolved by your web or application server.
You could use a servlet in your "path" attribute and have that servlet read and return the page from a different server; there are ways to do what you want, but <jsp:include> isn't one of them. -
HI there
i have a little problem with iweb and including html code.
I use the HTML snipped to include the code
copy paste everything as it should be
this is the code:
<table>
<tr><td>Ihr Name:</td>
<td><input name="name" type="text" size="54"></td></tr>
<tr><td>Ihre Mailadresse:</td>
<td><input name="mail" type="text" size="54"></td></tr>
<tr><td>Ihre Nachricht:</td>
<td><textarea name="text" rows="10" cols="52"></textarea></td></tr>
</table>
It works out finde, save and publish, if i look at my local drive: i see the table .
But if i get this on my Webserver i can not see the table, i just see an empty space where the snipped should be
what is wrong
i tried to make the complete html stuff with head and body and html but i would not work.
iWeb 3.0.4, latest OSXClear the browser cache a reload the page.
Or if that doesn't work, open the Activity window (Command-Shift-A) in Safari and locate the widget-markup file.
Double click that file to open it in a browser window and reload the page if your content doesn't display.
Safari is a bit stubborn to reload that file after it's being updated.
It is assumed you published to the server. -
Problem with JavaBeans in JSP.IT'S URGENT!!!
Hi, i have problems with JavaBeans in JSP.
In a jsp file( locating in ROOT directory of tomcat 4.0.6 :jakarta-tomcat-4.0.6\webapps\root ) i have this code:
<jsp:useBean id="paramBean" class="licentza.ParamBean" />
<jsp:setProperty name="paramBean"
property="nume"
value='<%= request.getParameter("numeUser") %>' />
where ParamBean it's a "bean" class locating in jakarta-tomcat-4.0.6\webapps\examples\web-inf\classes\licentza (licentza is the package i'm using).
And i get this error:
Generated servlet error:
D:\jakarta-tomcat-4.0.6\work\Standalone\localhost\_\dora\intrare2$jsp.java:67: Class licentza.ParamBean not found.
ParamBean paramBean = null;
What is the problem?Thank you.Hi,
Put the class file or the package under :jakarta-tomcat-4.0.6\webapps\root\WEB-INF\classes.
Rajesh -
XML to convert creative html to jsp?
I am trying to find a way to use XML, XSL, etc., to make the process of building web pages at my company easier between the creative team and developers:
1.) The creative team creates the images, text, and html (using Dreamweaver). Please note, the creative team barely knows html, much less xml, xsl, or taglibs.
2.) The creative team then sends me the html pages.
3.) I then need to "convert" the html into jsps. That is, I remove the mock/dummy dynamic content, and replace it with the scriptlets or taglibs that will produce the real dynamic content.
This takes alot of time. On top of that, if the creatives ever need to be changed, I need to send the newly converted jsps back to the creative team. They inevitably mess the jsps up, because they do not understand scriptlets or taglibs. Is there some standard way of dealing with this scenario, so that the creative team and I can work better together, and so that I dont constantly "convert" the html pages to jsps? I know one option is Enhydra's xmlc, but I will have a hard time getting the creative team to adopt that.
thank you,
Davidy don't u eliminate your jsp from your HTML. you can inculde html files as a header and footer.
tell to write a comment tag in html <Html code> <table><tr><td> <!--jsp output--></td></tr></table> <Html code>. you can write a small jsp which can String.indexOf("<!--jsp output-->");. you can easily create header and footer files. for your jsp, u can also change your jsp code like this. -
How to Include html tag in xml
Hi,
Is there any way to include html tags in xml?
For Example, I'm using xsl to get the value of FIELD_1 from fetch.xml
In fetch.xml, I have the tag
<FIELD_1>
<font color='#8080ff'> <font face='Times New Roman, Times' size='28'>Testing font and color</font></font>
</FIELD_1>
But If I tried to read the value from xsl like <xsl:value-of select="FIELD_1"/> I'm just gettig the display 'Testing font and color' without the specified font and color....
How to achieve this?
Thanks
Selva.Hi,
Thanks for the input.
I tried with the below code
<fo:block space-after="5mm" font-family="Arial"><xsl:copy-of select="FIELD_1"/></fo:block>
But I'm getting the below error...
"An invalid XML character (Unicode: 0xa0) was found in the element content of the document."
Below is the code included in the xsl....
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="Values"><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="3cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="simpleA4">
<fo:flow flow-name="xsl-region-body">
<fo:block space-after="5mm" font-family="Arial"><xsl:copy-of select="FIELD_1"/></fo:block>
</fo:flow> </fo:page-sequence> </fo:root> </xsl:template></xsl:stylesheet>
Is there any mistakes in the above code?
Regards,
Selva. -
Dear All ,
I am facing a problem with HTML Viewer . My senario is as follows :
1. I have created one HTML page . On that page there are 4 Images
2. I imported that HTML page in SAP with the help of transaction SMW0
3. I Called that HTML page in my ABAP program using the method "load_html_document" of class cl_gui_html_viewer
4. This is happening perfectly ok on the machine on which all this developement was done.
But the issue is when I execute my ABAP program on a different machine , those Images on that HTML page are not displaying.
Can you please guide me how to remove that machine dependancy?
Regards,
NikhilHi Nikhil,
Please check if the image is properly imported properly. Also check if there is any option which you might have forgotten while imported like dependeency.
Regards
Abhii... -
Dynamic include file in JSP page
<span class="value">Hi
i have index.jsp , this page can include jsp
pages dynamically by passing the name of the page to be included to the
index page with out .jsp , so if i want to include page "code.jsp" i
put: .../index.jsp?page=code , this have to include code.jsp page
i made the following code , but it did not find the file
so can any one help plz ?
String pg=request.getParameter("page");
if( pg!= null && ! "".equals(pg)){
File f=new File(request.getParameter("page")+".jsp");
if(f.exists()){
out.print("file exist");
%>
<jsp:include page="<%=request.getParameter("page")+".jsp" %>" />
<%
}else{
out.print("file not exist");
What does the file existing or not really have to do with it?
You can try it like this:
String pg=request.getParameter("page");
if( pg!= null && ! "".equals(pg)){
String webPath = pg + " .jsp";
String realPath = request.getRealPath(webPath);
File f=new File(realPath);
if(f.exists()){
out.print("file exist");
%>
<jsp:include page="<%= webPath %>" />
<%
}else{
out.print("file not exist");
}Alternatively you could try using a request dispatcher:
RequestDispatcher rd = request.getRequestDispatcher(webPath);
if (rd == null){
// doesn't exist
}
Maybe you are looking for
-
I received the second email notification, that my subscription payment was refused the second time, probably due to, that the related credit card is no longer exist. For buying Skype Credit I use a new credit card but probably the subscription renewa
-
Canon Pixma MP495 not working with mini
I'm trying to use the scanner on my Canon Pixma MP495 with my Mac Mini. The printer works okay, but when I click on the scanner, I get an error that says reopeon or okay - MP Navigator EX quit unexpectedly.
-
Getting A com.bea.control.ServiceControlException When Calling External WS
Here is a little background. Running WLI 8.1.5 Created a jcx/control from an external WSDL Using the control to call the external WS. However, in WLI my JPD just freezes/hangs for a few mins and returns the following exception. Exception : java.lang.
-
How do I force progressive download?
I have an Adobe Media Server all set up and playing videos over RTMP. Users on low bandwith settings experience buffering, on occasion. To combat this, I want to force users to download the entire video before they watch any of it. Through my researc
-
White Balance and other Mayhem
This past weekend I was shooting as usual when unexpectedly for several minutes, it was "open season", anything goes color wise so the footage from that segment is filled with totally inappropriate tints, hues and false coloration like all of the sud