<html lang="en">
<head>
<title>File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="POST" action="upload" enctype="multipart/form-data" >
File:
<input type="file" name="file" id="file" /> <br/>
Destination:
<input type="text" value="/tmp" name="destination"/>
</br>
<input type="submit" value="Upload" name="upload" id="upload" />
</form>
</body>
I want to get all file path which is chosen via browser(input type="file") to upload it to ftp server.
I had found a lot of code snaps but just they give me file name I need absolute path such as "c:\users\filename".
Thank yo for your time.
For security reason, browsers do not provide you full/absolute path for any file.
Related
Page "bookUpdate.html" does not work correctly because of the errors. I can open this page from page "bookList.html" via click to button "Edit". On all other pages bootstrap work correctly. I try to add to code something like "link rel="stylesheet" type="text/css" th:href="#{/webjars/bootstrap/css/bootstrap.min.css}" " but it did not work.
bookUpdate.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
layout:decorate="~{fragments/main_layout}">
<body>
<div layout:fragment="content" class="container mySpace">
<form th:action="#{/bookUpdate/__${book.id}__}" th:object="${book.id}"
method="post">
<div class="form-group">
<label for="topic" class="form-control-label">Topic</label> <input
type="text" class="form-control" th:field="${book.topic}"
id="topic" />
</div>
<div class="form-group">
<label for="description" class="form-control-label">Description</label>
<textarea class="form-control" th:field="${book.description}"
id="description" style="height: 95px"></textarea>
</div>
<div class="form-group">
<label for="link" class="form-control-label">Link</label> <input
type="text" class="form-control" th:field="${book.link}" id="link" />
</div>
<input type="submit" value="Submit" class="btn btn-primary" />
</form>
</div>
</body>
</html>
SUGGESTION: Try changing "href" to "src":
https://stackoverflow.com/a/52435193/421195
ALSO: be sure to look at the other responses in the same thread.
I hope that helps ... and please post back what you find!
I resolved my issue. I added a links to bootstrap from file "main_layout.html", that I use for header, and added before them <base href="/">. Now it is working fine.
<head>
<base href="/">
<link rel="stylesheet" href="../../static/css/style.css"
th:href="#{css/style.css}" />
<link rel="stylesheet" href="../../static/css/materia/bootstrap.min.css"
th:href="#{css/materia/bootstrap.min.css}" />
<script type="text/javascript" th:src="#{scripts/jquery-3.2.1.min.js}"></script>
</head>
I have a simple html form (first name and last name) once I hit submit it should give me a simple response from my java servlet that says "Hello plus first name plus last name"
I ran this using eclipse and a tomcat plugin and it works perfectly.. but when I create a war file and deploy it from tomcat.. I get the first screen.. enter first and last name.. but when I hit submit, it looks for "WelcomeScreen" nowhere in my code do i have "welcomeScreen" Below is my HTML code.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Please enter your name</title>
</head>
<body>
<form name="input" action=Hello method="get">
First name: <input type="text" name="firstname"><br> Last
name: <input type="text" name="lastname"> <input type="submit"
value="Submit">
</form>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Please enter your name</title>
</head>
<body>
<form name="input" action="Hello.html" method="get">
First name: <input type="text" name="firstname" /><br>
Last name: <input type="text" name="lastname" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
I wrote correct code. There were some mistakes in html like;
<form name="input" action=Hello method="get">
<!-- You've forgotten quotes -->
<!-- And also dont forget to write ".html" or Hello controller in framework like MVC -->
<form name="input" action="Hello.html" method="get">
Another one
<input type="text" name="firstname">
<!-- You've forgotten /// -->
<input type="text" name="firstname" />
And your Hello.html
<html>
<head>
<title>Title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<script type="text/javascript">
var get = window.location.search.replace( "?", "" );
alert(get);
</script>
</head>
<body>
<div>Content</div>
</body>
</html>
It should be simple, but i have a problem,
This is my *.jsp file
<html>
<head>
<title>Edit DataBase data</title>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<hr size="2"/>
<h2>id in DB = ?</h2>
<p>id:<input type="text" name="id" size="20" value="sdfs"></p>
<p>
<form action="/web/save" method="POST">
<input class="button" type="submit" value="submit" />
</form>
</p>
</form>
</body>
</html>
servlet looks like this
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
String id = request.getParameter("id")
System.out.println("ID=" + id);
}
but in output ID=null
servlet was loaded by the button click on the server
You need to put the input tag in between the form tags.
For the code you put here
<form action="" method="POST">
is correct.
Check, you might have put
<form action="" method="GET">
hi mate i have in my folder a lot of file html equal( the only difference is the string).
i want in every file html of my folder delete a tag.
an example of my file html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>P0001 Generic DTC: Fuel Volume Regulator Control Circuit/Open</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="P0001 diagnostic trouble code details." />
<meta name="keywords" content="P0001, obd code, obd codes, diagnostic codes, trouble codes, diagnostic trouble codes, ford, gm, toyota, chrysler, dodge, nissan, chevy, dtc, dtcs, engine code, engine codes, check engine light" />
<link rel="stylesheet" type="text/css" href="/static/css/base.css"/>
<link rel="shortcut icon" href="/static/img/favicon.ico" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1196991-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body class="results one">
<div id="main">
<div id="header">
<div id="logo">DTCSearch.com</div>
<form action="/" method="post">
<p>
<input type="text" id="query" name="query" value="P0001"/>
<input type="submit" id="submit" value=""/>
</p>
</form>
</div>
<div id="content">
<h1>P0001 OBD Trouble Code</h1>
<p>1 result found</p>
<div id="content-body">
<table cellspacing="0" class="one">
<caption>P0001 - Generic</caption>
<tr>
<th>Type</th>
<td>Powertrain - Fuel and Air Metering - ISO/SAE Controlled</td>
</tr>
<tr>
<th>Description</th>
<td><p>Fuel Volume Regulator Control Circuit/Open</p></td>
</tr>
</table>
<p style="font-weight:bold">Try also: http://www.obd-codes.com/p0001</p>
</div>
</div>
<div id="footer">
<div id="footer_banner">
<img src="http://affiliates.eautorepair.net/42/65/15/&dp=84" alt="Do it Yourself Automobile Repair Information" border="0">
</div>
<p>Copyright © 2008–2012 DTCSearch.com<br/>
DTCSearch.com is hosted by ScanTool.net, LLC</p>
</div>
</div>
</body>
</html>`
i want to delete in every file this tag:
<img src="http://affiliates.eautorepair.net/42/65/15/&dp=84" alt="Do it Yourself Automobile Repair Information" border="0">
how do this ? tell me a solution with java or with bash or whit other tecnology.
You can use sed to delete a line from a file.
For example, the command:
sed '/foo/d' myfile
will delete all lines containing the word foo from myfile.
If you have multiple files you can run:
sed -i '/foo/d' *.html
The -i option tells sed to edit the files in-place.
i used:
sed -i 's#<img src="http://affiliates.eautorepair.net/42/65/15/&dp=84" alt="Do it Yourself Automobile Repair Information" border="0">##g' *
now i have a problem more serious. i want to delete
<p>
<input type="text" id="query" name="query" value="XXXXX"/>
<input type="submit" id="submit" value=""/>
</p>
where xxxxx are 5 character different in every file . how can do ?
I'm starting from here :
With that code :
<!DOCTYPE html>
<html>
<head><title>Bank application</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<table class="title">
<tr><th>Web Bank application</th></tr>
</table>
<br/>
<fieldset>
<legend>Login Page - please enter your Username and Password</legend>
<form action="loginPage">
Username: <input type="text" name="username"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="Login">
</form>
</fieldset>
<br/>
<br/>
<br/>
<fieldset>
<legend>Registration</legend>
<form action="register">
First name: <input type="text" name="firstName"><br>
Last name : <input type="text" name="lastName"><br>
Address : <input type="text" name="address"><br>
ID-number : <input type="text" name="idnumber"><br>
User-Name : <input type="text" name="userName"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="Register">
</form>
</fieldset>
<br/>
<br/><br/><br/><br/><br/><br/>
</body></html>
And while I move from one page to another , I reach here :
With that code :
<!DOCTYPE html>
<html>
<head><title>Authentication failed - a problem has occurred!</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<h1>Sorry , but you are not registered to our bank!</h1>
<fieldset>
<legend>Please press here to continue</legend>
<form action="goingBack">
<input type="submit" value="Press here">
</form>
</fieldset>
</body></html>
And I want to go back to index.html - the first page that I see when the program starts (the first picture above) .
How can I do that ? how can I forward back to index.html ?
Regards
Just add a link to the previous page in the last HTML:
<!DOCTYPE html>
<html>
<head><title>Authentication failed - a problem has occurred!</title>
<link rel="stylesheet"
href="./css/styles.css"
type="text/css"/>
</head>
<body>
<h1>Sorry , but you are not registered to our bank!</h1>
<fieldset>
<legend>Please press here to continue</legend>
<form action="goingBack">
<input type="submit" value="Press here">
</form>
</fieldset>
Go Back <!-- add this -->
</body></html>
You just need javascript. To redirect to /index.html after 5 seconds :
setTimeout('window.location='index.html';', 5000);
setTimeout() is a javascript function that sets a timer to trigger somehting after a given period of time. window.location is a variable that allows you to change the URL of the current page (thus redireting).