Dynamic Text in Paragraph Form as in Database
I am building a site for a church and am setting up a page
for the pastor to input his on thoughts as he sees fit. In the
database (access) it has spaces where spaces need to be and you can
see where one paragraph ends and the other starts but when I pull
it to a page as dynamic text, it all jumbles together in 1
paragraph. can someone help me.
Thanks
I can tell you guys really want to help, but please consider
me a beginner. I don't see "VbCr" or "Chr10" in my code anywhere.
or what to actually replace. I appreciate everything that has been
posted. Can you be a little more specific for adumb programmer.
Thank you in advance
Here is the code for the ASP page
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
' *** Logout the current user.
MM_Logout = CStr(Request.ServerVariables("URL")) &
"?MM_Logoutnow=1"
If (CStr(Request("MM_Logoutnow")) = "1") Then
Session.Contents.Remove("MM_Username")
Session.Contents.Remove("MM_UserAuthorization")
MM_logoutRedirectPage = "/login.asp"
' redirect with URL parameters (remove the "MM_Logoutnow"
query param).
if (MM_logoutRedirectPage = "") Then MM_logoutRedirectPage =
CStr(Request.ServerVariables("URL"))
If (InStr(1, UC_redirectPage, "?", vbTextCompare) = 0 And
Request.QueryString <> "") Then
MM_newQS = "?"
For Each Item In Request.QueryString
If (Item <> "MM_Logoutnow") Then
If (Len(MM_newQS) > 1) Then MM_newQS = MM_newQS &
MM_newQS = MM_newQS & Item & "=" &
Server.URLencode(Request.QueryString(Item))
End If
Next
if (Len(MM_newQS) > 1) Then MM_logoutRedirectPage =
MM_logoutRedirectPage & MM_newQS
End If
Response.Redirect(MM_logoutRedirectPage)
End If
%>
<!--#include file="Connections/thirtyfirst.asp" -->
<%
' *** Restrict Access To Page: Grant or deny access to this
page
MM_authorizedUsers=""
MM_authFailedURL="/login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (true Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1)
Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar =
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer =
MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar &
"accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="Connections/thirtyfirst.asp" -->
<!--#include file="Connections/thirtyfirst.asp" -->
<%
Dim rs02__MMColParam
rs02__MMColParam = "1"
If (Request.QueryString("text") <> "") Then
rs02__MMColParam = Request.QueryString("text")
End If
%>
<%
Dim rs02
Dim rs02_numRows
Set rs02 = Server.CreateObject("ADODB.Recordset")
rs02.ActiveConnection = MM_thirtyfirst_STRING
rs02.Source = "SELECT * FROM texts WHERE ID = " +
Replace(rs02__MMColParam, "'", "''") + ""
rs02.CursorType = 0
rs02.CursorLocation = 2
rs02.LockType = 1
rs02.Open()
rs02_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 10
Repeat1__index = 0
rs02_numRows = rs02_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for
maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be
maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
MM_removeList = MM_removeList & "&" &
MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem &
Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem &
Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&'
from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "") Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to
these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>Admin - Results</title>
<style type="text/css">
<!--
.style1 { font-size: 24px;
font-weight: bold;
color: #990099;
-->
</style>
</head>
<body>
<p align="center" class="style1">31st Avenue Missionary
Baptist Church<br />
Administration Page </p>
<p
align="center">_________________________________________________________</p>
<p align="right"> <a href="<%= MM_Logout
%>">Log out</a></p>
<div align="center">
<table width="442" border="0">
<tr>
<td width="442"><div
align="left"></div></td>
</tr>
<% While ((Repeat1__numRows <> 0) AND (NOT
rs02.EOF)) %>
<tr>
<td width="442"><div align="center">
<p align="left">Message: - <A
HREF="/detail.asp?<%= Server.HTMLEncode(MM_keepURL) &
MM_joinChar(MM_keepURL) & "ID=" &
rs02.Fields.Item("ID").Value %>">Edit</A></p>
<div align="left">
<p><%=(rs02.Fields.Item("ppage").Value)%></p>
</div>
</div></td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rs02.MoveNext()
Wend
%>
</table>
</div>
<div align="center"></div></body>
</html>
<%
rs02.Close()
Set rs02 = Nothing
%>
I can tell you guys really want to help, but please consider me
a beginner. I don't see "VbCr" or "Chr10" in my code anywhere. or
what to actually replace. I appreciate everything that has been
posted. Can you be a little more specific for adumb
programmer.
Similar Messages
-
Load dynamic text into Captivate form external file
Is it possible to load dynamic text into a Captivate file from an external file like an XML using Javascript.
I see there's a way to get it form the query scring of the URL ( http://captivatedev.com/2011/05/01/how-to-jump-to-a-specific-slide-in-a-separate-course/ ), but I have a project where I want several pieces of text to be replaced and we want to be able to edit it externally from the Captivate file.
Thanks!Hi Ned,
What I'm doing is using a yahoo map to load addresses and
place custom swf files as the placemarkers. The main stage has an
instance of myMap, which is the map that yahoo sets us to display
the ACTUAL map. They have also provided coding for placing markers
on the map, which is what I'm using.
I have the addresses throughout multiple xml files, which I
am actually loading through 1 single xml file. These addresses are
being stored in an array, then called by the AS below to place
markers. All the markers are placed correctly, however, I am trying
to have them actually say the address - this is where the problem
lies.
The marker that is being located and placed has a text field
called load_text in it. I want that field to load the same address
that is being used to place it (from the array addressA).
I'm very confused because every loop through the * for (i=0;
i<addressA.length; i++) * loop the marker is placed at the
correct addressA
location, but I cannot actually get the address to load into the
load_txt field in the marker. I can even run a trace during that
loop and it traces addressA for each address, but I can't seem
to actually load those values into the load_txt box.
Do you have any ideas? -
hi all,
I am working o adobe forms, i have to print a paragraph text which has both dymanic and static elemets in it. By putting all the text in a static text it works fine, but allignment does not happen properly.
do we have something like &.....& we have in smartforms.???
I saw in a example in which the variable was used as { } and that was dynamically filled at run-time... but i am not able to do the same...may be i am missing some settings or something...
Any help will be appreciated....in this regard.hi
Check this
Difference between Smart Forms and Adobe Form
Re: Smart Forms & Adobe Forms
Adobe forms
/message/4983958#4983958 [original link is broken]
Re: adobe forms
adobe forms
adobe forms
adobe forms -
Using loadVariables() to populate a Dynamic Text in a MovieClip
Hello everyone,
I am trying to populate a Dynamic Text with data from a
remote database. I have no problem populating the Dynamic Text with
the data from the remote database if the Dynamic Text is placed in
the main timeline using the following code.
loadVariables ("php/attorney.php", "");
Once I move the Dynamic Text into a Movie Clip with instance
name of “MC_But_1” I am only able to populate the
Dynamic Text if I place the above code in the movie clip. Since it
is going to take sometimes for the data to be transferred from the
remote database I rather to do this on the main timeline before the
MC_But_1 is shown. I have used the following code but for some
reason it is not working.
loadVariables ("php/attorney.php", _root.MC_But_1);
Can someone be kind enough to tell me where I am going wrong?
Thank you very much and have a great day.
Khoramdin> Since it is going to take sometimes for the data to be
> transferred from the remote database
That is one of the best arguments for abandoning
loadVariables() in
favor of LoadVars(). Check that out in the manual. It's
better because
there are events that get triggered when a data transfer has
completed
and you can write an event handler script to deal with server
responses.
Christian Scholz-Flöter -
Adobe form -- Issue in Displaying Dynamic text along with Static text
Hi All,
I am having an issue when i am displaying a dynamic text along with static text in adobeforms.
The dynamic text is slightly coming down and not aligned with the static text. i can see half row it is coming down.
how to align both texts to be printed in same format.
Request all of your expert advices in achieving this .
Thank you in advance.
Thanks&Regards,
Phani Miriyaila.Hi,
Select both dynamic and static text in the layout. Goto Object palette -> Layout. Give values to X,Y coordinates and Height & Width. Anchor properly and specify margins as well.
Select both dynamic and static text in the layout. Right click on it and goto palettes -> Paragraph. It gives you the text alignment options. Align the text and give similar font and size.
Thanks & Regards,
Sanoosh -
Dynamically create and remove TEXT items in forms
Hi Guys,
Is there a way to dynamically create and remove TEXT items in form. For example I have the EMP and DEPT table and when
I select the EMP table name from the LOV, rows of the EMP table with column name and data should get displayed on the screen and likewise a similar action for DEPT table and
so on. I have about 90 tables from where data could be required to view and edit. They all have varying number of columns.
Any suggestions ?
Thanks
KMD
nullUse OLE concept of developer and map Excel as an object
Nadeem
null -
Issue passing values to text symbols in Dynamic text PDF forms
Hello Everyone,
I am facing a problem related to Dynamic texts in Adobe PDF forms (Text node of type include text). I am able to pass the dynamic values to the Text node properties but i am not able to pass the values to Text symbols inside the Text node. When tested it says the field not found. I have the same structure and field in the CONTEXT as that of the text symbol. The problem i see is because in PDF the field names have $record.(fieldname) ?
Please share your thoughts if anyone has faced similar problem or know how to handle it.
Thanks a million in advance,
ChanduOpen the report up in the Designer and Click on Edit, Subreport Links. Likely what you can do is use Shared Variables to pass values from the main report to the subreport.
You need to do this in the report first. If you are using RAS then you can at runtime. If RAS is not available to you then no way in code.
See these samples:
Root Page
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessIntelligence%28BusinessObjects%29+Home
Enterprise Samples (including managed and unmanaged ras)
http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsSDKSampleApplications
Non-Enterprise Samples
http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
Exporting Samples (RAS)
http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
Also refer to the DSK help files for the Engine or RAS and search on the subreportcontroller.
If you are using RAS I'll move your post to the SDK forum.
Thank you
Don -
Anyone know how do I include the dynamic text box data in a
form? The user clicks on a picture when then populates a dynamic
text field box with the text using external txt files. I then want
the user to be able to email the form with some input fields filled
out (which is working fine), but I cannot get the text from the
dynamic fields to come through in the email. Thankslcameron@cameronsolutions
<[email protected]> wrote:
> Thanks Franz for all your help, sorry I wish I knew
something about
> PHP but never needed it before. I tried the code with
not much
> success but I think I have entered it in all wrong? Do
you think you
> could show me to whole code it should be? I have put...
>
> <?PHP
> while (list($myName, $myValue) = each($_POST)){
> $myMessage .= $myName."\n";
> for($i = 0; $i < strlen($myName); $i++){
> $myMessage .= "=";
> }
> $myMessage .= "\n";
> $myMessage .= $myValue;
> $myMessage .= "\n\n\n";
> }
>
> $to = "[email protected]";
>
> $shape = $_POST['shape'];
> $coping = $_POST['coping'];
> $name = $_POST['name'];
> $email = $_POST['email'];
>
> $subject = "Website Enquiry\n";
> $myMessage .= "Website Enquiry\n\n";
> $myMessage .= "Shape: $shape\n";
> $myMessage .= "Coping: $coping\n";
> $myMessage .= "Name: $name\n";
> $myMessage .= "Email: $email\n";
> $mailheaders = "From: $name <email>\n";
> $sentOk = mail($to,$subject,$myMessage,$mailheaders);
> echo "sentOk=" . $sentOk;
>>
>
> The results that come through in the email are;
>
>
> loadText
> ========
> start=&onLoad=%5Btype%20Function%5D
>
> name
> ====
> Lisa
>
> email
> =====
> [email protected]
>
> Website Enquiry
>
> Shape:
> Coping:
> Name: Lisa
> Email: [email protected]
Acually this seems to be just fine. All the underlined words
are variables,
sent from Flash to PHP.
Your variable loadText seems to be shaken a little. Is this
variable the one
you`re looking for?
Freundliche Grüße,
Franz Marksteiner -
Dynamic Text to be displayed as Image in Adobe Forms
Hi ,
I have a requirment to display dynamic text in the image format in the Adobe Form.
I have tried using the Image field instead of text field.But could not solve the problem.
kindly help me.
Thanks.Hello,
if you send a text into a text field to the print form, it looks like a paper print, you cannot tell where there is a picture and where is the text. So you don´t care about the image/ text problem. If you need to make difference between two for the user, you can put the text (your image) into a rectangle, use a background or anything like this.
Why would the image make any difference?
Otto -
Looking for a solution or service to export data from a dynamic form into a database
As the title of this discussion states, I'm looking for a solution or service to export data from a dynamic form into a database to be used for reporting. Creating the dynamic form is not a problem, it's getting it into a database that's more of a nuisance. A dynamic form is needed in order to provide skip logic, hide/reveal, and other similar dynamic features.
The database hasn't been created, so just looking for the easiest, more effective and dependable solution. The key is being able to run reports off the data later.So i set up 2 residential grade routers to test this out. Seems to be working okayish. I believe with directional antenae routers I should achieve what I need.
As for security I configured each device separately. I set them so only allow the MAC address of the other through wireless. This seems to be the best system for me. Once they are connected even if a MAC is spoofed of the other router it drops automatically because they are always connected. My wired devices get plugged in and recieve an IP from my main network.
There more testing to be done, but it seems to be working.
Thanks for your input and suggestions guys. I will be marking this topic as answered. -
Undeline text in Smart forms character/paragraph format
hi!!!
i have a problem in printing a Undelined text in Smart forms bec. when i print it, only the words is underlined and the spaces between the words dont have underline.
can anybody help me?
thanks in advance!!!
jamesHi Mohamed,
SmartForms and WebDynpro are two different technologies
- You can not do PrintPreview in WebDynpro.
What You could do is to store Your text using SAVE_TEXT and use text module in SmartForms,
but You can't use printer, but i.e. store PDF on the server or send PDF using mail.
Regards,
Przemysław -
My page is a dynamic page drawing product information, images
and logos, from a database. Some products have paragraph
descriptions, some prefer bulleted lists. How can I enter text into
a form testarea into a database table, that when displayed on the
page will carry either a paragraph or bulleted list format. I would
rather not have to enter 1 line at a time into a different table
column, and then apply html formating. Is there another way?
Thanks for any help!
Grandpa51If I think that's what you want is:- you need to input html
in your text area to enter into your database.
in this case you need a WYSIWYG editor . use html area. free
easy to use and cutomizable. -
Using Dynamic Text to tell a Hyperlink where to go.
So I am having a little trouble on my site, and this community seems like a good place to go for help, and I am sure someone out here can help me.
I have a webpage that uses dynamic text and images, and it serves as my user profile page. I know the database and all of that stuff is set up correctly because all of the dynamic text shows up as it should.
Here is the problem I am having. I have an area where a user will be able to view files he has uploaded, and click on the name of a file to view it.
The way I have it set up, is the clickable text is dynamic text from the server, called uploadname1. I want to make this text into a link, that sends them to the file stored as fileupload1.
Here is my code that I thought should do it.
"<a href="<?php echo $row_Recordset1['fileupload1']; ?>"/><?php echo $row_Recordset1['uploadname1']; ?></a>" (minus the quotes of course)
The text underlines and changes the color as it should, but it is not clickable. Can someone out there help me?
Tyler<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Profile - NoteScoop</title>
<style type="text/css">
body {
background-image: url(../bgg.jpg);
background-repeat: no-repeat;
color: #FFF;
#bio {
font-family: Tahoma, Geneva, sans-serif;
height: 213px;
width: 460px;
left: 404px;
top: 53px;
position: absolute;
#editlink {
font-family: Tahoma, Geneva, sans-serif;
color: #FFF;
position: absolute;
height: 40px;
width: 80px;
left: 178px;
top: 677px;
a:link {
color: #FFFBF0;
a:visited {
color: #FFFBF0;
a:hover {
color: #FFFBF0;
a:active {
color: #FFFBF0;
#photo {
position: absolute;
height: 220px;
width: 205px;
left: 121px;
top: 70px;
#submit {
font-family: Tahoma, Geneva, sans-serif;
color: #FFFbf0;
left: 290px;
top: 25px;
position: absolute;
width: 59px;
#about {
position: absolute;
height: 25px;
width: 90px;
left: 128px;
top: 25px;
font-family: Tahoma, Geneva, sans-serif;
color: #FFFbf0;
#abouthead {
position: absolute;
height: 25px;
width: 48px;
left: 466px;
top: 25px;
font-family: Tahoma, Geneva, sans-serif;
color: #FFFbf0;
#contact {
font-family: Tahoma, Geneva, sans-serif;
color: #fffbf0;
position: absolute;
height: 25px;
width: 85px;
left: 616px;
top: 25px;
#blog {
font-family: Tahoma, Geneva, sans-serif;
color: #fffbf0;
position: absolute;
height: 25px;
width: 33px;
left: 792px;
top: 25px;
#notes {
font-family:Tahoma, Geneva, sans-serif;
color: #fffbf0;
position: absolute;
height: 84px;
width: 460px;
left: 425px;
top: 510px;
#friends {
font-family: Tahoma, Geneva, sans-serif;
color: #fffbf0;
position: absolute;
left: 421px;
top: 278px;
width: 460px;
#uploader {
font-family: Tahoma, Geneva, sans-serif;
position: absolute;
height: 53px;
width: 460px;
left: 543px;
top: 645px;
#groups {
font-family: Tahoma, Geneva, sans-serif;
position: absolute;
height: 354px;
width: 292px;
left: 80px;
top: 366px;
#ad1 {
position: absolute;
height: 220px;
width: 205px;
left: -40px;
top: 38px;
#sponsored {
font-family: Tahoma, Geneva, sans-serif;
color: #000;
position: absolute;
height: 22px;
width: 122px;
left: 958px;
top: 69px;
</style>
</head>
<body>
<div class="sponsored" id="sponsored">
<div class="ad1" id="ad1"><a href="http://www.xfactordesigns.com"><img src="xfactor_designs_badge.jpg" /></a></div>
Sponsored Links
</div>
<div class="groups" id="groups">
<p>Study Halls, a feature which we are waiting to bring out until it is fully ready, will change the way you study forever. </p>
<p>Study Halls will allow you to create a worldwide network of people in the same class, school, or major as you.</p>
<p>Study Halls will contain useful note listings, chatrooms, tutors and more! </p>
<p>We look forward to being able to open these to you soon!</p>
</div>
<div class="uploader" id="uploader">
<form id="form3" name="form3" enctype="multipart/form-data" method="post" action="">
<input type="file" name="upload" id="upload" />
</form>
</div>
<div class="notes" id="notes"><a href="az.doc"/>tester</a></div>
<div class="blog" id="blog"><a href="http://www.quincycreations.com">Blog</a></div>
<div class="contact" id="contact"><a href="contact.php">Contact</a></div>
<div class="photo" id="photo"><img src="profilephotos/twhite.jpg" alt="UserPhoto" width="205" height="220" /></div>
<div class="abouthead" id="abouthead"><a href="About.php">About</a></div>
<div class="submit" id="submit"><a href="Submit.php">Submit</a></div>
<div class="editlink" id="editlink"><a href="editprofile.php">Edit Profile</a></div>
<div class="about" id="about"><a href="classes.php">Subjects</a></div>
<div class="bio " id="bio">
<form id="form1" name="form1" method="post" action="">
<p><h3>Tyler White</h3>
</p>
<p>College: Xavier University of Louisiana </p>
<p>Major: Mathematics</p>
<p>Not only am I the creator of NoteScoop, but I am also a college student. I study Mathematics and am doing research in Differential Equations. When I am not doing work or math, I am spending time with my wonderful girlfriend, most likely on Minecraft.</p>
<p> </p>
<p> </p>
</form>
</div>
<div class="friends" id="friends">
<form id="form2" name="form2" method="post" action="">
<p> </p>
<table width="460" height="147" border="o">
<tr>
<th width="146" height="141" scope="row"><img src="profilephotos/paminaprofile.jpg" width="104" height="107" /></th>
<td width="146"><img src="profilephotos/default.jpg" width="104" height="107" /></td>
<td width="146"><img src="profilephotos/default.jpg" width="104" height="107" /></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
</form>
</div>
</body>
</html> -
Hi,
in SmartForms I use dynamic texts to output information in the form. It works fine but I have to format some of them for a smaller or bigger font. SAP does not give any possibility to set the paragraph and/or character formats like in the case of text elements.
How can I format my texts ??
Thanks.Hi Jorge,
It is possible to create paragraph format and character formats in smartforms.
Go to tcode-SMARTSTYLES and create a style and then specify ur style in smartforms
Globalsettings->Formattributes->outputoptions->style
if ur copying predefined smartform the copy the used style into Zstyle and make further changes like ur own formata and use it...
Thanks&Regards,
Rama Krishna. -
Upload multiple files WITH correct pairs of form fields into Database
In my form page, I would like to allow 3 files upload and 3 corresponding text fields, so that the filename and text description can be saved in database table in correct pair. Like this:
INSERT INTO table1 (filename,desc) VALUES('photo1.jpg','happy day');
INSERT INTO table1 (filename,desc) VALUES('photo2.jpg','fire camp');
INSERT INTO table1 (filename,desc) VALUES('photo3.jpg','christmas night');
However, using the commons fileupload, http://commons.apache.org/fileupload/, I don't know how to reconstruct my codes so that I can acheieve this result.
if(item.isFormField()){
}else{
}I seems to be restricted from this structure.
The jsp form page
<input type="text" name="description1" value="" />
<input type="file" name="sourcefile" value="" />
<input type="text" name="description2" value="" />
<input type="file" name="sourcefile" value="" />The Servlet file
package Upload;
import sql.*;
import user.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Map;
import java.util.HashMap;
import java.util.Date;
import java.util.List;
import java.util.Iterator;
import java.io.File;
import java.io.PrintWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.*;
public class UploadFile extends HttpServlet {
private String fs;
private String category = null;
private String realpath = null;
public String imagepath = null;
public PrintWriter out;
private Map<String, String> formfield = new HashMap<String, String>();
//Initialize global variables
public void init(ServletConfig config, ServletContext context) throws ServletException {
super.init(config);
//Process the HTTP Post request
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
Thumbnail thumb = new Thumbnail();
fs = System.getProperty("file.separator");
this.SetImagePath();
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
if(!isMultipart){
out.print("not multiple part.");
}else{
FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
List items = null;
try{
items = upload.parseRequest(request);
} catch (FileUploadException e) {
e.printStackTrace();
Iterator itr = items.iterator();
while (itr.hasNext()) {
FileItem item = (FileItem) itr.next();
if(item.isFormField()){
String formvalue = new String(item.getString().getBytes("ISO-8859-1"), "utf-8");
formfield.put(item.getFieldName(),formvalue);
out.println("Normal Form Field, ParaName:" + item.getFieldName() + ", ParaValue: " + formvalue + "<br/>");
}else{
String itemName = item.getName();
String filename = GetTodayDate() + "-" + itemName;
try{
new File(this.imagepath + formfield.get("category")).mkdirs();
new File(this.imagepath + formfield.get("category")+fs+"thumbnails").mkdirs();
//Save the file to the destination path
File savedFile = new File(this.imagepath + formfield.get("category") + fs + filename);
item.write(savedFile);
thumb.Process(this.imagepath + formfield.get("category") +fs+ filename,this.imagepath + formfield.get("category") +fs+ "thumbnails" +fs+ filename, 25, 100);
DBConnection db = new DBConnection();
String sql = "SELECT id from category where name = '"+formfield.get("category")+"'";
db.SelectQuery(sql);
while(db.rs.next()){
int cat_id = db.rs.getInt("id");
sql = "INSERT INTO file (cat_id,filename,description) VALUES ("+cat_id+",'"+filename+"','"+formfield.get("description")+"')";
out.println(sql);
db.RunQuery(sql);
} catch (Exception e){
e.printStackTrace();
HttpSession session = request.getSession();
UserData k = (UserData)session.getAttribute("userdata");
k.setMessage("File Upload successfully");
response.sendRedirect("./Upload.jsp");
//Get today date, it is a test, actually the current date can be retrieved from SQL
public String GetTodayDate(){
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String today = format.format(new Date());
return today;
//Set the current RealPath which the file calls for this file
public void SetRealPath(){
this.realpath = getServletConfig().getServletContext().getRealPath("/");
public void SetImagePath(){
this.SetRealPath();
this.imagepath = this.realpath + "images" +fs;
}Can anyone give me some code suggestion? Thx.When one hits the submit button - I then get a 404 page error.What is the apaches(?) error log saying? Mostly you get very useful information when looking into the error log!
In any case you may look at how you are Uploading Multiple Files with mod_plsql.
Maybe you are looking for
-
Upgraded from 10.3.9 to 10.4.8 and now Logic wont open at all!
Upgraded from 10.3.9 to 10.4.8 and now Logic wont open at all! Im using Logic 7.1 Everything was fine till I upgraded.... Now when I click to open Logic it never gets past the startupscreen, and then I get a message saying "Logic has unuexpectedly qu
-
Text jumps after embedding font in dynamic text field!
Hi this is driving me mad Im using a standard font (Gotham rounded) within a dynamic text field. As soon as I embed the numerals within this text field the text lowers within the text field. Double clicking the field then renders the text higher up!
-
I recently switched my application that uses EWS from an on-premise Exchange Server to Exchage Online through Office356. The process worked just fine for several days, then I started getting the following errors; Error accessing [USERNAME] email acco
-
How do I switch from PS CC to Bridge CC?
When I click of File > Browse in Bridge Adobe Creative Cloud opens. It will ask me if I want to download another version of Bridge. I say no, then click on the Bridge icon, and Bridge finally opens. Is this the way it is suppose to work? Can't I go d
-
Using Anchored Frame Object Attributes to "Store" Art Numbers
Good Morning, Everyone, I have been using FrameMaker for over 15 years now, and as a tech writer who has inherited LOTS of graphics-intensive documents from previous writers, I have often struggled with identifying source files for embedded graphics.