S Ali

Ranch Hand
+ Follow
since Aug 23, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by S Ali

Thanks all. Mr John you got me wrong I've been searching for a job in Java and studying for the past two years, the PHP job I just got recently when I found that it's no use waiting and wasting time when I love coding as you said. Why I want to switch to Java is because I feel it's a very strong and powerful language and still has a bright future to come, plus companies who use Java are much larger in size and give higher salaries and all.
14 years ago
Hi all,

my question is as simple as the title of the post, I've been trying for almost 2 years to get a job in java and did not succeed. If I got a job as a PHP developer and got experience for some time will my chances increase as an entry level Java developer ?
14 years ago
Hi all,
I'm working on a two player game, now I need to know when one user closes his browser or his browser crashes down, the database should be modified to indicate game being over so that the other user doesn't wait for him forever.
How do I do that using JavaScript and sending data to database before a browser can close.
Also I learned that JavaScript function for closing the browser isn't guaranteed for all types of browsers so is there an easier way?
Thanks in advance.

Bear Bibeault wrote:Please take the time to choose an appropriate forum for your posts. This forum is for questions on JSP. For more information, please click this link ⇒ CarefullyChooseOneForum.

This post has been moved to a more appropriate forum.



Okay sorry, I thought it was related because I'm using JSP and Ajax.
Hi all,
I've been thinking I want to try a web based Tic Tac Toe game with a small chat on the side.
Now I need some ideas for the concept of both.
For the Tic Tac Toe it'll be two player game and using Ajax for the user interface so that when a user clicks it sends a request to a Servlet to put a X or O picture on the web page based on the ID of the player and his permission to play (his turn). My idea of the board in the code so far is a two dimension array of classes representing X or Os.
My question is how is this 2D array going to be shared between 2 clients, so where shall I save this data I don't want to use a database or a file, and how when a user places X for example the other user's page is refreshed to show it ?? Also for the chat I'll be using Ajax but I have no idea where data will be saved also. Suggestions please I need to know best practices.
I was trying to make it work with JSP and Servlets so I added a lot of stuff but I removed them again.
Please what is wrong
I don't know it was working yesterday and today I tried to make some changes now it doesn't and I can't find the error
this is my stack trace

Exception in thread "main" java.lang.ExceptionInInitializerError
at DAO.HibernateUtil.<clinit>(HibernateUtil.java:21)
at DAO.CountryDAO.getData(CountryDAO.java:16)
at mainn.main(mainn.java:15)
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:110)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:135)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:323)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:456)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:131)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:267)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at DAO.HibernateUtil.<clinit>(HibernateUtil.java:17)
... 2 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:107)
... 12 more
Caused by: java.lang.NoClassDefFoundError: javassist/util/proxy/MethodFilter
at org.hibernate.bytecode.javassist.BytecodeProviderImpl.getProxyFactoryFactory(BytecodeProviderImpl.java:49)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactoryInternal(PojoEntityTuplizer.java:208)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildProxyFactory(PojoEntityTuplizer.java:186)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:151)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:78)
... 17 more












Oh my god sorry guys but that solution is the worst ever
I have a big form to fill with lots of fields of course every time the page gets refreshed all data is lost.
Could anybody kindly guide me through the JavaScript or Ajax solution ?
14 years ago
JSP


<form method = "POST" action = "Regester.do">

<select name="mydropdown1" onChange="location.href='Regester.jsp?option='+this.value">
<%@ page import= "java.util.*" %>
<%@ page import= "country.*" %>
<%
Countries countryBean = new Countries();
for (String s: countryBean.getCountries())
{
if(request.getParameter("option") != null && request.getParameter("option").equals(s))
out.println("<option value="+s+" selected=\"selected\">"+s+"</option>");
else
out.println("<option value="+s+">"+s+"</option>");
}
%>
</select>

<select name="mydropdown2">
<%
City cityBean = new City(request.getParameter("option"));
for(String s : cityBean.getCities())
out.println("<option value="+s+">"+s+"</option>");
%>
</select>
<input type ="SUBMIT">

</form>



Thanks David, it worked.
I'll start reading about JSTL to make my code more professional.
14 years ago
JSP
Here is what I came up with

1- Jsp form:




2- City Bean:



3- Country Bean:




Now when a user makes a selection from the first drop down menu, it goes to the same JSP url with a parameter holding the selection and generates second drop down menu.

Big problem is second time the page is called the first drop down menu is back to the first selection
how do I get it to hold a user's selection?

As for the Javascript or Ajax soulotions I would love to learn something new but I keep googling and I can't understand because I'm a beginner at both topics.
I would love to get the job done professionally but I need someone to guide me through.
14 years ago
JSP

Chetan Dorle wrote:Try Ajax you just need to search Ajax code which calls the Database from your jsp and without refresh,

or use simple onchange() and refresh the page with new data in another dropdown.



How about getting the parameter of the first drop down list without having the user to click submit
14 years ago
JSP

mahesh shinde wrote:why not Ajax.
if pure java then handle it using javascript



I'm a beginner and I don't know either of them
if you have an easy way to implement it using Ajax or JavaScript please tell me.
14 years ago
JSP
Hi all,

I want to make a JSP form that has two drop down menus one for countries and another for cities.
Both menus are generated dynamically from the database,
and the city drop down menu should be populated once the user chooses a country from the other menu
as the content will be generated from the database based on his choice.
Is there any way that I can make this task using pure Java and not using other things like Ajax or Java Script
and of course without refreshing the page?

This is my code so far that generates the first drop down menu for Countries.


1- JSP form :







2- Countries bean:




Please help



14 years ago
JSP
Okay my mistake
but you should have found that I meant preparation if you read the post.
I'm seeking help and I don't understand what you would gain by mocking me ???