Validation of string extension and editing documents

R

Roy

Hello

I have look at this site for some time now getting tidbits of
information and knowledge from the people here, I am new to
programming literally, my background is business but I have been
thrust into java since July.

It has been a very unique experience with only two weeks of training
*S* I have a task where I am trying to validate a file extension to
make sure it is valid.The extension would either be xls, doc, text,
ppt, online/webform and pdf.

Here is the code I have been working with if anyone has any ideas
please help me.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="db" scope="request"
class="com.kdoc.beans.DBConnectionInfo"/>
<%@ taglib uri= "../WEB-INF/c.tld" prefix="c"%>
<%@ taglib uri= "../WEB-INF/taglib48.tld" prefix="dbt" %>
<%//<c:set var="Doc" value="${param.Doc}" />
//<c:if test="${!empty Doc}"><c:redirect url="${Doc}"/></c:if> %>
<% String DocName="";
if(request.getParameter("DocName")!=null) {
DocName = (String)request.getParameter("DocName"); }
String TITLE="";
if(request.getParameter("DOC_TITLE")!=null) {
TITLE = (String)request.getParameter("DOC_TITLE"); }
String[] rType = {".xls", ".doc", ".txt", ".pdf", ".ppt"};
%>
<dbt:eek:penConnection driver="<%= db.getDbDriverName() %>" url="<%=
db.getDbUrl() %>" user="<%= db.getDbUser() %>" password="<%=
db.getDbPassword() %>" id="A"/>
<dbt:setQuery id="A" res="rsCatDOC">
<dbt:setSQL>SELECT (CCAT_ID), rtrim(CCAT_TITLE), CCAT_RANK from
OLAPPS.WIA_CCAT</dbt:setSQL>
</dbt:setQuery >
<dbt:eek:penConnection driver="<%= db.getDbDriverName() %>" url="<%=
db.getDbUrl() %>" user="<%= db.getDbUser() %>" password="<%=
db.getDbPassword() %>" id="B"/>
<dbt:setQuery id="B" res="rsDOC">
<dbt:setSQL>SELECT (DOC_ID), rtrim(DOC_TITLE), DOC_RANK from
COREWEB.CORE_DOCS</dbt:setSQL>
</dbt:setQuery >

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>WIADOCS</title>
</head>

<body>


<form action="<%= request.getRequestURI() %>" method="get"
enctype="multipart/form-data" class="formstyle" >

<select name="CatDoc" class="formselectbox" size="1" id="CatDoc" >
<dbt:forEachRow res="rsCatDOC">
<dbt:getColumn res="rsCatDOC" position="1" id="CCAT_ID" />
<dbt:getColumn res="rsCatDOC" position="2" id="CCAT_TITLE" />
<option value="<%=CCAT_ID %>"><%=CCAT_TITLE %></option>
</dbt:forEachRow></select>
<select name="Doc" class="formselectbox" size="1" id="Doc">
<dbt:forEachRow res="rsDOC">
<dbt:getColumn res="rsDOC" position="1" id="DOC_ID" />
<dbt:getColumn res="rsDOC" position="2" id="DOC_TITLE" />
<option value="<%=DOC_ID %>"><%=DOC_TITLE %></option>
</dbt:forEachRow>
</select>
<input name="Submit" type="submit" id="submit" value="Submit" />

<label>Document input field:</label><br>
<input type="text" name="DocName">

</form>
<%=DocName %><%=TITLE %>
</body>
</html>
<dbt:closeConnection id="A"/>
<dbt:closeConnection id="B"/>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top