I've generated a PDF using iText with form fields and a submit button that POSTS the data as FDF. I dedcided to use POST instead of GET because of the size of data that needs to be submitted. I would like the client to open this PDF in the standalone Acrobat Reader application. In the servlet, I can read in the streamed data. My problem now is, how would I display the streamed data on a webpage?
I searched SO and it looks like a similar question was asked here:
Sending 'success' response back to Acrobat Reader from java servlet
Reading Bruno's answer, it looks like my only option is #2 but unsure of how I would stream the form's data to the server, and then back a webpage to display.
Thanks for the any help, input or suggestions!
Thanks to the comments, we were able to establish that you are asking two simple things.
You are trying to merge an FDF file with its original form. This is done using the FdfReader class in combination with "traditional" form filling: Write FDF to PDF using iTextsharp
You want to return the result to the end-user and have him open it in Adobe Reader: Read PDF file and offer it as download with iText
I realize that this answer doesn't conform with the rules on StackOverflow, as it is a "link-only" answer. My other options would have been: marking the question as duplicate (but then I'd only be able to pick one of the two answers that need to be combined), or adding my answer as a comment, but then it would look as if the question isn't answered.
This question already has answers here:
HttpServletRequest - how to obtain the referring URL?
(4 answers)
Closed 7 years ago.
I want to determine the website from which the request to the particular website has been called.
For Example..I have a website www.ex.com.
Now this website link has been there on three websites www.a.com, www.b.com, and www.c.com.
Suppose one user has clicked the link from www.a.com to go to www.ex.com. Now I want to determine that the request has come from the www.a.com and then the page in www.ex.com will be displayed accordingly.
Similarly if the user has clicked the www.ex.com link from www.b.com then the page will be displayed accordingly.
So how can I determine this request source, means from which website www.ex.com has been called?
It is good if you will explain this using code in PHP and JAVA.
I don't know about in Java, but in PHP you can use $_SERVER['HTTP_REFERER'].
I have plans for a small application, to gather some data from a website.
The website have a few textboxes, in which you can write different numerical values, then click a button and an output value will be written on the page.
What i want the application to do, is to fill the textboxes, then "click" the button and gather the output data.
Now i'm only really familiar with java, but my guess is that it's better to write such an application in javascript?
Also if it's doable in java, should i then be looking at some custom libaries, apart from jsoup which i've already used?
I already sort of figured out how to download the html and extract the data i need using jsoup, it's writing the values back into the textboxes that troubles me.
Thank you
There is an implementation of the DOM(Document Object Model, a data structure representing webpages as object trees) in jsoup that can help you to change the textboxes' values. If you're going to code your project in Java, then JSoup is the better choice to do the job.
This question is related to a previous question
Passing Variable from page to page using ASP.NET (C#) without using QueryString
The difference in my case is that the request is coming from a different website (in java) to my website (in asp.net). I do not want the variable to appear in url.
Any suggestions !!
To explain my scenario, we are making a webpage(plugin), which can be called from any other website. To authenticate request, i am looking for a mechanism when other website will pass id & auth-key to my page. This i can use to authenticate the request. I do not want these variable to be visible.
A POST operation would work. The variable would still be part of the request, but it would not be readily visible to the user. I say "readily" visible because it won't be part of the requested URL, but it would be visible if they were to use a tool like Firebug. Short of sharing a database or some other form of "out-of-band" communication, I'm not sure it can be done any other way...
Well as chris mentioned doing a POST is the best way to achieve this. Else you can look at using javascript to achieve the same. Its pretty easy to use JS libraries to achieve the same.
Some of them that come to my mind are
a) Jquery
b) YUI
c) EXT (now Sencha i guess)
But I would definitely recommend jquery.
With jquery you have apis to do post operations. here is more on how to achieve the same.
http://api.jquery.com/jQuery.post/
Hope that helps.
I don't think it can be done without a query string. I know sessions won't work because sessions cannot be shared between Java, Asp, Asp.net, Php etc..., at least not nativly. If you have a database where you store the sessions, you can always use a session id in a query string and therefore simulate cross-language-sessions.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am teaching a web development course at a CS department, I wrote most of the final test by now, each question focus on a specific feature or a specific technology,
I wonder if you can think of/recommend a question that combine the knowledge of few technologies..
The course mostly covers: HTML, CSS, JS, HTTP, Servlets, JSP and JDBC.
(as well as AJAX, ORM, basic security issues like SQL-Injection and XSS, HTML5, REST APIs)
EDIT: I will super appreciate questions with answers :-) thanks!
I'll give the bounty to the question with the highest rank, so please vote! I honestly like most of the questions here, thank you all :-)
Explain the relationship of the DOM to
each of the following technologies:
HTML, CSS, JavaScript.
The goal here is for the answer to make clear the student understands that HTML generates a DOM structure, CSS affects how that structure is rendered, and JavaScript affects how that structure is modified. If you understand how it all ties back into the DOM, all client-side coding becomes straightforward.
Fun question :-) How about...
On web development you need to separate content, style and behavior. Describe why this is done and what different technologies you use in which layer. Every acronym should be written in full text on first time use. (10 p)
or...
Describe what happens in a Web Browser (step by step) when a web page is transferred on the internet from a Web server through HyperText Transfer Protocol to a Client. Consider all the different technologies you have used in this course. (10 p)
Explain what happens, and which technologies could be used, when a user logs in to a protected web site using form based login that sets a HTTP cookie. (Starting from the HTML form all the way to the database and back to the browser.) Bonus question: What changes, when using AJAX for the login?
Answer (main points):
HTML: Form (using POST) with text input fields and a button. Security: Form sends via HTTPS. The login page itself should also be a HTTPS page (otherwise, the form could be replaced by mallory -> MITM)
Javascript: Performs some basic validation (e. g. empty password), and displays error message before sending to server.
Servlet: Receives POST request, takes username/password parameters (in plaintext), calculates (salted) hash from password, discards plaintext password.
JDBC: Selects hashed password from DB. Used to compare with the transmitted password.
Servlet: On success, creates a new session (leads to the creation of a cookie header). Prepares objects that will be used in the JSP page (and stores them in the session or request scope).
JSP: Prepares the HTML page that will be sent to the browser.
Browser: Receives HTTP response, sets cookie and displays the page.
Bonus (AJAX): The server doesn't have to prepare the entire page, but only sends the necessary data and/or HTML snippets to the client. The browser doesn't reload the entire page, but modifies the current page using JavaScript. Security: AJAX can't perform Cross-Site requests, so it's impossible to have a HTTP page submit the login data via HTTPS.
Caution
It should be noted, that this is not meant to be used as a HOWTO for building a secure login mechanism. This description is simplified and doesn't cover every security aspect. OTOH, as an exam question, it should probably be simplified further and adjusted to the content of the curriculum.
You can ask to explain how to implement MVC pattern. And in this MVC pattern where does each technology come in use. Rather How and Why ?
Since students have already developed simplified twitter during their course, you may ask a question like what additional steps they would do to make it a real twitter website or a clone of it and ask to describe each steps staring from html to ORM / database. You may explicitly specify the technologies to be used.
Well, putting on my "evil" hat for a moment, you could ask how the back end data model should dictate the layout of the front end, and any answer other than some variation of "It doesn't" gets to take the class over again. >:-)
Why should any framework you use generate
HTML, CSS and JS?
DRY
Imagine you work for a security agency
and were given the task of developing
a web-site. The field agents
specifilly requested that the site
could swap colors so that they could
use it both on night-vision and at the
office. With what you learned describe
how you would separate content from
structure to allow night/day switching
and what security measures you would
implement to prevent another enemy
agency from stealing your data.
A spiced up question. I always find my students more interested when I put them in the middle of a plot.
Something along the lines of...
Explain how you would display the results of a call to an offsite XML feed when the user performs some action in the browser. The browser must not navigate.
A good answer would address the need for client-side scripting, the XSS issue, and the server-side component necessary to get around the XSS issue, possibly with pseudocode or snippets.
ask to develop a student database system,in which you user can search the database with Date of Birth.
here the folowing technologies can be used and tested.
1.HTML for form controls
2.CSS for esthetics
3.Javascript for date validation
4.very importantly you can explain SQL INJECTION.
5.JSP
6.SERVLETS
7.JDBC
8.ANY database
9.AJAX
10.MVC design pattern can be used.