hrishih punekar

Greenhorn
+ Follow
since Jan 08, 2013
Merit badge: grant badges
For More
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
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by hrishih punekar

Hi, I have completed my java desktop application using eclipse. now I want to create executable jar file so I can give it to client. I have created jar file by exporting it but it is not running on other systems. how I can pass all resources to clients system. I have used following
database MS access...One background image...and two reports in jasper report.
9 years ago

Bear Bibeault wrote:Check your spelling.


Thank you..its working now.
9 years ago

Bear Bibeault wrote:You haven't shown us how you are obtaining the value in the servlet from the request parameter.


9 years ago

Ivan Jozsef Balazs wrote:Do you put on purpose several times the same value ("Historical") as value into the select?


no..Sorry it was my mistake.
9 years ago

Ishan Pandya wrote:how to fill the "categery" in the servlet?
Is "categery" variable null when you insert into DB?



no I select it from dropdown list. But it is inserted as null in DB.
9 years ago
I am using servlet html and css. everything works fine but value selected from select box of html is not reflecting in database. NULL value is going each time into database for select option.



and

html code for select tag is
<select name="categery" >
<option value="Art">Art</option>
<option value="Electronics">Electronics</option>
<option value="Music and Video">Music and Video</option>
<option value="Historical">Historical</option>
<option value="Clothes">Clothes</option>
<option value="Historical">Bikes and Cars</option>
<option value="Historical">Statue</option>
<option value="Historical">Diamonds</option>
</select>
9 years ago
In java web how to make login of user compulsory before accessing specific pages / resources
9 years ago
how to use file upload in eclipse for servlet. so I can use request.getpart(). Is it require Apache's common file-upload ? If yes how to use those files in eclipse.
No..Its not working. bit if code is used outside eclipse it works fine...
and when used with eclipse page opens as http://localhost:8080/Auction/painting.html
I am developing project using servlet html css in eclipse. Images are displaying in IE and tomcat but not in any other browser.but when I copied html code into notepad and tried to run then images are displaying in all browsers. Images are stored in web content folder of eclipse.
and i am using img tag as :
<img src="file:///D:/Workspace/Auction/WebContent/paint1.jpg" />
validation is not working. data is going in database..please help
HTML page is:


CCS is:


and servlet is:


[added code tags]
I have done following code for poll creation where users votes are counted. And I want show the votes in poll format ie. in graphical format. How to do so.
code:


import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JRadioButton;

import sun.security.krb5.internal.LastReqEntry;


public class polling1 extends HttpServlet implements ActionListener{
private static final long serialVersionUID = 1L;

Connection con;
Statement st;
ResultSet rs;
PreparedStatement ps;
int r1_count=0;
int r2_count=0;
JFrame f=new JFrame();
JButton submit=new JButton("SUBMIT");
JRadioButton r1=new JRadioButton("SAKAL");
JRadioButton r2=new JRadioButton("TIMES");
ButtonGroup g=new ButtonGroup();

public void init(ServletConfig config) throws ServletException {

try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORACLE11","scott","tiger");
st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
//rs=st.executeQuery("select * from registration");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



f.setLayout(null);
r1.setBounds(200,200,150,50);
r2.setBounds(200,300,150,50);
submit.setBounds(200,400,150,30);
r1.addActionListener(this);
r2.addActionListener(this);
submit.addActionListener(this);
}


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
f.setBounds(500,500,500,500);
r1.setSelected(false);
r2.setSelected(false);
g.add(r1);
g.add(r2);
f.add(r1);
f.add(r2);
f.add(submit);
f.setVisible(true);
}


@Override
public void actionPerformed(ActionEvent e) {

if(e.getSource()==submit)
{



if(r1.isSelected()==true)
{
try {
rs=st.executeQuery("select * from poll order by count1");
rs.last();

System.out.println(rs.getInt(1));
int count1=rs.getInt(1);
//System.out.println(count1);
count1++;

ps=con.prepareStatement("insert into poll values(?,?)");
ps.setInt(1,count1);
ps.setInt(2,0);

int numRowsChanged=ps.executeUpdate();
//ps.setInt(2, 0);



} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
r1_count++;
//System.out.println("Sakal"+r1_count);
//System.out.println("Times"+r2_count);
}




if(r2.isSelected()==true);

{

try {
rs=st.executeQuery("select * from poll order by count2");
rs.last();

//System.out.println(rs.getInt(2));
int count2=rs.getInt(2);
System.out.println(count2);
count2++;

ps=con.prepareStatement("insert into poll values(?,?)");
ps.setInt(1, 0);
ps.setInt(2,count2);

int numRowsChanged=ps.executeUpdate();
//ps.setInt(2, 0);



} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
r2_count++;
}



}
}
}





10 years ago