|
hello, currently using netbeans and java. I figure it out to add data on the web however after adding the new data, the data isn't being added to the database. needing help..
i refer to this as a reference : http://netbeans.org/kb/65/web/inserts-updates-deletes.html#01d[^]
modified on Wednesday, December 15, 2010 11:22 PM
|
|
|
|
|
pancakeleh wrote: I figure it out to add data on the web however after adding the new data, the data isn't being added to the database
Please Mention your Code in your Question because of this we can easily analyze what is problem whatever ,
You Should Navigate the Given link to get concept of how to Work with DB
Working With DB[^]
Hope it Will works for you
|
|
|
|
|
i have this table which i am able to add values in however unable to add it to the database. how do i use the table to input data into database?
my add button are as follows:
public String add_action() {<br />
try {<br />
RowKey rk = instancedataDataProvider.appendRow();<br />
instancedataDataProvider.setCursorRow(rk);<br />
<br />
instancedataDataProvider.setValue("INSTANCEDATA.INSTANCEID", new Integer(0));<br />
instancedataDataProvider.setValue("INSTANCEDATA.INSTANCEDATA", new Integer(1));<br />
<br />
instancedataDataProvider.commitChanges();<br />
instancedataDataProvider.refresh();<br />
<br />
} catch (Exception ex) {<br />
log("Error Description", ex);<br />
error(ex.getMessage());<br />
}<br />
return null;<br />
<br />
}
my save button as follows:
<br />
public String save_action() {<br />
<br />
try {<br />
<br />
CachedRowSetDataProvider maxInstance = getSessionBean1().getmaxinstancedataDataProvider();<br />
maxInstance.refresh();<br />
maxInstance.cursorFirst();<br />
long newInstanceId = ((Long) maxInstance.getValue("MAXINSTANCEID"));<br />
<br />
<br />
if (instancedataDataProvider.getRowCount() > 0) {<br />
instancedataDataProvider.cursorFirst();<br />
do {<br />
if (instancedataDataProvider.getValue("INSTANCEDATA.INSTANCEID").equals<br />
(new Long(0))) {<br />
instancedataDataProvider.setValue("INSTANCEDATA.INSTANCEID",<br />
new Long(newInstanceId));<br />
newInstanceId++;<br />
}<br />
<br />
} while (instancedataDataProvider.cursorNext());<br />
}<br />
instancedataDataProvider.commitChanges();<br />
<br />
<br />
} catch (Exception ex) {<br />
log("Error Description", ex);<br />
error("Error :"+ex.getMessage());<br />
}<br />
<br />
modified on Thursday, December 16, 2010 2:02 AM
|
|
|
|
|
When you say you are "unable to add", what do you mean? Do you get an exception? Does it fail to compile? Does nothing happen at all? Does it insert the wrong value?
One thing I notice is that your code is different from the NetBeans tutorial. In your code, you are committing the changes in the add_action method. In the NetBeans tutorial, they do not do that. They update the local data set in add_action but do not commit back to the database until the save_action call. In add_action you do not have a unique id allocated so I can guess that might give you problems.
As an aside, the NetBeans tutorial is a bit of a clumsy example of how to write database applications. It's not really very well architected.
|
|
|
|
|
oh i modify the code to suit my program, that is why it look different from the tutorial. oh any good database application to share?
|
|
|
|
|
pancakeleh wrote: oh any good database application to share?
Of-course move to Google there are lots of database application. whatever, this Link[^] may help you.
|
|
|
|
|
thank you i managed to figure it out
|
|
|
|
|
is this a oracle database??
why are you dealing with the cursor? I never used Oracle DB, but this seems strange to me
Your task is just about fetching data from an table and pushing it into the database?
Is the data to be modified in the table?
regards,
Torsten
I never finish anyth...
|
|
|
|
|
|
Hello, I am currently using netbeans and glassfish for my project as i am very new to java programming as well as netbeans, i came across this particular problem which is to display, edit, delete and update the database. I am now able to display the datas from the database in a table on a web jsp file. Right now not sure of how to edit and delete the data in the table and update the database. needing help.
|
|
|
|
|
I could not resist
EDIT: Who expected that? Google did give another, better result. Do they manipulate search results Click me hard
regards,
Torsten
I never finish anyth...
|
|
|
|
|
how to read next page of the same URL
the URL of the page contain many pages i read the first page using
URL(url).openStream()
but it just reading the first page
for example this site i read the first page how can i read the second culture.gov.uk/news/news_stories/6832.aspx
|
|
|
|
|
You could set up a wired script, forcing the Server to hand over all it's pages - or the script cuts off the power!
Or you use the weblinks to retrieve the data like the rest of us would do (well - most of us...). Weblinks start with "< a ...>" and do end with "".
regards,
Torsten
I never finish anyth...
modified on Wednesday, December 15, 2010 2:30 AM
|
|
|
|
|
|
damn - I can't think of a single webpage explaining how a HTML Link looks like...
Where is the problem?
Don't you know how to program in general?
Or are you just a student trying to get a non regular homework done without invest?
regards,
Torsten
I never finish anyth...
|
|
|
|
|
i am not asking about the links the page use java scripts so i want to ask about handling the Java script i my program to go to next page the JavaScript is as the following
a href="javascript: __doPostBack('ctl00$PlaceHolderMain$g_781eb52f_faa9_4d59_9cae_2baec06ac484','dvt_firstrow={11};dvt_startposition={Paged=TRUE&p_Created_x0020_Date=11%2f10%2f2009%206%3a06%3a47%20AM&p_ID=257}');"><img border="0" alt="Next" src="/_layouts/images/next.gif"></a>
|
|
|
|
|
This is a JS command. On clicking that link, there is some action to be done. __doPostBack(args) seems to be a command from some Web2.0-Page. Where is it from? Facebook? Twitter?
A CMS should always send plain text-links like posted/linked before.
These are links you can observe.
regards,
Torsten
I never finish anyth...
|
|
|
|
|
actually i want to extract all the links from web page but the page contain many pages using Java script with the same URL i try to use HtmlUnit but it give me error
the link is from university web site
|
|
|
|
|
You can extract links to pages - not some wired submit-actions.
Have you checked Davids suggestion? There is a tutorial on this on one of those good old sun-servers: Clickedy
regards,
Torsten
I never finish anyth...
|
|
|
|
|
yes i try to search a bout web crawling but non of them handle the JavaScript
do you have other suggests or library that can help
|
|
|
|
|
no. do your own search.
regards,
Torsten
I never finish anyth...
|
|
|
|
|
Try searching for "java web crawler". That will show you some examples that do something similar.
|
|
|
|
|
Hi Friends,
I am trying to fetch database values in java template based on some specific criateria. can any one please let me know any example how can we do this job. Thanks in advance
Regard's
Kaushik
|
|
|
|
|
What do you mean by a "java template" in this case?
|
|
|
|
|
Y_Kaushik wrote: I am trying to fetch database values in java template based on some specific criateria
Which type of template and what about specific criteria. please let be clear so we can help you.
|
|
|
|