avinashguru prasad

Greenhorn
+ Follow
since Nov 23, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by avinashguru prasad

hoe can we make our android layout beautiful and attractive?
4 years ago

Steve Luke wrote:Can you edit your mesgsage and UseCodeCodeTags please?

What does LogCat tell you? Any errors?





ActivityManager: Warning: Activity not started, its current task has been brought to the front.
and also suspended breakpoint at statement="setContentView(R.layout.activity_main);"
4 years ago
I have the following code for inserting data to database but it fails to add data to database.
Breakpoint comes at the statement-"setContentView(R.layout.activity_main);"




package com.avi.datainsertclick;

import java.util.ArrayList;



import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.Toast;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.view.View;


public class MainActivity extends Activity {
EditText utext,ptext;
Button lbtn;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

final DBAdapter db=new DBAdapter(this);

db.open();
/* long id=db.insertContact("wei-meng lee","ak10698@gmail.com");
db.close();*/
Button btn1 = (Button) findViewById(R.id.btn1);
utext = (EditText) findViewById(R.id.et1);
ptext = (EditText) findViewById(R.id.et2);
btn1.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
String ut = utext.getText().toString();
String pt = ptext.getText().toString();


try {

db.insertContact(ut, pt);

} catch (Exception e) {




Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_SHORT).show();
}

}
});

/* Cursor cursor = db.getAllContacts();
for(int i = 0; i < cursor.getCount(); i++) {
cursor.moveToPosition(i);
int rid = cursor.getInt(cursor.getColumnIndexOrThrow(DBAdapter.KEY_ROWID));
String name = cursor.getString(cursor.getColumnIndexOrThrow(DBAdapter.KEY_NAME));
String email = cursor.getString(cursor.getColumnIndexOrThrow(DBAdapter.KEY_EMAIL));
Toast.makeText(getApplicationContext(), rid + "-" + name + "-" + email, Toast.LENGTH_LONG).show();

}*/
cursor.close();
db.close();
}


}


inside class 'DBAdapter' this is the mathod



public long insertContact(String name,String email) {

ContentValues initialValues=new ContentValues();
initialValues.put(KEY_NAME,name);
initialValues.put(KEY_EMAIL,email);
return db.insert(DATABASE_TABLE, null, initialValues);
}

4 years ago

avinashguru prasad wrote:

Jayesh A Lalwani wrote:It doiesn't work doesn't help us. What problem do you get? A compilation problem? A run time error?





after running the code i get a blank page with no any error.

5 years ago
JSP

Jayesh A Lalwani wrote:It doiesn't work doesn't help us. What problem do you get? A compilation problem? A run time error?





after running the code i get a blank page with no output.
5 years ago
JSP
THIS FOLLOWING CODE IS FOR SHOWING SINGLE CUSTOMER INFORMATION NAMED'view_all.jsp'

this CODE 'view_all.jsp' IS FORWARDED TO 'edit1.java' which is not working for updating records.



MY FOLLOWING UPDATE CODE FOR RECORDS IS NOT WORKING PLEASE CORRECT MY CODE.

THIS IS SERVLET CODE NAMED 'edit1.java'

5 years ago
JSP
after runing the following code on netbeans ide 7.0 beta i got following error :"C:\Users\avinash\Documents\NetBeansProjects\CYBERSPACE\nbproject\build-impl.xml:708
The module has not been deployed".




import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class sample1 extends HttpServlet
{
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException
{
HttpSession session=req.getSession(true);
try
{
Class.forName("oracle.jdbc.OracleDriver");
Connection con=DriverManager.getConnection("jdbcracle:thin:@localhost:1521:XE","system","avinash");
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("select * from customer");

PrintWriter pw=res.getWriter();
res.setContentType("text/html");
String uname=null;
String pwd=null;
String c_id=null;
boolean flag = false;
String s1=req.getParameter("cust_id");
String s2=req.getParameter("username");
String s3=req.getParameter("password");
while(rs.next())
{
c_id=rs.getString(1);
uname=rs.getString(2);
pwd=rs.getString(3);
if(s1.equals(c_id) && s2.equals(uname) && s3.equals(pwd))
{
flag=true;

}
}

if(flag)

{
session.setAttribute("cust_id", s1);
res.sendRedirect("http://localhost:8084/CYBERSPACE/Cust_Home.jsp");

}
else
{
pw.println("Invalid");
pw.println("<a href='http://localhost:8084/CYBERSPACE/c_signin.jsp'> ok </a>");

}
}
catch(Exception e)
{

}
}
}
Creating a JSP Page to Handle a Delete Action and Adding a Link to Delete an Employee.
5 years ago
JSP
Creating a JSP Page to Edit Employee Data with oracle.
5 years ago
JSP
Creating a jsp page to Update Employee Data with link to an update page.
5 years ago
JSP
api

avinashguru prasad wrote:why we need api in java

5 years ago
api
why we need api in java
5 years ago
what is the difference between Get and Post method.
5 years ago
Hi,

Could anyone explain to me what the difference is between the request.getURI() and request.getURL() methods?

I'm not entirely sure what the difference is between a uri and url?

Thanks
5 years ago
JSP