I want an HTML form to send email.
In it I have dropdown list(course).On selecting course,i want checkboxes with labels that are branches of the course selected.
How to create add attachment button(i mean backend coding that will insert a new file tag onto the page)
Waiting for ur replies.
I dont know AJAX,Jquery etc.
I know Java(jsp,servlet),html,javascript.
Simple answer for pure HTML: you can't.
When you don't want to send emails like so Send Mail, which would open the user's email client to send it manually. You will need an php server in the back which is able to send emails.
If you want to do it with JSP
http://www.java-samples.com/showtutorial.php?tutorialid=675
This tutorial also provides file upload, or better for you it provides finished code:
http://www.oop-reserch.com/scheduler_example_1.html
http://www.java-tips.org/java-ee-tips/javaserver-pages/how-to-send-e-mail-through-jsp.html
HTML forms don't do much other than, when submitted, send the inputs they contain back to the server in the for of an HTTP POST.
In order to display the checkboxes in response to the select input (dropdown list) changing you've got two options:
make an AJAX call that gets the values for the checkboxes from the server, modifying the DOM when the response is received (this will be by far the better user experience).
submit the form and generate a new page based on the value of the select input (dropdown list).
Once the form contains the inputs required to send the mail it can be submitted, resulting in an HTTP POST at the server. You'll need to read the input values and send the mail using JavaMail.
With regards to the attachment, you need to first get the uploaded file (Apache Commons can help you there) then attach the file to the mail as explained here.
Related
I'm working on a logic which sends a mail according to the form submission. In that form I have a rich text editor which is created using summernote.
now when I submit the form, it submit the base64 encoded image to server side correctly. Please find the part of the submitted content below,
<p>test</p><p><img src="data:image/jpeg;base64,/9j/4AAQSkZJRg...
However, After receiving the mail renders in gmail as a byte array like below,
when I inspect the element I can see a tags like below,
I try to fix the issue by unescapeHtml the body in the server-side but no luck on that. Whats I'm doing wrong here? how can I fix this please help?
I have a form with drop-down box on JSP page. User chose what kind of documentation he would like to get. Post is send to servlet. Then servlet is getting data from different files combines them and add to arrayList. Send it back to JSP:
rules = vp.getProperyRules();//ArrayList<RuleObject>
request.setAttribute("rules", rules);
request.getRequestDispatcher("rulesDocumentation.jsp").forward(request, response);
Then JSP is printing them out in nice table. But I was asked to give an user opportunity to download an excel file as well. When he clicks "Get Documentation" button I want to add a link that will allow him to get a report as well as printing out table with documentation.
So I have couple of questions:
Now I am sending back Arraylist of all rules contained in documentation. Should I modify it to send excel file as well?
Or I should just create link that will point to temp file on server(report) when user will click on that link he will download a file. How to do it? Modify response that it will send arraylist and fileName of temp report stored on server side?
I would really appreciate your help
I have an orbeon form and when someone has fill out the form, I want it to create a pdf and sent it to my webservice.
Right now, when the form is fill out and you press sent, the document id, app name and form name are sent to the webservice.
Can anyone help me with a guide or an example ?
The webservice is in grails (JAVA).
Best regard
Martin
You have to customize a process for your send/save button.
Have a look a this:
http://doc.orbeon.com/form-runner/advanced/buttons-and-processes/index.html
Scroll to 'Customizing processes'. You can find here an example of the process for the send button:
<property
as="xs:string"
name="oxf.fr.detail.process.send.acme.hr"
value='require-valid
then pdf
then email
then send("http://example.org/")
then navigate("/success")
recover navigate("/failure")'/>
The 'pdf' action should generate a pdf document.
To get an url of the document you can customize the 'send' action: go to
'Core Form Runner actions' at http://doc.orbeon.com/form-runner/advanced/buttons-and-processes/index.html and find 'send'. In the 'content' property you can specify 'pdf-url' to get the pdf url. The 'uri' property should point to your webservice.
Once your web service receives a pdf url, you can issue a request using the url to download document.
Hi I have jsp page That is having some text fields,I will fill that text fields and I will submit that form to server side.If any error comes in the server side I will redirect to the same page with error message Now I want that text field to remain as it is but in my case it is clearing.How to make the text field as same.
The two options available to you are:
Don't reload the page. Instead submit the data via AJAX or validate it by javascript. That way you don't ever have to touch the data in the form. Make sure your javascript highlights the fields that have errors in some way.
The endpoint that you're POSTing your data to needs to be able to recognise that the data is invalid and include that data when returning the user to the same page. I'm not familiar with jsp, but generally you'd do that by including variables in your template for your form that could contain the data, and passing empty strings on the first load of the page. If the page is then shown to the user again after a failed form validation, pass back the POST data that you received in your form request.
There are two option, you can dispatch the request/response to the same page instead of redirect, but you need to add an attribute and recover it in the JSP, or you can add the attribute in the session , recover the value to de text field and remove it using (if you are using JSTL)
Hi I have one jsp page and I have to update two html select boxes with the data of an inf file. On selecting the first combo(initially also not loading the second combo), the second will have to change accordingly. Since java script variable is not accessible from java, I had sent the value of first combo to an another jsp by ajax. And then return it to first jsp itself.Plaese help me.
Maybe I'm getting it wrong but looking at your code it seems that you are doing AJAX request on selectbox change event, but you are not doing anything with the response.
So basically what happens is you are doing an initial render to your jsp and everything is fine. Now you are changing selectbox option and AJAX request is sent to dummy.jsp. dummy.jsp is receiving it and redirecting the maker of the request to User.jsp. User.jsp-s content is sent back but nothing is done on the client side AJAX call with this response.
What you should do is have your logic at dummy.jsp(or even better at some servlet) which based on your AJAX call request parameters returns for example a JSON with data that you can process in jQuery.ajax success event. In there you can use this JSON to readjust your selectboxes and other data with javascript.
Check the examples at the end of jQuery.ajax manual: http://api.jquery.com/jquery.ajax/