problem in web application : I have a database names tasks in SQL server 2005 having tasks id as primay key, I am using JSP and struts for database connectivity,Now I can update my database but i want to autogenerate tasks id in numbers on JSP page when I click on CreateTask.jsp page.How can i do so?My project storing user entered task id,task name ,date etc properly in the database,but what and how should i make it (in taskAction.java) that it auto generate tasksid in jp page when i click on Create_task.jsp and other data user can enter himself.I am using Jdeveloper.Codes: create.jsp :- -
<%@ page language="Java" %>
-
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%><%@ page contentType="text/html;charset=windows-1252"%>
-
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
-
-
<html:form action ="taskAction.do">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-
<title>untitled</title>
-
</head>
-
<body>
-
<form >
-
<P> </P>
-
<BLOCKQUOTE>
-
<BLOCKQUOTE>
-
<BLOCKQUOTE>
-
<BLOCKQUOTE>
-
<P>
-
<SPAN style="background-color:rgb(204,204,204); background-color:rgb(204,204,204);"><SPAN style="background-color:rgb(255,255,255);"><FONT color="#006666"><STRONG><U><h1>
-
<SPAN style="background-color:rgb(255,255,255); background-color:rgb(204,204,204);">TASK MANAGER</SPAN>
-
</h1></U></STRONG> </FONT><SPAN style="background-color:rgb(204,255,255); background-color:rgb(204,204,255);"><FONT color="#003300"> </FONT></SPAN> </SPAN></SPAN></P>
-
</BLOCKQUOTE>
-
</BLOCKQUOTE>
-
</BLOCKQUOTE>
-
</BLOCKQUOTE>
-
<P>
-
<SPAN style="background-color:rgb(204,255,255); background-color:rgb(204,204,255);"><FONT color="#003300"> Task Id
-
<html:text property="taskid"/>
-
</FONT>
-
</SPAN>
-
</P>
-
<P>
-
<SPAN style="background-color:rgb(204,255,255); background-color:rgb(204,204,255);"><FONT color="#003300"> Task Name
-
<html:text property="taskname"/>
-
</FONT>
-
</SPAN>
-
</P>
-
<P>
-
<SPAN style="background-color:rgb(204,255,255); background-color:rgb(204,204,255);"><FONT color="#003300"> Date
-
<html:text property="dateOfBirth"/>
-
</FONT>
-
</SPAN>
-
</P>
-
<P>
-
</P>
-
<P>
-
<input type="submit" value="Submit"/></P>
-
</form>
-
</body>
-
</html:form>
-
taskAction.java :- -
-
//import TaskBO;
-
import org.apache.struts.action.Action;
-
import javax.servlet.http.HttpServletRequest;
-
import javax.servlet.http.HttpServletResponse;
-
import org.apache.struts.action.*;
-
-
-
-
public class taskAction extends Action
-
{
-
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
-
HttpServletResponse response)
-
{
-
ActionForward forward;
-
taskform tForm = (taskform) form;
-
Taskdata taskdata = populateTaskdata(tForm);
-
TaskBO taskBO = new TaskBO();
-
if (taskBO.createtask(taskdata))
-
{
-
forward = mapping.findForward("success");
-
}
-
else
-
{
-
forward = mapping.findForward("failure");
-
}
-
return forward;
-
-
}
-
private Taskdata populateTaskdata(taskform form)
-
{
-
Taskdata td = new Taskdata();
-
td.setTaskid(form.getTaskid());
-
td.setTaskname(form.getTaskname());
-
td.setDateOfBirth(form.getDateOfBirth());
-
-
return td;
-
}
-
}
-
taskform.java :- -
-
import org.apache.struts.action.ActionForm;
-
-
public class taskform extends ActionForm
-
{
-
-
private int taskid;
-
private String taskname;
-
private String dateOfBirth;
-
private String update;
-
private String delete;
-
-
public taskform()
-
{
-
taskid = 0;
-
taskname = "";
-
dateOfBirth = "";
-
}
-
-
-
-
public void setTaskid(int taskid)
-
{
-
this.taskid = taskid;
-
}
-
public int getTaskid()
-
{
-
return taskid;
-
}
-
-
-
public void setTaskname(String taskname)
-
{
-
this.taskname = taskname;
-
}
-
-
public String getTaskname()
-
{
-
return taskname;
-
}
-
-
public void setDateOfBirth(String dateOfBirth)
-
{
-
this.dateOfBirth = dateOfBirth;
-
}
-
-
-
public String getDateOfBirth()
-
{
-
return dateOfBirth;
-
}
-
-
-
public void setUpdate(String update)
-
{
-
this.update = update;
-
}
-
-
-
public String getUpdate()
-
{
-
return update;
-
}
-
-
-
public void setDelete(String delete)
-
{
-
this.delete = delete;
-
}
-
-
-
public String getDelete()
-
{
-
return delete;
-
}
-
}
-
Hi,
In C# we have a Random class. This class has a member fucntion [I]next()[/i], this will provide a random int data which is unique..
Random ranobj= new Random();
taskid=ranobj.next();
1 6675
Hi,
In C# we have a Random class. This class has a member fucntion [I]next()[/i], this will provide a random int data which is unique..
Random ranobj= new Random();
taskid=ranobj.next();
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Paul Robinson |
last post by:
I am developing a website in ASP that connects to a Sybase database.
However, when I try to open a connection to the database the page will not
load. The script does not timeout, nor the...
|
by: Jon |
last post by:
I have a bunch of uplevel browser functionality on some pages and need to do
something to prevent downlevel browsers from trying to load such pages.
These pages would require IE 5 or newer in order...
|
by: vaidas gudas |
last post by:
How to make in ASP.NET with VB.NET page, how show preview html page for
print in pdf format
|
by: Shimon Sim |
last post by:
Hi
Is it possible to make sure that the page doesn't show in browser history
and won't effect Back button.
The problem is that every postback shows as another entry for "Back" button
and user...
|
by: Torben Laursen |
last post by:
I would like to be able to extract a page from my helpfile and show it in
the interface so it is part of the interface and not a popup.
Using helpprovider I can get any page to popup but I would...
|
by: karen987 |
last post by:
I have a webpage called "topicview.asp" on a news website with ASP pages, it's a simple news publishing software. You add the news from the Admin section and all the details are stored in a...
|
by: radcaesar |
last post by:
Hi All,
My Clients (C1 and C2) sharing a same application for their business. Now C2 only wants to change the UI of the ASP Pages.
Now, If C1 enters, it should show the old ASP Page and...
|
by: ~john |
last post by:
I have binary files stored in a SQL Server table that I want the user
to be able to download from an aspx webpage. The files are displayed
on the form as "LinkButtons". When the link is clicked the...
|
by: Bob Bedford |
last post by:
Hi all,
I've a site on a hosting that has a protected directory for statistics. The
only way to give access to those stats is either give access to everybody or
give the customer the admin...
|
by: janetopps |
last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |