Input type="hidden" value="....a chain of rubbish letter......"!!
I use the browser view source function to see the html generated by jsf, and always see something like the following:
<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="8EgC7hvJoXWgMHaUZxk5rx66APlnNueyP32ajDxbvc/i5akMf2jX5ZGyBjrnsmcbFDLXCaS8cHN169OeG5kDXxvWNcBMTAigJiokZI5Ne66G0/CILkEquml3xSn+jI4+HDkEeDEBtmlPDjjFJyOcOmZ+87klHuSTgAe5P6mMDOQOqrH0Pj9yl+
............++nBOnItypO1I+XXANTsWVuCGcV2sghVuKD42Kt/UFL7c6gh4S7KuRSQTuzsQzskJZBO7OxDOyQl0Yq1NF68G0U6T4uIj27tlXpOehNZq4LNOhvQdQH7D6ZKdmAKbVesQLrzhzo9mnY9MN0zJj1r9NhEWfhlFpRxIxYKVda+2pPzvUD9+wbS2NpmjNu5opnJ++XI9z5KpWbdblb9JKIaP6Zzxdsh2E41VBicsyuBzaOTZozbuaKZyfvJAmuJTdCe+/H9z8iOGr8SQHtmk18OUgs7l4BGSVeW3JGgo6F2EHIjEMwkhmgQIkRwDYBkboU2tAin0sPxMybTF65p98Jrn1GsVQxLhbC1F0EKHbwNbKsBvTfuvwqj7Ahik5pmDIMXrIHjmjrrGtj65UvGvkNZ5lbIFl79QTPnWy6OEoxsUJdm0dytee653YD86T4uIj27tlQB3hMxJexgDHCTV10bBgnfB2FWSo74DqQ==" />the value is a chain of meaningless letter, what is it?
Why are you always so negative in your questions/postings? In every post you're just complaining and throwing around with too much exclamation marks. It's getting annoying. You risk to become placed in the ignore list.
Anyway, you have configured JSF to use client side state saving. This isn't a default setting.
Similar Messages
-
HELP INPUT TYPE = hidden values SEEN IN URL QUERY STRING!!!
Trying to do session management using hidden fields.
The fields that are suppose to be hidden show up in the query string of the URL.
I have included the code, the output to the web page
and the URL with the "hidden" fields please help.
HIDDEN FIELDS IN URL QUESRY STRING
http://localhost:8080/myApp/servlet/Servlet077?firstName=Sandra&item=Michael
WEB PAGE OUTPUT
Enter a name and press the button
Name:
Your list of names is:
Michael
Sandra
JAVA SOURCE CODE
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Servlet077 extends HttpServlet{
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException{
//An array for getting and saving the values contained
// in the hidden fields named item.
String[] items = req.getParameterValues("item");
//Get the submitted name for the current GET request
String name = req.getParameter("firstName");
//Establish the type of output
res.setContentType("text/html");
//Get an output stream
PrintWriter out = res.getWriter();
//Construct an HTML form and send it back to the client
out.println("<HTML>");
out.println("<HEAD><TITLE>Servlet07</title></head>");
out.println("<BODY>");
//Substitute the name of your server or localhost in
// place of baldwin in the following statement.
out.println("<FORM METHOD=GET ACTION="
+ "\"http://localhost:8080/myApp/servlet/Servlet077\">");
out.println("Enter a name and press the button<P>");
out.println("Name: <INPUT TYPE=TEXT NAME="
+ "\"firstName\"><P>");
out.println("<INPUT TYPE=submit VALUE="
+ "\"Submit Name\">");
out.println("<BR><BR>Your list of names is:<BR>");
if(name == null){
out.println("Empty<BR>");
}//end if
if(items != null){
for(int i = 0; i < items.length; i++){
//Display names previously saved in hidden fields
out.println(items[i] + "<BR>");
//Save the names in hidden fields on form currently
// under construction.
out.println("<INPUT TYPE = hidden NAME=item "
+ "VALUE=" + items[i] + ">");
}//end for loop
}//end if
if(name != null){
//Display name submitted with current GET request
out.println(name + "<BR>");
//Save name submitted with current GET request in a
// hidden field on the form currently under
// construction
out.println("<INPUT TYPE = hidden NAME=item "
+ "VALUE=" + name + ">");
}//end if
out.println("</body></html>");
}//end doGet()
}//end class Servlet071. Change <form name=xxx action="your_servlet" mathod="Get"> to
<form name=xxx action="your_servlet" mathod="POST">
2. Add the following lines of code to your servlet.
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doGet(req,res);
return;
}Sudha -
Upload file input type="hidden" to server
I have a file that is on a user machine. The file is always in the same location. I want to have the user click on an upload button without selecting a file and have it sent to the server for processing. I have tried to use <input type="hidden" name="fileupload" value="c:\filepath">. When I run it this way I get no file found. Please help!
I am sorry, I will move it. Didn't notice it was in Acrobat, I was wanting Coldfusion.
Edit: Since I am unaware of how to move it I'm just going to mark it as answered. -
What is the html equivalent for input type=hidden in netui tags, where in one can
give a name value pair.
thanks.."Shankar B" <[email protected]> wrote:
>
I cannot use netui:anchor, as I am submittig a form using javascript.
hence need
to post some hidden values. How do we do hidden name balue pair inside
netui
form.
"Darryl" <[email protected]> wrote:
"Shankar B" <[email protected]> wrote:
What is the html equivalent for input type=hidden in netui tags, where
in one can
give a name value pair.
thanks..I've used a netui:anchor tag with a nested netui:parameter tag thatpassed
the
"hidden" field to an action in the pageflow. In the pageflow, use the
getRequest
method as below...
IN JSP:
<netui:anchor action="toNextInCatalog"><%=category.getName()%>
<netui:parameter name="categoryName" value="<%=category.getName()%>"></netui:parameter>
</netui:anchor>
IN PAGEFLOW:
String catName = this.getRequest().getParameter("categoryName");
hope this helps,
D
There is a <netui:hidden> tag which is intended to have an equivalent to the HTML
hidden fields. However I couldn't achioeve to set a defaultValue ([dataInput="dataInput"]. -
Whenever I use internet forums such as the eBay discussion boards or RV.net, I have this string of HTML code automatically and without my knowledge entered in to the text box on the forums.
What led to this activity and how do I stop it from occurring?
nput id="mac_address" type="hidden" value="" /It might be an add-on that is misbehaving. You can try disabling add-ons individually to see which one is responsible. You can also reset Firefox, while keeping your personalized data, like history, bookmarks, passwords, etc: [[Reset Firefox – easily fix most problems]]
-
Php form, input type country
Is it important to have a country of origin? If so, do I just
type Greece?
<input type=hidden value="GREECE"
name=originating_country>
JoAnd who wrote jomail.php? You? Can you show us the code in
it?
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"josie1one" <[email protected]> wrote in message
news:[email protected]...
> Sorry, should have looked
>
> action="jomail.php"
>
> --
> Jo
>
>
>
> "Murray *ACE*" <[email protected]>
wrote in message
> news:[email protected]...
>>>>"action"
>>>
>>> POST
>>
>> No, that's METHOD. What's the "action" attribute's
value?
>>
>> --
>> Murray --- ICQ 71997575
>> Adobe Community Expert
>> (If you *MUST* email me, don't LAUGH when you do
so!)
>> ==================
>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>> ==================
>>
>>
>> "josie1one" <[email protected]> wrote
in message
>> news:[email protected]...
>>> No, no database. Yes, processed to produce a
summary mesage and emailed
>>> to the site's owner. No, the owner isn't asking
for the country of
>>> origin. The purpose is an enquiry form for
holiday apartments to let.
>>>
>>>>"action"
>>>
>>> POST
>>>
>>> --
>>> Jo
>>>
>>>
>>>
>>> "Murray *ACE*"
<[email protected]> wrote in message
>>> news:[email protected]...
>>>> So the form's data is not captured in a
database? It's only processed
>>>> to produce a summary message and emailed to
the site's owner? Is the
>>>> owner asking for the Country of origin?
>>>>
>>>> What is the value of the "action" attribute
of the <form> tag?
>>>>
>>>> --
>>>> Murray --- ICQ 71997575
>>>> Adobe Community Expert
>>>> (If you *MUST* email me, don't LAUGH when
you do so!)
>>>> ==================
>>>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>>>> ==================
>>>>
>>>>
>>>> "josie1one" <[email protected]>
wrote in message
>>>> news:[email protected]...
>>>>> Thanks for the reference, lovely quote
(o:
>>>>>
>>>>> I guess I don't need that information
but I didn't know if it was
>>>>> needed.
>>>>>> how is that information then
handled?
>>>>>
>>>>> php and erm, passed to a mail handler
which processes a thank you. Is
>>>>> that the correct answer?
>>>>>
>>>>>> By the way, all attribute values
should be in quotes -
>>>>>>
>>>>>> <input type="hidden"....
>>>>>
>>>>> Thank you, I will fix that.
>>>>>
>>>>> --
>>>>> Jo
>>>>>
>>>>>
>>>>>
>>>>> "Murray *ACE*"
<[email protected]> wrote in message
>>>>>
news:[email protected]...
>>>>>> Why are you feeling it would matter.
Do *you* need that information?
>>>>>> If not, then it's like what the
Cheshire Cat said to Alice....
>>>>>>
>>>>>> Alice: [standing at fork in road]
Which way do I go?
>>>>>> Cat: What is your destination?
>>>>>> Alice: It doesn't matter.
>>>>>> Cat: Then it doesn't matter which
way you go!
>>>>>>
>>>>>> Those fields are there only for the
support of the processing script,
>>>>>> and for the way that the information
is handled. What script are you
>>>>>> using and how is that information
then handled?
>>>>>>
>>>>>> By the way, all attribute values
should be in quotes -
>>>>>>
>>>>>> <input type="hidden"....
>>>>>>
>>>>>> --
>>>>>> Murray --- ICQ 71997575
>>>>>> Adobe Community Expert
>>>>>> (If you *MUST* email me, don't LAUGH
when you do so!)
>>>>>> ==================
>>>>>>
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
>>>>>>
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
>>>>>> ==================
>>>>>>
>>>>>>
>>>>>> "josie1one"
<[email protected]> wrote in message
>>>>>>
news:[email protected]...
>>>>>>> Sorry Micha, that wasn't enough
was it?
>>>>>>> It's an input form - I can't
show the link because I have a
>>>>>>> scripting error, but the
relevant lines are these:
>>>>>>>
>>>>>>> <form name="form1"
method="post" action="jomail.php">
>>>>>>> <input type=hidden
value="General Information Request"
>>>>>>> name=mailsubject>
>>>>>>> <input type=hidden
value="kiwiannes-leros.com"
>>>>>>> name=originating_site>
>>>>>>> <input type=hidden value="UK"
name=originating_country>
>>>>>>> <input type=hidden
name="env_report"
>>>>>>>
value="REMOTE_HOST,REMOTE_ADDR">
>>>>>>> <input type=hidden
value="Information Request" name=title>
>>>>>>>
<fieldset><legend><strong>Contact
Form</strong></legend>
>>>>>>>
>>>>>>> line 4 above - the originating
country is Greece. What do I type
>>>>>>> please? GR, Greece, GREECE - and
does it matter?
>>>>>>>
>>>>>>> --
>>>>>>> Jo
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Michael Fesser"
<[email protected]> wrote in message
>>>>>>>
news:[email protected]...
>>>>>>>> .oO(josie1one)
>>>>>>>>
>>>>>>>>>Is it important to have a
country of origin?
>>>>>>>>
>>>>>>>> For what?
>>>>>>>>
>>>>>>>>>If so, do I just type
Greece?
>>>>>>>>>
>>>>>>>>><input type=hidden
value="GREECE" name=originating_country>
>>>>>>>>
>>>>>>>> It all depends on the
server-side script. This hidden field alone
>>>>>>>> in the
>>>>>>>> HTML means absolutely
nothing.
>>>>>>>>
>>>>>>>> Micha
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
> -
Pass hidden values to same page by clicking on href
I have A.jsp page which has some dynamic hidden fields.The respective code is given below:
<script language="javascript">
function submitForm()
{document.main.action="main.jsp"; document.main.submit(); }
</script>
<form name="main">
HOME
<input type="hidden" name="user_p" value="<%=user1%>"/>
<input type="hidden" name="p" value="Hello"/>
</form>
When I click on link-HOME, it reconnect to A.jsp but does not pass the hiddden values. Could you help me?It did not work.Now after modifying the code for this (I did this because some browser does not support two functions ,like in href. By thinking that it could be the problem)
<script language="javascript">
function submitForm()
document.main.action="main.jsp"; document.main.submit(); }
</script>
<form name="main" method="POST">
HOME
<input type="hidden" name="user_p" value="<%=user1%>"/>
<input type="hidden" name="p" value="Hello"/>
</form>
Could you explain with working code? -
Hello All!
I'm using a form to add and remove parameters for a service definition.
<form action="serviceinput.jsp" method="post">
<table>
<tr>
<td><b>Level</b></td>
<td><b>Fieldname</b></td>
<td><b>Stucturename</b></td>
<td><b>Type</b></td>
<td><b>Format</b></td>
<td><b>Optional</b></td>
<td><b>Semantics</b></td>
</tr>
<%
for (Iterator iterParameters = parameters.iterator(); iterParameters.hasNext();)
Parameter parameter = (Parameter) iterParameters.next();
%>
<tr>
<td><%= parameter.getLevel() %></td>
<td><%= parameter.getFieldname() %></td>
<td><%= parameter.getStructurename() %></td>
<td><%= parameter.getType() %></td>
<td><%= parameter.getFormat() %></td>
<td><%= parameter.getOptional() %></td>
<td><%= parameter.getSemantics() %></td>
</tr>
<%
%>
</table>
<input type="submit" name="<%= parameters.addParameter() %>" value="add"/>
<input type="submit" name="<%= parameters.removeParameter() %>" value="remove"/>
</form>
The special thing about is, that I'm using two <input type="submit"...> buttons.
The idea is, that I'd like to add one more row with attributes by clicking the "add" button and removing one row by clicking the "remove" button.
If I use just one of them, it works fine. If I use both of them, nothing happens at all.
Isn't it allowed to use two <input type="submit"...> fields?
Is there an alternative? How can I implement my form the correct way?
Thanks a lot in advance to all!
Regards,
TomiHi,
Hai Tomi ,
As swati already Explained U can try it with buttons,
But u have to make a Hidden field and set the value of the hidden field
with the Javascript code after pressing the button , Call a client side function which has an argument as given below
Validate the Flag field in the JSP file
<script language=javascript>
function Validate(s)
if(s==1)
document.forms['ServiceInput'].elements["flag"].value="add";
else
document.forms['ServiceInput'].elements["flag"].value="Remove";
document.forms['ServiceInput'].submit();
alert("hai");
</script>
<form name="ServiceInput" action="serviceinput.jsp" method="POst">
<table>
<tr>
<td><b>Level</b></td>
<td><b>Fieldname</b></td>
<td><b>Stucturename</b></td>
<td><b>Type</b></td>
<td><b>Format</b></td>
<td><b>Optional</b></td>
<td><b>Semantics</b></td>
</tr>
<%
for (Iterator iterParameters = parameters.iterator(); iterParameters.hasNext();)
Parameter parameter = (Parameter) iterParameters.next();
%>
<tr>
<td><%= parameter.getLevel() %></td>
<td><%= parameter.getFieldname() %></td>
<td><%= parameter.getStructurename() %></td>
<td><%= parameter.getType() %></td>
<td><%= parameter.getFormat() %></td>
<td><%= parameter.getOptional() %></td>
<td><%= parameter.getSemantics() %></td>
</tr>
<%
%>
</table>
<input type=hidden name=flag value="bb">
<input type="Button" name="b1" value="add" onclick= "Validate(1)">
<input type="Button" name="b2" value="remove" onclick= "Validate(2)">
</form> -
Building hashtable for INPUT types dynamically
In my jsp I want to define a method which can build and return a hashtable of all the input types defined inside a form. For example if my form looks like :
<form name="detail_form" method="post" action="">
<input type="text" name="asset_name" size="15" value="ABC">
<input type="text" name="asset_desc" size="45" value="Laptop">
<input type="hidden" name="employee_id_key" value="58975">
<input type="hidden" name="asset_id_key" value="15">
</form>
then my method will be like :
<%!
public Map getCurrentData()
Map paras=new HashMap();
paras.put ("asset_name", "ABC");
paras.put ("asset_desc", "Laptop");
paras.put ("employee_id_key", "58975");
paras.put ("asset_id_key", "15");
return paras;
%>
Now the problem is :
since the code inside the form can be dynamic (like there can be different number of INPUT types with different names) so I want my method getCurrentData() to be dynamic. That probably means some sort of loop to go through all the INPUT types in the form and storing it in hashtable. But I dont know how to do it in java. Can anybody help me please. ThanksI am not exactly sure what you mean by "input types" but you could use the request.getParameterMap() method after the form is submitted. So for example you would have your form like <form ... action="nextpage.jsp"> and on nextpage.jsp you could call request.getParameterMap() to create a map of all the paramaters and their values. Here is what I mean...
<form name="detail_form" method="post" action="nextpage.jsp">
<input type="text" name="asset_name" size="15" value="ABC">
<input type="text" name="asset_desc" size="45" value="Laptop">
<input type="hidden" name="employee_id_key" value="58975">
<input type="hidden" name="asset_id_key" value="15">
</form>
then on nexpage.jsp you could say
<% Map myMap = request.getParamaterMap(); %>
Good Luck
Zac -
Getting hidden value with javascript problem
<html>
<body>
<form>
<input type="hidden" id="code" value="123">
</form>
</html>
when open the html file and type "javascript:alert(document.getElementById("code").value)" in the address bar, I get a message box with "123".
but when i do in the jsp with
<input type="hidden" id="code" value="<%=request.getParameter("code")%>">
and type the javascript in the address bar, i get "object not supported".
Can anyone tell me how to get hidden value in jsp with javascript?
thank you.There is no difference between a JSP or plain html, since javascript executes on the client side after the JSP is done processing. There is obviously something wrong with the HTML content after you input the request value, so check the generated HTML in your browser to see if there are any unwanted quotes in there or something.
-
There is a row which has 2 fields
<td >�Ticket No</td> <td >�Bill No</td>
<td ><input type="text" name="<%= ticketNo+ %>" value="" size=10></td>
<td ><INPUT TYPE="TEXT" NAME="<%=billNo+"%> value="" size=10></td>
I want to pass the values entered in the row along with one hidden value called as rowId. The rowId is attached to the ticketNo and billNo values.
How to do this???.........Plz Help
Any idea , if there are many rows?Here is a basic servlet that reads three parameters from a form. One of the is hidden. You can see that its no different from reading non hidden form fields.
-S-
// The Servlet
package sample;
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
public class TestServlet extends HttpServlet {
private final String CLASS_NAME = "TestServlet";
public void init(ServletConfig config) throws ServletException {
super.init(config);
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doWork(req,res);
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doWork(req,res);
private void doWork(HttpServletRequest req, HttpServletResponse res)
throws IOException {
String val1 = req.getParameter("Value1");
String val2 = req.getParameter("Value2");
String val3 = req.getParameter("Value3");
System.out.println("Val1: " + val1 + "\nVal2: " + val2 + "\nVal3" + val3);
// JSP Page with hidden fields, posts to our Servlet
<html>
<head>
<title>Test Page</title>
</head>
<body>
<form action="/Test" name="" method="Post">
<input type="text" name="Value1" value="This is value 1">
<input type="Hidden" name="Value2" value="This is hidden value 2">
<input type="text" name="Value3" value="This is value 3">
<br>
<input type="Submit" value="Submit Form">
</form>
</body>
</html>
// web.xml servlet entry and mapping
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
<servlet>
<servlet-name>TestServlet</servlet-name>
<servlet-class>sample.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TestServlet</servlet-name>
<url-pattern>/Test</url-pattern>
</servlet-mapping>
</web-app> -
Passing request of file input type to a jsp
Hi i m using this script for file uploading the form is.... <html > <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form action="uploadscript.jsp" name="filesForm" enctype="multipart/form-data" method="post">
Please specify a file, or a set of files:
<input type="file" name="userfile_parent" value="userfile_parent" >
<input type="submit" value="submit" value="Send">
</form> </body> </html> And i am tring to get the url on uploadscript.jsp by using String parentPath=request.getParameter("userfile_parent"); but i foud that its value is NULL it is not working what should i do to get the userfile_parent on uploadscript.jsp help me!!! Message was edited by: UDAY Message was edited by: UDAY
avajain
Posts: 135
From: Noida , India
Registered: 5/10/06
Read Re: Passing response but getting NULL
Posted: Sep 20, 2006 2:43 AM in response to: UDAY in response to: UDAY
Click to reply to this thread Reply
Use method="GET" in place of method="post" .
Thanks
UDAY
Posts: 26
From: JAIPUR
Registered: 8/14/06
Read Re: Passing response but getting NULL
Posted: Sep 20, 2006 3:18 AM in response to: avajain in response to: avajain
Click to edit this message... Click to reply to this thread Reply
now it is giving this error message by e.getMessage()
[br]the request doesn't contain a multipart/form-data or multipart/mixed stream, content type header is null
the uploadscript is this....
http://www.one.esmartstudent.com
can u please help me.Here is sample code which we have used in one of our projects with org.apache.commons.fileupload.*.
You can find String fullName = (String) formValues.get("FULLNAMES"); at the end that gives name of file.
<%@ page import="java.util.*"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.io.File"%>
<%@ page import="java.io.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="org.apache.commons.fileupload.disk.*"%>
<%@ page import="org.apache.commons.fileupload.servlet.*"%>
<%!
//method to return file extension
String getFileExt(String xPath){
//Find extension
int dotindex = 0; //extension character position
dotindex = xPath.lastIndexOf('.');
if (dotindex == -1){ // no extension
return "";
int slashindex = 0; //seperator character position
slashindex = Math.max(xPath.lastIndexOf('/'),xPath.lastIndexOf('\\'));
if (slashindex == -1){ // no seperator characters in string
return xPath.substring(dotindex);
if (dotindex < slashindex){ //check last "." character is not before last seperator
return "";
return xPath.substring(dotindex);
%>
<%
Map formValues = new HashMap();
String fileName = "";
boolean uploaded = false;
// Check that we have a file upload request
boolean isMultipart = FileUpload.isMultipartContent(request);
//Create variables for path, filename and extension
String newFilePath = CoeResourceBundle.getEmailProperties("FILE_UPLOAD_PATH");//application.getRealPath("/")+"temp";
String newFileName ="";
String FileExt = "";
//System.out.println(" newFilePath"+newFilePath+"/");
//out.println(" newFilePath"+newFilePath+"<br>");
// Create a factory for disk-based file items
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
// Parse the request
List /* FileItem */ items = upload.parseRequest(request);
// System.out.println(" newFilePath"+newFilePath+"/");
// Process the uploaded items
Iterator iter = items.iterator();
//Form fields
while (iter.hasNext()) {
//System.out.println("in iterator");
FileItem item = (FileItem) iter.next();
if (item.isFormField()) {
String name = item.getFieldName();
String value = item.getString();
if (name.equals("newFileName")) {
newFileName = value;
//System.out.println("LOADING");
formValues.put(name,value);
else {
//System.out.println("in iterator----");
String fieldName = item.getFieldName();
fileName = item.getName();
int index = fileName.lastIndexOf("\\");
if(index != -1)
fileName = fileName.substring(index + 1);
else
fileName = fileName;
FileExt = getFileExt(fileName);
String contentType = item.getContentType();
boolean isInMemory = item.isInMemory();
long sizeInBytes = item.getSize();
if (fileName.equals("") || sizeInBytes==0){
out.println("Not a valid file.<br>No upload attempted.<br><br>");
} else {
// out.println("ACTUAL fileName= " newFilePath"\\"+fileName+ "<br>");
//File uploadedFile = new File(newFilePath+"\\", newFileName+FileExt);
File uploadedFile = new File(newFilePath+"/",fileName);
File oldFile = new File(CoeResourceBundle.getEmailProperties("FILE_UPLOAD_PATH")+"/"+fileName);
File oldFileApproved = new File(CoeResourceBundle.getEmailProperties("APPROVED_FILE_LOCATION")+"/"+fileName);
try{
if (!oldFile.exists()&&!oldFileApproved.exists())
item.write(uploadedFile);
uploaded = true;
//out.println(fileName+" was successfully uploaded as "+ newFileName+FileExt +".<br><br>");
catch (java.lang.Exception e) {
out.println("Errors prevented the file upload.<br>"+fileName+ " was not uploaded.<br><br>");
String userid = (String) formValues.get("USERID");
String fullName = (String) formValues.get("FULLNAMES");
String email = (String) formValues.get("EMAILID");
String empno = (String) formValues.get("EMPNO");
String docType = (String) formValues.get("DOCTYPE");
String desc = (String) formValues.get("MYTEXT");
String title = (String) formValues.get("TITLEBOX");
String module = (String) formValues.get("MODULE");
String techfunctype = (String) formValues.get("TECHFUNCTYPE");
%> -
Hello everybody,
I am working on uploading file from page to another one using HTP package, but whenever I submit the form, it only takes the filename without the full path.
for example :
if i sent 'c:\dir\a.txt' , the other page receives file parameter as 'a.txt'
the code is here
PROCEDURE upload(appno in varchar2,wsct in varchar2) AS
l_real_name VARCHAR2(1000);
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title('Test Upload');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Test Upload');
HTP.print('<form action="https://ssltrng.uaeu.ac.ae/trng/document_api.upload1" method="get">');
HTP.print(' File to upload: <input type="file" name="file" >
HTP.print(' <input type="submit" value="Upload">');
HTP.print('</form>');
HTP.bodyclose;
HTP.htmlclose;
END upload;
the other page see it as
file is 'Water lilies.jpg'
Thanks
Edited by: dtabed on Mar 30, 2011 1:02 AMDo not understand the problem.
The code you've posted is a PL/SQL web enabled procedure that produces a dynamic HTML page. This page contains a form. And a full URL reference to the CGI that will process the form's data.
This is unusual - as it seems to be that the form is submitted across domains and web servers.. You usually refer to a local CGI procedure to deal with a form - no need for a fully qualified URL that includes web server and domain name.
If the CGI procedure that receives the form is also a PL/SQL web enabled procedure, that the uploaded file will be placed in the documents table (as defined in the DAD alias) by mod_plsql, prior to the web enabled procedure being called. The documents table will contain the Mime type, file name, file contents and other details. -
Greeting,
I have the following codes in struts1.3.5. It works fine under Firefox, but it does not work at all under Internet Explore (IT) at all. Any clues why under IE it does not work?
<html:link action="/private/search">
<input
type="button"
value="Search"
class="search-button">
</html:link>
Thanks a lot!This would probably generate a HTML in which there will be a button inside anchor tag.
This is not a standard HTML feature and no wonder this is not supported by IE. I copied the generated html codes into test.html to try on IE, the button does not work at all.
Firefox is probably lenient here. True. test.html works in Firefox.
You might want to just have a link or do a form submission on button click.The action designed does not need an actionForm. I updated my code to :<html:button onclick="location.href='processSearch'"
property ="Search"
value ="Search">
</html:button>
And now both Firefox & IE works fine.
Thanks a lot! -
Adding input type to my mail page and PHP attached to it question
I need to add a few more input boxes in my form but every time I do it, I still only get what's on the code under this what I'm writing now.
This is the code in my mail page itself:
<form action="mail.php" method="POST">
<p><b>Name</b><br>
<input type="text" name="subject" size=40>
<p><b>Please fill out your email/address/phone number</b><br>
<textarea cols=40 rows=10 name="message"></textarea>
<p><input type="submit" value=" Send ">
</form>
This is the code in my php page it's attached to.
<html>
<head><title>Support a Hero</title></head>
<body>
<?php
$email = '[email protected]';
$subject = $HTTP_POST_VARS['subject'];
$message = $HTTP_POST_VARS['message'];
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
elseif (mail($email,$subject,$message)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
?>
</body>
</html>anybody know? I can't seem to add extra post_vars to communicate with my PHP script. What am I doing wrong? It looks like it should work. I get the email to my email but I'm only getting the name in my email subject and then the message. The other boxes that are filled out don't come to my email. I would like to see where the email comes besides "secure server". Is that possible? Here's the script.
This is in my HTML:
<body>
<form action="mail.php" method="POST">
<p><b>Name</b><br>
<input type="text" name="subject" size=40>
<p><b>Name</b><br>
<input type="text" name="name" size=40>
<p><b>Name</b><br>
<input type="text" name="email" size=40>
<p><b>Name</b><br>
<input type="text" name="phone" size=40>
<p><b>Please fill out your email/address/phone number</b><br>
<textarea cols=40 rows=10 name="message"></textarea>
<p><input type="submit" value=" Send ">
</form></td>
</tr>
</table>
Here is my PHP that it's attached to.
<html>
<head><title>Support a Hero</title></head>
<body>
<?php
$email = '[email protected]';
$name = $HTTP_POST_VARS['name'];
$your email = $HTTP_POST_VARS['email'];
$phone = $HTTP_POST_VARS['phone'];
$message = $HTTP_POST_VARS['message'];
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<h4>Invalid email address</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($subject == "") {
echo "<h4>No subject</h4>";
echo "<a href='javascript:history.back(1);'>Back</a>";
elseif (mail($email,$subject,$message)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
?>
</body>
</html>
Maybe you are looking for
-
hi have a situation where when i add a certain jar in my portal application am geting this error but if i remove the jar in the portal application am geting the error where mis the problem is in my jar must i go to my jar application and solve proble
-
Comparison of SAP R/3 4.7 with SAP ERP 6.0 in Basis point of view
Hi Experts, Can we compare R/3 4.7 and ECC 6.0 in Basis point of view. Say for example Password is case sensitive in new version, DBACOCKPIT added for central maintenance of database. Like this can we list out some of the changes or differences. It w
-
PCI Card doesn't fit?!
Hey guys, I need firewire 400 for my audio mixing desk. I was advised to not buy an adaptor and use the current Firewire 800 ports, but to instead buy a Firewire 400 PCI Card. Well, I did that and it doesn't fit. Obviously I have made a mistake. Woul
-
"Display Unavailable" red canvas screen-forum solutions not working. URGENT
I a few days ago I started getting, in the midst of editing, my canvas going red with the message "Display Unavalible" in it. After this, the sequence would not play. If I close the sequence and try to reopen it, I get an error window which just says
-
PROBLEM IN ACTIVATING BB WITH ANOTHER SERVICE PROVIDER
Hi !!! i had purchased BB from tata indicom , recently i changed service provider from tataindicom to idea with Number portability option ... no. is same but idea is not able to register my BB with there services .....please guide me. rishiraj