Jump to content

JSP related question

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
thieflock

thieflock

    Newbie

  • Members
  • PipPip
  • 29 posts
I am trying to make a web page that when a submit button is clicked my database is updated with the user information. I have the files done and configured Tomcat. The problem is when I clicks the submit button I get a loaded page with

<% String driver, url, username, password, execution, sql;
driver = request.getParameter("driver");
url = request.getParameter("url");
username = request.getParameter("username");
password = request.getParameter("password");
execution = request.getParameter("execution");
sql = request.getParameter("sql");
%>


which is part of my .jsp file.

Any ideas?

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
What is surrounding that in the source jsp file?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
thieflock

thieflock

    Newbie

  • Members
  • PipPip
  • 29 posts
Sorry I submitted the wrong code, this is what is printing
<% 
  String ISBN, bookTitle, authorLName, authorFName, bookPublisher, bookSynopsis. yearOfPub, bookQuantity;
  
  ISBN = request.getParameter("ISBN");
  bookTitle = request.getParameter("bookTitle");
  authorLName = request.getParameter("authorLName");
  authorFName = request.getParameter("authorFName");
  bookPublisher = request.getParameter("bookPublisher");
  bookSynopsis = request.getParameter("bookSynopsis");
  yearOfPub = request.getParameter("yearOfPub");
  bookQuantity = request.getParameter("bookQuantity");
%>
and this is the whole file:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <link rel="stylesheet" href="template.css" type="text/css">
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">

</head>
<body>

<% 
  String ISBN, bookTitle, authorLName, authorFName, bookPublisher, bookSynopsis. yearOfPub, bookQuantity;
  
  ISBN = request.getParameter("ISBN");
  bookTitle = request.getParameter("bookTitle");
  authorLName = request.getParameter("authorLName");
  authorFName = request.getParameter("authorFName");
  bookPublisher = request.getParameter("bookPublisher");
  bookSynopsis = request.getParameter("bookSynopsis");
  yearOfPub = request.getParameter("yearOfPub");
  bookQuantity = request.getParameter("bookQuantity");
%>

<jsp:useBean id="addBookBean" class="myBeans.AddBookBean">  
  <jsp:setProperty name="addBookBean" property="ISBN" value="<%= ISBN %>" />
  <jsp:setProperty name="addBookBean" property="bookTitle" value="<%= bookTitle %>" />
  <jsp:setProperty name="addBookBean" property="authorLName" value="<%= authorFName %>" />
  <jsp:setProperty name="addBookBean" property="bookPublisher" value="<%= bookPublisher %>" />
  <jsp:setProperty name="addBookBean" property="bookSynopsis" value="<%= bookSynopsis %>" />
  <jsp:setProperty name="addBookBean" property="yearOfPub" value="<%= yearOfPub %>" />
  <jsp:setProperty name="addBookBean" property="bookQuantity" value="<%= bookQuantity %>" />
    
</body>
</html>