Servlets require downloading ? While .jsp files do not ?
I've deployed my web application and parts of my web application are running servlets which I have declared properly in my web.xml.
Currently my JSP files are able to running perfectly, but my servlet classes are loaded correctly, but my web browser prompts me to download the servlets. The servlet content is correct, but I require the servlets to be run and not downloaded !
Is there anywhere I can configure to make the servlets run properly where they should instead of being downloaded ?
My system is running on Red Hat Linux, Oracle 10g Application Server 10.1.2.0.0.
Thanks in advance.
In your servlets that produce html pages, Do you have
response.setContentType("text/html");
By default, the contentType of .jsp files is text/html. So your .jsp files will be fine.
Similar Messages
-
My JSP file does not reflec the change of a Bean
My test environment: Win 2000, JDK 1.3.1, OC4J(standalone)
My problem:
In servlet, the change of a Strng value is reflected at the next refresh of a browser.
But, when a jsp file call a bean's getXXX(return a String value) method, and if the String value of that bean is changed, the next refresh or visit to that jsp file does not reflect the change of that bean.
For example:
1) TestClass.java
public class TestClass {
private String txt;
public class TestClass {
txt = "Test"; ----- (g
public String getTxt() {
return txt;
2) test.jsp
<html><body>
<h2>
<% TestClass test = new TestClass(); --(h
out.print(test.getTxt()); %> --(i
</h2>
</body></html>
In my first vistit to "http://localhost:8888/test.jsp" the brower shows "Test" String, but after I change the txt value to "Test1"((g) the brower does not reflect the change.
I found that if I use <jsp:useBean id="test" class="TestClass" /> instead of (h-(i line, the brower reflects the change of the bean.
Why does this occur?
Thaks in advance.
PS) In some cases(Not above example), I get the java.lang.ClassCastException.
So Each time I change a Servlet or a Bean, I restart OC4J.
nullSangKyu,
<jsp:useBean > has a property called scope, which defaults to "page".
So the bean gets reset everytime you reload the page.
Can I suggest that you set it to "session"?
The following syntax card I have found userful:
http://java.sun.com/products/jsp/syntax.pdf
Cheers,
Scott
Atlassian - Supporting YOUR 'Orion/OC4J' World
http://www.atlassian.com - [EMAIL][email protected][EMAIL] -
when i download any file it works frequently and downloading start in a second but when i pause the downloading file & after some time when i open it,The downloading not start proper and after some time a message flash 'download error' source file could not be read please try again later or contact the server administrator.
I downloaded the Microsoft Autoruns package and ran it. There are no programs in the LSA Providers tab, and Apple's Bonjour is the only program in the Winsock Providers tab. I also did the "netsh winsock reset" and rebooted. It didn't fix the problem. Any more ideas?
-
When I started my PC this morning I got a pop-up message stating that CC has damaged files and required downloading from www.adobe.com/go/adobecreativecloudapp. Indeed, CC did NOT work and subsequent attempts to download CC never got beyond the initial installer box. The posted link also appears to be bogus I am at my wits end here. Have other users experiences this issue? Is this a clever intrusion?
Please ensure you have the latest version of the Creative Cloud app installed
http://helpx.adobe.com/creative-cloud/release-note/cc-release-notes.html
We also have this solution for the having to sign in on every product launch
http://helpx.adobe.com/creative-cloud/kb/unable-login-creative-cloud-248.html
You can also try uninstalling & re-installing the CC.
Regards
Rajshree -
How to call a jsp file from an servlet and access the jsp file objects??
Hi everybody
I have an jsp file where it contains a vector object with some data and I have a servlet that needs to access this vector object . How can my servlet call for this jsp page and get the vector object. ?
then an applet will be calling this servlet to get some other object created with the data contained within this vector object...so each time Applet ask the servlet for the object the servlet need to call for this jsp page somehow
My main question is the communication servlet-jsp
please if u have any clue I will appreciate it
thanksHi
There are several ways to share objects between JSPs/Servlets.
You can share objects by putting them in the request-in which case the objects lifetime is limited by that of the request, Another way is to store them in the session, againg the lifetime is limited by the lifetime of the session. To have objects that have to persistent over the application life-span use the servletContext to store the objects.
Any good tutorial should help you get started. Please see the link below for a tutorial on Servlets/JSPs
Note: Local variables in the JSP cannot be shared with other components as their scope is limited to that particular Page/Servlet.
Link: http://java.sun.com/docs/books/tutorial/servlets/
Good Luck!
Eshwar Rao
Developer Technical Support
Sun microsystems inc
http://www.sun.com/developers/support -
Image displays in some jsp files but not others
OK, I have a jsf jsp pages js tag for my application that occurs in several jsp pages:
<tr>
<td>
<jsp:include page="/includes/footer.jsp"/>
</td>
</tr> footer.jsp has an image tag like this:
<td align="left"><img src="images/logo.jpg" alt="X Systems"/></td> The jsp files are in a directory which is under the base directory like the include and image files. For some reason, in one jsp page the logo.jpg file does not get displayed. As I understand it, the application server jboss/tomcat resolves the image files. Why would it be displayed it in one page and not another?You are using a relative link to access your image.
That means it will look for your image relative to the page it last served.
If you ask for http://myapp/root.jsp, it will locate http://myapp/images/logo.jsp
If you ask for http://myapp/module/index.jsp it will locate http://myapp/module/images/logo.jsp
If you right click on your image / broken image placeholder and look at its properties, you should be able to see the url which it is trying to fetch the image from.
The client will resolve relative links from the address url it last accessed. It knows nothing of any serverside forwards/includes that you might have done.
So if you access http://myapp/action and forward to /moduel/accounting/balanceSheet.jsp it will still treat the url as http://myapp/action for resolving relative links.
As far as the client is concerned, the root is /
As far as your web application is concerned, the root is /myapp (or whatever your context name is)
Because of this you can't give your images an static absolute url, because you would be hardcoding the context name into your jsp.
Alternatives
- use something like <img src="<%= request.getContextName() %>/images/logo.jsp"/>
- use a tag library to hide the implementation of option #1 (like struts tag html:img)
- only use relative links, and always specify a html <base> on your page to resolve relative links from.
Hope this helps,
evnafets -
How to reference a DatabaseHandler servlet class from a jsp file in Tomcat
Trying to create a database connection in the jsp file in webapps\project folder by referencing the DatabaseHandler class in webapps\project\WEB-INF\classes.
Here is the code in the jsp to make the connection:
DatabaseHandler db = new DatabaseHandler() ;
String sql = "SELECT password FROM cms_users WHERE user =" + userName ;
java.sql.ResultSet rs = db . selectQuery( sql ) ;
Here is the DatabaseHandler class:
import java.sql.*;
public class DatabaseHandler
// instance variables - replace the example below with your own
private Connection connection;
* Constructor for objects of class DatabaseHandler
public DatabaseHandler()
String url = "jdbc:odbc:javadatabase";
// Load the driver to allow connection to the database
try
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
connection = DriverManager.getConnection( url );
catch ( ClassNotFoundException cnfex )
System.err.println( "Failed to load JDBC/ODBC driver." );
cnfex.printStackTrace();
System.exit( 1 ); // terminate program
catch ( SQLException sqlex )
System.err.println( "Unable to connect" );
sqlex.printStackTrace();
public ResultSet selectQuery( String query )
Statement statement;
ResultSet resultSet = null ;
try
statement = connection.createStatement();
resultSet = statement.executeQuery( query );
catch ( SQLException sqlex )
sqlex.printStackTrace();
System . exit( 1 ) ;
return resultSet ;
Here is the error i am getting when i try to run the jsp script:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 2 in the jsp file: /ValidateLogon.jsp
Generated servlet error:
[javac] Compiling 1 source file
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\cms\ValidateLogon_jsp.java:47: cannot find symbol
symbol : class DatabaseHandler
location: class org.apache.jsp.ValidateLogon_jsp
DatabaseHandler db = new DatabaseHandler() ;
^Just like in the class file you need to import any classes that you want to access in the JSP.
http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html -
ITunes:Something went wrong while synchronising files -'could not access'
No issues with synchronising iTunes to previous Windows 7 phone but have now upgraded to a Windows 8 phone. Have managed to get is set up ok and synchronised with some of the songs I selected to sync however, quite a few appear in a pop up box headed 'something went wrong while synchronizing files' and shows as a list of songs with 'could not access...' showing beside each. Anyone able to help please with what's gone wrong?
ThanksNo issues with synchronising iTunes to previous Windows 7 phone but have now upgraded to a Windows 8 phone. Have managed to get is set up ok and synchronised with some of the songs I selected to sync however, quite a few appear in a pop up box headed 'something went wrong while synchronizing files' and shows as a list of songs with 'could not access...' showing beside each. Anyone able to help please with what's gone wrong?
Thanks -
Download of par file is not availlable
I have a trial version of portal 7.1 on my server.
Trying to download a par file from portal:
System Administration -> Support ->
I discovered that the trial version does not make the pars available
for download. I guess that this option is not available in trial version?
Could somebody say if I am right? Otherwise maybe something
Was wrong in the installation!!
ThanksHi ,
In CE7.1, it seems to be there is no feature like upload/download par files.you have to convert into ear files and deploy.
check below blog
Creating an iView in your SAP NetWeaver CE 7.1 portal from a portal component
Koti Reddy -
Both my husband and I have our MacBook Pros backed up to Time Machine. I have a new MacBook Pro and want to download my files, etc. from Time Machine to my new Mac. I do I ensure that Time Machine downloads only MY files to my new Mac, and not my husband's files?
OS X uses a unique identifier so there will be no problems.
-
ITunes can not copy downloaded game, says file can not be found
I downloaded Tetris from iTunes, when I plugged in my ipod, it said the file could not be copied to the ipod because it could not be found. Then it said the same thing about one single song file what does this mean & why did it happen....anyone????????????
Not sure why you got that message but you do need to be aware that you cannot add purchased games to the nano. Those games are only for the 5th gen video ipod. This info is stated on the iTunes Games page.
-
Downloaded ms office files can not open
I am unable to open any "DOWNLOADED" ms office files from windows 8 32 bit version.
But I can create MS office files only issue is with the downloaded files from internet.If the damaged file is important for you, you may use some excel recovery tools to recover them.
There are many excel recovery tools , you can google for them.
I'v used a tool, it repaired my file, you can also have a try.
http://www.datanumen.com/aer/recovery.htm
Hope this helps you~
Julie -
Firefox porpose to download my JSP files !
Hi guys,
I have a jsp web application that propose to the client to download the file .jsp instead of "opening" the file in the client.
It does not happen all the time, and I tried several things, but the problem is still around.
Any help will be greatly appreciated. I can't be the only one to have such a problem ???
BestI found this in another forum, so I am not the only one with this problem, which is a good start !
See below :
Sean wrote:
Hi all,
I have made a web application with JSPs. It seems to work fine with IE.
However, with Mozilla and Firefox, it displays the HTML source
generated by JSP instead of actually showing the HTML page for that
source.
I'm stumped because I haven't found any other msgs on forums with
someone experiencing the same problem. Any help would be appreciated. I
need to fix this urgently.
Thanks
regards
Duke
P.S. It was suggested by someone on another forum that I should check
</head> tag. I have already done that and the HTML code is error free
(or so it seems).
You should show your JSP code, especially start of it.
May be you don't show that this is text/html ???
I am working with JSP for FireFox all the time - it works OK. But my JSP pages start like this:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
May be you skipped such headers?I am confident that I will solve this problem -
Downloaded and Saved Files Do Not Show On Desktop
I've noticed just in the past two weeks that files such as email attachments, photos, or other files downloaded from Safari or Mail do not appear on the desktop where the default location is set. Also, this happens when I save a Word document or a document from another application (it's not application specific) and it's supposed to show up on the desktop. When I go to find them, they're not there. They don't show up in a separate Finder window either. In order to get them to show up, I have to do a spotlight search for them. Spotlight's file path for the file is always to the desktop where it's supposed to be. Once I click on it in Spotlight to see the filepath, then the file shows up on the desktop like it was supposed to. What in the world is going on?
1) This did not start happening after an update.
2) Not application specific - it happens no matter what I try to save to the desktop.
3) It just started happening one day with no apparent reason.
4) My hard drive sounds fine - no unusual noises.Sounds to me like you just need to Repair Permissions with Disk Utility then rebuild launch services database. Use the method described here:
http://www.thexlab.com/faqs/resetlaunchservices.html
This one solves lots of odd problems. And repairing permissions is just the standard first step any time you have a problem. Also, a simple restart can often fix things like this.
Another method can be restarting in Safe Mode, right after the bong hold down the shift key until the login window appears which should say Safe Mode on it. (This automatically fixes a number of things, but if you have any font settings in Font Book you will need to redo them.) Then just restart normally.
Kevin
http://www.bearbyte.blogspot.com/ -
Download error "source file could not be read" when closing tab.
So it seems like when I start a download by clicking a link on a website and I close that tab before the download finishes I get a download error and the file stops downloading.
I first noticed this on some site and thought it was a problem with the site, but then it happened again when I went to download the Flash update.
[http://img818.imageshack.us/img818/3015/screenshot20110605at235.png Screenshot of the error message]
When I run Firefox with add-ons disabled (thanks for the handy menu item) the problem does not occur.Whats the problem with this thing?
One thing i can tell is that i changed some settings in Micromedia Flash, because i learned that they where spying on US, then boom no more download. It stops and tell me it could not be read from the server. Dont remember if it started right after i changed the settings, but its driving me nuts
dang
Maybe you are looking for
-
Hi all, I went to check my email in mail last night and my mobileme account was offline. (Gmail account is online no problem). I clicked to take it back online, but it wouldn't accept my password. My parents also have this address on their mail (2 x
-
HT4356 How do I get the photo paper to print using an app from my iPad?
Has anyone had difficulties using an airprinter. I have been using a crafting app with photos. I selected my HP airprinter To print the project. The first 3 times it worked correctly. Now when I try to print it will not use the photo paper. It will p
-
How do I speed up Lightroom on my new Mac Pro (2013)?
I have tried everything suggested in the forums like running imports in parallel, etc., and all my data is on the super fast built-in PCI-Express SSD of the Mac Pro. However, I have numerous speed problems with Lightroom 5.3 (latest version) when imp
-
Websphere EJB/JAAS interoperability failure
Greetings all, I am attempting to deploy 2 applications on my Websphere server. The first contains a Servlet in a Web Module that performs JAAS authentication using Websphere's WSLogin class. The second contains an EJB in an EJB Module, which invokes
-
Mac won't print; says print file not accepted
My macbook pro won't print to a new wireless printer that I have; no matter what kind of file I'm printing (doc, pdf, jpg, etc), it says that the print file is not accepted. I've even used a usb cable to connect it directly to the printer and it sti