How to export a JSP page into other formats
Hi All!
Actually, I am generating some dynamic reports using the JSP technology. However, i also want them to be exported into other storable formats like .Doc, .xls or .pdf.
Is there any way of doing it? plz help. its urgent. Someone told me this could be done using JSF technology. Hence I am posting this thread here.
Plz Help!
Thanks & Regards,
Rajat Aggarwal
For outputting h:datatables (but not whole page) to excel, you can check out jsfexcelcreator
http://www.jroller.com/page/mert?entry=jsfexcelcreator_sample_webapp_is_out
Similar Messages
-
How to deploy a JSP page into my APEX application?
hi all,
i am using a JSP to upload multiple spreadsheets into the db. i want to deploy it on the APEX and use it as part of my APEX application's uploading feature.
i already have the JSP file with me. can somebody please tell me how to put that onto the APEX?
Thanks,
BasavarajOne way using JSP portal is, creating Portal project with JSP Dynpage applications
You can use NWDS tool to create JSP Dynpage based Portal components.
Procedure to create and deploy Portal components,
1. Open Enterprise Portal Perspective in NWDS
2. Create -> new Portal Project -> Give the valid name
3. Right click on the project -> Choose Portal Object -> JSP Dynpage -> Give all the information including JSP name. -> Finish
4. Right Click on the project structure -> Properties -> Java Build Path -> All the following jars
htmlb, com.sap.portal.html_api.jar, servlet
5. Navigate to your JSP page located under the folder PORTAL-INF, Write logic
6. Right click on the portal projet-> Refresh -> Re-Build
7. Right Click on the portal project -> Export -> Give the Valid Portal serverdetails, Admin user name and password
8. You can create iView (iView from PAR) in content admin for the developed portal component
Ram -
How to convert a JSP page into a PDF file?
I am calculating and generating a bill in JSP?
I want the output JSP page from the server to get converted to a PDF file.
How to do this?
Please help me doing this!Hai CeciNEstPasUnProgrammeur
Actually I didnt mean what you are asking?
I will put it in this way,
I am having a JSP output.
If I save that page in the browser it should get
saved as a PDF File,
This is my problem,As far as I can see, you have two options:
1) Ensure you have some kind of rendering tool installed on the server, render your JSP to that engine, capture the output as an image and transform the image to a PDF. Or a variation on that server-side theme.
2) Take the data you would be/are pushing into a JSP, offer a "download" facility that just takes that data and wraps it into a PDF. Your server then serves out that PDF file.
To save the browser view (your JSP) as a PDF each client machine would need to be set up with some mechanism to capture and save as PDF. You can't control that.
I've had to do something similar in the past. In that case though we had a simplar task of just generating a stored HTML file that we could store in the DB and lock down. Our approach was to use XSLT over the generated XML data structure.
I'd advise you doing the same and generating an XML file and then running an XSLT/FO process over it to generate your PDF file. Don't try to do all the fancy stuff on the client environment, that's an environment you usually have very little control over. -
How to load a Nav page into other pages?
Hi, I am using CSS and HTML. I am not using a template. Not
an expert.
I want to have just one page with all main navigation links.
Parent link/list and subordinate links/list as drop down. No page
templates.
How can I get pages 1 to 10 to load a 2nd page that possesses
all the nav links? Would load into an <iframe> but first I do
not want to use that. Second I do not know how to z-index it so the
drop down links are on top of any page 1-10 info that is in the
way?
The Parent Nav link/list is horizontal and only needs to show
main parent row. Subordinates will drop down. Do not want to have
to have 1 row showing for all possible drop down rows. Ex.
Header
<div>Parent link/list with drop downs that z-index to
on top
<div>other things
currently I get loose all drop downs to <div>other
things.
How can I accomplish this?[nav.php]
<!-- Begin Navigation -->
<div id="navigation">
<ul class="nav">
<li><strong> <a href="
http://www.timlist.net/"
target="_parent">Home</a> </strong></li>
<li><strong><a href="
http://timlist.net/arianna.html"
target="_parent">Arianna</a></strong>
<ul>
<li><a href="
http://timlist.net/arianna/art.html"
target="_parent">Art</a></li>
<li><a href="
http://timlist.net/blog.html"
target="_parent">Blog</a></li>
<li><a href="
http://www.charitynavigator.org/"
target="_parent">Charity Navigator</a></li>
<li><a href="
http://timlist.net/not_ready.html"
target="_parent">Gallery</a></li>
<li><a href="
http://timlist.net/not_ready.html"
target="_parent">The Word</a></li>
<li><a href="
http://timlist.net/not_ready.html"
target="_parent">Safety</a></li>
<li><a href="
http://timlist.net/memorial.html"
target="_parent">Memorial</a> </li>
</ul>
</li>
<li><strong><a href="
http://timlist.net/boating.html"
target="_parent">Boating</a></strong>
<ul>
<li><a href="
http://timlist.net/boating/brands.html"
target="_parent">Boat Brands</a></li>
<li><a href="
http://timlist.net/boating/types.html"
target="_parent">Boat Types</a></li>
<li><a href="
http://timlist.net/boating/sales.html"
target="_parent">Buy & Sell</a></li>
<li><a href="
http://timlist.net/boating/drives_fuels.html"
target="_parent">Drives &
Fuels</a></li>
<li><a href="
http://timlist.net/boating/education.html"
target="_parent">Education</a></li>
<li><a href="
http://timlist.net/boating/fishing.html"
target="_parent">Fishing</a></li>
<li><a href="
http://timlist.net/boating/misc.html"
target="_parent">Miscellaneous</a></li>
<li><a href="
http://timlist.net/boating/terms.html"
target="_parent">Terminology</a></li>
<li><a href="
http://timlist.net/boating/stores.html"
target="_parent">Stores</a></li>
</ul>
</li>
<li><strong><a href="
http://timlist.net/camping.html"
target="_parent">Camping</a></strong>
<ul>
<li><a href="
http://timlist.net/camping/camping_buy_sell.html"
target="_parent">Buy/Sell</a></li>
<li><a href="
http://timlist.net/camping/camping_clubs_forums.html"
target="_parent">Clubs</a></li>
<li><a href="
http://timlist.net/camping/camping_games_cooking.html"
target="_parent">Cooking</a></li>
<li><a href="
http://timlist.net/camping/camping_clubs_forums.html"
target="_parent">Forums</a></li>
<li><a href="
http://timlist.net/camping/camping_games_cooking.html"
target="_parent">Games</a></li>
<li><a href="
http://timlist.net/camping/camping_gear.html"
target="_parent">Gear</a></li>
<li><a href="
http://timlist.net/camping/camping_grounds_guides_mags.html"
target="_parent">Grounds</a></li>
<li><a href="
http://timlist.net/camping/camping_grounds_guides_mags.html"
target="_parent">Guides</a></li>
<li><a href="
http://timlist.net/camping/camping_hardware.html"
target="_parent">Hardware</a></li>
<li><a href="
http://timlist.net/camping/camping_grounds_guides_magazines.html"
target="_parent">Magazines & News</a></li>
<li><a href="
http://timlist.net/camping/camping_misc_safety.html"
target="_parent">Miscellaneous</a></li>
<li><a href="
http://timlist.net/camping/camping_manufacturers.html"
target="_parent">Manufacturers</a></li>
<li><a href="
http://timlist.net/camping/camping_safety.html"
target="_parent">Safety</a></li>
</ul>
</li>
<li><strong>Customer Service</strong>
<ul>
<li><a href="
http://timlist.net/customer_service/customer_service_101.html"
target="_parent">Basics 101</a></li>
<li><a href="
http://www.timlist.net/customer_service/customer_service_reviews.html/"
target="_parent">Reviews</a></li>
<li><a href="
http://www.timlist.net/customer_service/customer_service_reviews_template.html/"
target="_parent">Templates</a></li>
</ul>
</li>
<li><strong>Diesels</strong>
<ul>
<li><a href="
http://timlist.net/trucks/diesel_trucks.html"
target="_parent">Diesel Trucks</a></li>
<li><a href="
http://timlist.net/trucks/forums.html"
target="_parent">Forums</a></li>
<li><a href="
http://timlist.net/trucks/fuel.html"
target="_parent">Fuel</a></li>
<li><a href="
http://timlist.net/trucks/misc.html"
target="_parent">Miscellaneous</a></li>
<li><a href="
http://timlist.net/trucks/parts_repair.html"
target="_parent">Parts Repair</a></li>
<li><a href="
http://timlist.net/trucks/studies.html"
target="_parent">Studies</a></li>
<li><a href="
http://timlist.net/trucks/towing.html"
target="_parent">Towing</a></li>
</ul>
</li>
<li><strong><a href="
http://timlist.net/family.html">Families</a></strong></li>
<li><strong><a href="
http://timlist.net/gallery.html">Galleries</a></strong></li>
<li><strong><a href="
http://timlist.net/search.html">Search-It</a></strong></li>
<li><strong>Technology</strong>
<ul>
<li><a href="
http://timlist.net/technology/audio.html"
target="_parent">Audio</a></li>
<li><a href="
http://timlist.net/technology/forums_support.html"
target="_parent">Forums</a></li>
<li><a href="
http://timlist.net/technology/graphics.html"
target="_parent">Graphics</a></li>
<li><a href="
http://timlist.net/technology/hardware.html"
target="_parent">Hardware</a></li>
<li><a href="
http://timlist.net/technology/html.html"
target="_parent">HTML</a></li>
<li><a href="
http://timlist.net/technology/java.html"
target="_parent">Java</a></li>
<li><a href="
http://timlist.net/technology/misc.html"
target="_parent">Miscellaneous</a></li>
<li><a href="
http://timlist.net/technology/programing.html"
target="_parent">Programming</a></li>
<li><a href="
http://timlist.net/technology/software.html"
target="_parent">Software</a></li>
<li><a href="
http://timlist.net/technology/stores.html"
target="_parent">Stores</a></li>
<li><a href="
http://timlist.net/technology/forums_support.html"
target="_parent">Support</a></li>
</ul>
</li>
</ul>
</div>
<!-- End Navigation --> -
How to export/convert FCE movies into AVCHD format?
I have read a number of topics addressing similar questions but haven't yet found a satisfactory explanation of why it is not simple to do the opposite of what the Log and Transfer function does when importing AVCHD footage in FCE.
The footage shot by camcorders is heavily compressed (my Sony camcorder generates 24 Mbps -that's BIT, not BYTE, per second- at its highest rate), thanks to their on-board processor (BIONZ in the case of my camera: http://www.sony.com.sg/microsite/dslr/technologies/bionz.html). Yet, when played by hardware (such as the camcorder itself) on a HD-TV, the movies look gorgeous. Hence, this is a perfectly acceptable compression. And it does not take an enormous amount of memory. For instance, a ~10 min sequence encoded at 17Mbps on my camcorder occupies ~2GB.
However, once imported by FCE, each frame is individually extracted for ease of editing, and the size explodes. So exporting the resulting edited movie (in 1080HD) as a QuickTime movie is a recipe for rapid hard drive saturation (and YouTube export failure). I have tried several codecs offered by FCE (H.264, mp4) but the resulting compressed videos are still humongous (North of 5 GB for the example I mentioned).
It would seem that what the BIONZ processor achieves in real-time should be within reach of a modern CPU at a much slower pace (we are used to several hours of rendering, aren't we?). Yet, that is not the case. Is there a good reason for that?
Thanks for your comments.Tom,
I first noticed it when looking at the videos created by FCE (that was the origin of my post) played in QT. Usually I play them at the default size chosen by QT for my screen, which is something like 1400 x whatever.
The problem (in QT) occurs at any viewing size. It is of course less apparent at smaller size, but it's there.
Then having figured out that I would not improve the output, I looked at the sequence in FCE. Looking at the video played in the Canvas, the jagged edges are there. Of course to see them well, it is best to zoom a bit, but they are there at any size.
Having figured this out, I tried to reimport the original footage using Log and Transfer. The window that opens has a preview, and I saw the jagged edges there too (whatever size the preview panel was set to). I could not find any settings that I could play with to avoid this problem.
My naive conclusion is that FCE does not know how to handle 60i footage as "well" as my TV does. I am ready to believe that in reality FCE does a more accurate job of rendering the two fields into a single frame, but as a viewer, I prefer the rendering of my TV. And since both engines have been designed by humans, I would tend to say that the engineers of my Samsung TV had a better grasp of what is a good rendering of a 60i footage than did the engineers at Apple (or elsewhere) who wrote FCE.
Now, I may be missing some basic thing here, and I am ready to learn.
BTW, the jagged edged effect I am seeing is what is shown on the first picture of the wikipedia page you pointed me to. -
How to send the jsp page to .txt format
Hi All
Please suggest me how to create a .txt file using the desformat. My requirement is file should be saved as txt format and it will be sended by mail to be user pager. He can see the txt file through his pager. I tried several techniques but it not working.
I am using the following URL:
http://123.223 /reports/rwservlet? report=Admission.jsp&destype=file&desname=c:/demo/Admission.txt&userid=am/ampazz@tempdb
The above URL is correct or any changes required.
Pls suggest me…
Thanking all
Regards
SrinivasSome of the points might help you in thinking towards right direction, you might already know this but doesn't look like you are following in your code anyway.
1. The JSP that you are emailing is uncompiled source file. It need JVM environment to be able to run on.
2. The JSP is a view technology so try to separate the view logic from the business.
3. Try to put entire business logic in a Bean and use that in your JSP to start off with.
You may need to write the HttpServletResponse#content on to the Writer and then persist it on the filesystem. and then send that persisted file as an attachment.
Have a look at http://java.sun.com/j2se/1.5.0/docs/api/java/io/Writer.html
It provide different type of writer implementations.
HttpServletResponse#getWriter() provides PrintWriter instance.
Does it make sense? -
How to export edited 5D material into same Format
Hello ppl!
Just maybe someone can help me with this one...
I know it is more of Technical side of 5D, but my Q has something to do with it;
As we know, 5D shoots video, compresses it with H.264 codec and saves it in .MOV container!
For EDITING purposes I use ADOBE CS5 (strong working station with CUDA Mercury engine and everything)...
Anyhow, I was just shooting "Making Of" for some Feature film - and what I wanna do is CLEAR FOOTAGE MATERIALS of unnecessary parts - and then export it back to HDD and give it to Film production
But how do I get to export edited material in the same container and with same properties as originally shot footage was????
ADOBE has quite powerful MEDIA ENCODER, but you can't save h.264 file to have .MOV extension!!!
You can choose H.264, but then your file will have [b]*.mp4[/b] extension... -- Further on - will that file be of the same quality as the file I downloaded from my CF-card???
Any ideas about that - or maybe an advice for some other ENCODER???? ----- Just don't suggest MAC cause I can't afford it at the moment!!!!
What I can do is use AVID MEDIA COMPOSER 4 or 5 (also on my Windows workstation) - but since AVID recodes all footage as the first step when importing it, I am not sure it would fullfill my needs!!!!!
Hope someone will know how to handle it!!!!
Cheers!
V:-You see, the problem is that my Premier, actually my Adobe Media Encoder can't export to any MOV file higher than Standard Def... Why is it so, I don't know, maybe cause my QT isn't PRO???? Do you think that going PRO would help this matter?
No, you don't need QT Pro for export (or import, for that matter). Are you selecting Preset or Video Codec in the Export Settings window? Like this:
Do you have these, or at least most of them?
-- you also mention ProRes and Proxy here as well, but I am stuck with PC - I wonder how are those AVID QT CODECS gonna work with PREMIERE - are they also gonna re-encode the entire material???
The Avid codecs work fine with Premiere on a PC--I use them frequently myself. But, yes--regardless of the codec you use to export these files, they will be transcoded/re-encoded. I just checked with an FCP buddy, and he said that his Canon T2i clips (similar/same format to the 5D) will import directly into FCP, so if that's what you're using on the Mac, you can forgo the transcoding. That said, transcoding to DNxHD (or ProRes) is not going to incur a visual quality hit, though the files will be larger.
- which Format (codec) are the final files gonna be???
H.264! They're the same as the originals, just trimmed to length.
- Thanx for that one! I hope it works on Windows as well, since Windows is my OS - and thnx for coupon code:))))
Well, you use this plug-in on the Mac; it enables you to read NTFS-formatted drives on the Mac. You'd just continue to do what you've always done, and the Mac user would need the plug-in. If you want to read HFS formatted drives on a PC, you can use Paragon HFS for Windows or MacDrive. Either of those will be good for HFS drives on a PC. Of course, you only need one of these drivers; either NTFS on Mac, or HFS on PC.
There was some mention of using Quick Time PRO as only solution here... Do you have any idea what is that all about??? What can be done - editing wise - with QT PRO??? Or is it just bringing up some more Codecs into the game????
I prefer MPEG Streamclip; it does all the editing (well, the editing you need) that QT Pro does, and it doesn't cost anything. I recommend checking that out first before sending Steve Jobs any money -
Convert jsp page into xml or dom for search
Hello everyone,
I have to build an application that searches for message beans in all jsp page. I did it the traditional way, using scanner and string methods. Its working but its not perfect. So i want to convert all my jsp page into xml format and then process them. My jsp pages are quite complicated. I used some jars that convert them into jspx . But its not working. Please help
Thanks in advanceWell its like this.I need to develop a program that reads all the message bean keys.. We have lots of struts webapps. All messages in the jsp pages have been externalised and internationalised. Now i have to build a program that given a webapp path prints out all the message bean keys used in the webapp. I have developed the program using the Plexus Directory scanner to filter all the jsp pages and java util Scanner to read line by line and used String functions to search for keys.
Now thats not the best soultion. The best way, imo, is to cinvert the jsp into xml pages and then we can parse the xml pages easily. The' problem is to find a way to convert the jsp pages(jstl +javascript) into xml.
Can you help me out?
Thanks -
How to add Jsp pages into existing portal (JDeveloper 9.0.4)
I am a jsp developer. I have to add a jsp page into existing portal. I am new to portal. Could anyone help me how to develop jsp using portal classes like PortletRenderRequest,ProviderSession and others.
Rigoberto, there should be no space between "-Xbootclasspath/p:" and the path "C:\oracle\infra\jdbc-10.1.0.4\ojdbc14.jar;C:\oracle\infra\jdbc-10.1.0.4\orai18n.jar"
By the way, one can always take a look at the logs at
$ORACLE_HOME/opmn/logs
especially those files whose names start with OC4J~ if there is some wrong with oc4j processes. Those files are the default oc4j stout and sterr. If oc4j can not init, there should be some kind of error message in them.
By the way, the following line may be deleted since no property file is specified.
<data id="oc4j-options" value="-properties"/>
Hope this helps. -
Exporting Content of a JSP page into Excel Spread Sheet
I am trying to export the content of a JSP page into an excel spread sheet. I know this issue had been posted before, but if you any one has the source code of a sample that's working please send it to me at [email protected]
Your help is appreciated.
Jamais.http://forum.java.sun.com/thread.jspa?threadID=664249
-
Hi,
The pdf file that I am converting has multiple pages but the conversion only exports the 1st page into excel. How do i get the product to include all pages on multiple sheets?Hi christinek,
Can you please tell me how the PDF that you're converting was created? Sometimes, PDF files created by third-party PDF generators (that is non-Adobe applications), don't contain all the tags and file information necessary to ensure a proper conversion to Excel. There are no settings that you can change in ExportPDF to adjust how the file is imported.
You can tell how the PDF was created by choosing File > Properties in Reader and looking for the PDF Producer on the Description tab. If the PDF was created by a third-party, it just may not be written to spec. Please see Support Policy for PDF Files created by non Adobe applications.
Best,
Sara -
Ive just learned that i can use loadjava to load jsp pages into the database.
Ive just learned that i can use loadjava to load jsp pages into the database. How is that possible. How can someone go to my lets say, index.jsp page and actually see it if its inside the database? What authenticates it? Where would you set the parameters to tell http(apache) to look inside the db for the pages?
Any ideas?Thanks for the reply. If I put the file on the database, does it have to be in a particular location? I've put it on the database server, launched sql*plus (as APPS) and ran the following:
execute dbms_java.loadjava('-v', 'ZebraGetPrinterFromXML.class');
PL/SQL procedure successfully completed.Then when I try to run a process that uses this I get this:
ORA-29540: class ZebraGetPrinterFromXML does not exist -
Combine two jsp pages into single
hai how to combine two jsp pages in to one
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
import com.latchiya.Constants;
import com.latchiya.model.Staffinfo;
import com.latchiya.service.Manager;
import com.latchiya.webapp.form.StaffinfoForm;
* Action class to handle CRUD on a Staffinfo object
* @struts.action name="staffinfoForm" path="/staffinfos" scope="request"
* validate="false" parameter="method" input="mainMenu"
* @struts.action name="staffinfoForm" path="/editStaffinfo" scope="request"
* validate="false" parameter="method" input="list"
* @struts.action name="staffinfoForm" path="/saveStaffinfo" scope="request"
* validate="true" parameter="method" input="edit"
* @struts.action-forward name="edit" path="/WEB-INF/pages/staffinfoForm.jsp"
* @struts.action-forward name="list" path="/WEB-INF/pages/staffinfoList.jsp"
* @struts.action-forward name="search" path="/staffinfos.html" redirect="true"
public final class StaffinfoAction extends BaseAction {
public ActionForward cancel(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return mapping.findForward("search");
public ActionForward delete(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'delete' method");
ActionMessages messages = new ActionMessages();
StaffinfoForm staffinfoForm = (StaffinfoForm) form;
// Exceptions are caught by ActionExceptionHandler
Manager mgr = (Manager) getBean("manager");
Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
mgr.removeObject(Staffinfo.class, staffinfo.getStaffId());
messages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("staffinfo.deleted"));
// save messages in session, so they'll survive the redirect
saveMessages(request.getSession(), messages);
return mapping.findForward("search");
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'edit' method");
StaffinfoForm staffinfoForm = (StaffinfoForm) form;
// if an id is passed in, look up the user - otherwise
// don't do anything - user is doing an add
if (staffinfoForm.getStaffId() != null) {
Manager mgr = (Manager) getBean("manager");
Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
staffinfo = (Staffinfo) mgr.getObject(Staffinfo.class, staffinfo.getStaffId());
staffinfoForm = (StaffinfoForm) convert(staffinfo);
updateFormBean(mapping, request, staffinfoForm);
return mapping.findForward("edit");
public ActionForward save(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'save' method");
// Extract attributes and parameters we will need
ActionMessages messages = new ActionMessages();
StaffinfoForm staffinfoForm = (StaffinfoForm) form;
boolean isNew = ("".equals(staffinfoForm.getStaffId()) || staffinfoForm.getStaffId() == null);
Manager mgr = (Manager) getBean("manager");
Staffinfo staffinfo = (Staffinfo) convert(staffinfoForm);
mgr.saveObject(staffinfo);
// add success messages
if (isNew) {
messages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("staffinfo.added"));
// save messages in session to survive a redirect
saveMessages(request.getSession(), messages);
return mapping.findForward("search");
} else {
messages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("staffinfo.updated"));
saveMessages(request, messages);
return mapping.findForward("edit");
public ActionForward search(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("Entering 'search' method");
Manager mgr = (Manager) getBean("manager");
request.setAttribute(Constants.STAFFINFO_LIST, mgr.getObjects(Staffinfo.class));
return mapping.findForward("list");
public ActionForward unspecified(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return search(mapping, form, request, response);
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
import com.latchiya.Constants;
import com.latchiya.webapp.form.UploadForm;
* This class handles the uploading of a resume (or any file) and writing it to
* the filesystem. Eventually, it will also add support for persisting the
* files information into the database.
* <p>
* <i>View Source</i>
* </p>
* @author Matt Raible
* @struts.action name="uploadForm" path="/uploadFile" scope="request"
* validate="true" input="failure"
* @struts.action-forward name="failure" path="/WEB-INF/pages/uploadForm.jsp"
* @struts.action-forward name="success" path="/WEB-INF/pages/uploadDisplay.jsp"
public class UploadAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Did the user click the cancel button?
if (isCancelled(request)) {
request.removeAttribute(mapping.getAttribute());
return (mapping.findForward("mainMenu"));
//this line is here for when the input page is upload-utf8.jsp,
//it sets the correct character encoding for the response
String encoding = request.getCharacterEncoding();
if ((encoding != null) && (encoding.equalsIgnoreCase("utf-8"))) {
response.setContentType("text/html; charset=utf-8");
UploadForm theForm = (UploadForm) form;
//retrieve the name
String name = theForm.getName();
//retrieve the file representation
FormFile file = theForm.getFile();
//retrieve the file name
String fileName = file.getFileName();
//retrieve the content type
String contentType = file.getContentType();
//retrieve the file size
String size = (file.getFileSize() + " bytes");
String data = null;
String location = null;
// the directory to upload to
String uploadDir =
servlet.getServletContext().getRealPath("/resources") + "/"
+ request.getRemoteUser() + "/";
//write the file to the file specified
File dirPath = new File(uploadDir);
if (!dirPath.exists()) {
dirPath.mkdirs();
//retrieve the file data
InputStream stream = file.getInputStream();
//write the file to the file specified
OutputStream bos = new FileOutputStream(uploadDir + fileName);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
bos.close();
location = dirPath.getAbsolutePath()
+ Constants.FILE_SEP + file.getFileName();
//close the stream
stream.close();
// place the data into the request for retrieval on next page
request.setAttribute("friendlyName", name);
request.setAttribute("fileName", fileName);
request.setAttribute("contentType", contentType);
request.setAttribute("size", size);
request.setAttribute("data", data);
request.setAttribute("location", location);
//destroy the temporary file created
file.destroy();
//return a forward to display.jsp
return mapping.findForward("success");
===========================================================================================
i want to get second jsp file ie upload file to student file
if anybody know please tell i am new to java side
regards
rangaur not able to give solution
insted giving comment mind ur words being in software fied
commentting like bad words not good i warn u mind ur words -
Including a JSP page into a JSF page
Hi !!
I have read some posts here about <f:subwview>. There says to use:
<f:subview>
<jsp:include page="somepage.jsp"/>
</f:subview>But it does not work.
How can i include a jsp page into a JSF page?
Thanks !!!Hi,
Replace <jsp:include page="somepage.jsp">
with <%@ include file="datasetView.jspf" %>
See thread: http://forum.java.sun.com/thread.jspa?messageID=3413354� -
hello to all of u
i m bit comfortable with SERVLET and please tell me that how to run a JSP page.i m using TOMCAT.
someplace it is written that " write the program ,save under the root of tomcat i.e in my system it is tomcat 4.1 and to store in tomcat4.1\helloworld.jsp ,,, and then after start the server write in the url --:
http://localhost:8080/hello.jsp.
but it is giving error while running.please tell me the procedure.
thank you
byeWhy oh WHY do you want to fiddle with the server.xml file?
You don't need to.
Under tomcat is a directory called "Webapps"
This is where you put your web applications.
You will see there is an existing one there called ROOT - which funnily enough is the root one used for Tomcat.
If you put your hello.jsp in the ROOT directory, http://localhost:8080/hello.jsp will work.
However it is not recommended to use the ROOT directory. Make your own one.
Create a new directory in the "Webapps" directory eg "test"
Put your jsps in here.
under test create a directory called "WEB-INF"
Copy the web.xml file from [TOMCAT_HOME]/webapps/ROOT/web-inf into the new web-inf directory.
Now go to http://localhost:8080/test/hello.jsp
Cheers,
evnafets
Maybe you are looking for
-
I set up some policies that were working fine under 1.0.04 that are no longer working under 1.0.06 b. I have tried modifying with all sorts of options and nothing is working. Has anyone else found a combination that works? Or can anyone confirm th
-
A World image instead of apple
Today when I turned on my MacBook i saw a diferent image, was a world blinking twice then the apple appears as usual. What does it mean?
-
Adding photo to an iMovie is an exercise in frustration
I have iMovie 08 on Leopard 10.5.3. On my account I can create a movie, add (mp4) clips, add photos, add music and all is well. On my sons account for whatever reason we can't add photos to a movie project. He has pictures imported into iPhoto from a
-
I have a WRT54G router that was working fine until a couple of days ago when it quit on me. The power light is not on, but the other LED's are on. I cannot connect to the router, so what should I do to fix this?
-
InDesign CC crashes upon opening 2010 & 2011 files.
Every InDesign document that was created from January 27th, 2010 to December 21, 2011 caused InDesign CC to crash 100% of the time-tested it on two production computers with the same results. Every document that was created after January 1, 2012 open