Hey guys im trying to make a user form for my HTML page which asks the User to input a question and by clicking the Submit button I want the page to display the Text (Question Inputted) and the date that the user actually asked the question.

This is how far I've gotten but I keep getting errors:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Course work Test</title>
</head>
<body>
Input your question here

<form action=CourseworkTest.jsp method=post>
<textarea name="question" rows=3 cols=100 ></textarea><br>
<input type="submit" value="Save"><br><br>

</form>
All questions:
<jsp:useBean id="nl" class="questionspackage.QuestionsStore" scope="application"/>
<!-- <%
String[] str= new String[2];
str[0]= "questions";
str[1]= new Date().toString();
%>
 -->

<%
Vector <String[]> theList = nl.getQuestions();

%>



<ol>

<%
for (int i=0; i < theList.size(); i++) 
{
%>
<li> <%= theList.elementAt(0)+ "Posted on: " + theList.elementAt(1)%> </li>
<%
}
%>
</ol>



</body>
</html>

This is the java class I've set up:

package questionspackage;

import java.util.Vector;


public class QuestionsStore {
	Vector<String[]> questions = new Vector<String[]>();
	
	public void setQuestion(String[] theQuestions){
	questions.addElement(theQuestions);
	}
	public Vector<String[]> getQuestions() {
	return questions;
	}
}

what kind of errors are you getting?

Hey stultuske, basically, I'm getting no errors, the code seems correct with no red underlined text, however the typed questions from the Text Box are not appearing on the list below the form area. Any ideas?

Are you kidding....said that I keep getting errors and now you will tell us your not getting errors....Oh common please clear up you problem..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.