Sachin Negi

Greenhorn
+ Follow
since Feb 02, 2012
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
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sachin Negi

Winston Gutkowski wrote:Sachin,

Please don't post in all bold. It's equivalent to shouting!!! and is considered bad manners. I've removed yours this time and for more information, please check the EaseUp (←click) page.

Winston



Thanks Winston..i got it.. Cheerzz
11 years ago
Hello to all the ranchers, i am fairly new in java and currently working in Struts 1.3. My question is more related with java.
Following is the scenario and i am not sure regarding the best approach to be followed.

I want to make a error reporting functionality in my project where in I'm copying stacktrace and inserting it in the database's table say "errorlog" table with type of exception,date, user etc and other fields. But now what i have to do is :
I have to identify the package name, file, method and line number in which the exception occurred with the help of server logs that i have when exception occurs.
But the problem is that the log gives you the exception, file and the line number but it also contains errors that are not in my packages as in HttpServlet.service(HttpServlet.java:710) etc given below:


java.lang.NullPointerException
com.candidate.query.CandSearchAction.execute(CandSearchAction.java:34)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.proc ess(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

In above case, i got a null pointer exception in my CandSearchAction.java line number 34.
Now i want to know how to differentiate or extract only the line that points to my java/jsp file, so that i can filter them accordingly.

Can anyone please help regarding this situation or how to approach this problem.. is there any library that i can use or anything that could help me.
Waiting for a response that would help me.
11 years ago
Hello to all the ranchers, i am fairly new in java and currently working in Struts 1.3. My question is more related with java.
Following is the scenario and i am not sure regarding the best approach to be followed.

I want to make a error reporting functionality in my project where in I'm copying stacktrace and inserting it in the database's table say "errorlog" table with type of exception,date, user etc and other fields. But now what i have to do is :
I have to identify the package name, file, method and line number in which the exception occurred with the help of server logs that i have when exception occurs.
But the problem is that the log gives you the exception, file and the line number but it also contains errors that are not in my packages as in HttpServlet.service(HttpServlet.java:710) etc given below:


java.lang.NullPointerException
com.candidate.query.CandSearchAction.execute(CandSearchAction.java:34)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
org.apache.struts.action.RequestProcessor.proc ess(RequestProcessor.java:274)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

In above case, i got a null pointer exception in my CandSearchAction.java line number 34.
Now i want to know how to differentiate or extract only the line that points to my java/jsp file, so that i can filter them accordingly.

Can anyone please help regarding this situation or how to approach this problem.. is there any library that i can use or anything that could help me.
Waiting for a response that would help me.
11 years ago
i have a scenario in JSP where i have to make a combo with a list containing 10 items say 1,2,3.... 10. now i select a combo. I also need to provide an add button that will add another combo with same elements except the one being selected in previous combo.

eg- if 1st combo selected value is 1 then in the next combo i'll have the list as 2,3,4.....10 i.e, having 9 elements and so on. the user can add 10 combos like this, each combo having the items that haven't been previously selected.

can anyone help me with this???
thanks in advance !!!
Thanks for your reply mohana..can you provide me some example of this..where i have to create this session thing
i am aware about sessions in servlets where we make session attributes in web.xml but i am not sure about struts2...please help!!!
thanks and regards :-)
12 years ago
hello everyone..can anyone tell me how can i use value from one jsp to all the others!!
i have a scenario where i have made a form for registration that inputs the "Candidate Id" and inserts it in the database through action!! now i want to display this "candidate Id" in all many other Jsp pages..
how can i achieve this???
i have used :
it is displaying the Candidate Id in this jsp page only as its possible to do this on concurrent jsp pages ...how can i get this "Candidate Id" in other jsp pages as well???
Thanks in advance!!! :-)
12 years ago
hello to all the ranchers
I have done AJAX validation in Struts 2.3 successfully using the dojo pluging's <sx:submit> tag...but i have a requirement where i have to do validation in the form without refreshing the form fields without clicking the Submit button..how can i achieve this validation???
i'll be thankful if anyone can provide me with the details on how can i start this thing..
Thank you..
12 years ago
thanks for your reply mate but this will become more complex because i have to make so many such forms for my project..is this any other way!! why i cannot divide one form from the same jsp..???
thanks for your help...
12 years ago
I have made a form in struts2 and i just want its layout to have three division but its notw working...i have tried so many things with this..but i am unable to find the answer...can't i use the simple<div> tag inside <s:form> ...
what should i do..please help me..

registration.jsp :

12 years ago
Thanks for your help..i have changed this a little bit and have called the action from the the jsp in which i had made the menu aND ITS WORKING FINE FOR ME AND i have used the format like you have told me and its working...
Thanks for your help..
12 years ago
Hello to all the ranchers n greenhorns like me.. i am making a form in Struts2 that takes values from database..and i am having problem in combo-box..
here's the content of mu project that is related to the current problem ...

stuts.xml :





MaritalStatusList.java




PersonalDetailsAction.java:




DAOPersonalDetails.java:




registration.jsp





now the problem is that when its nor displaying the combobox..but when i am using the config-browser to see the action..the whole page is displayed correctly with combobox having list containing "name" from the MaritalStatusList class with values from the database!!!

i am getting the following errors on log:

Feb 16, 2012 8:10:14 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: No configuration found for the specified action: '/registration.jsp' in namespace: ''. Form action defaulting to 'action' attribute's literal value.


Here i am getting all the statements of System.out.println();

Feb 16, 2012 8:10:14 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Caught an exception while evaluating expression 'maritalstatuslistlist.{name}' against value stack
java.lang.NullPointerException

Feb 16, 2012 8:10:14 PM com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: NOTE: Previous warning message was issued due to devMode set to true.
Feb 16, 2012 8:10:14 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
tag 'combobox', field 'list', name 'maritalstatuslistlist': You must specify a collection/array/map/enumeration/iterator. Example: people or people.{name} - [unknown location]



i think there is a problem with my jsp...please help me figure it out..

Thanks in advance n Cheerzz!!!
12 years ago
so how can i correct myself??? can i do changes in JSP so that i can get submenuTitle under the menuId for which it is associated???
12 years ago
Hello Joe Ess ...
i have tried the following changes in my classes:


in DAO.java i have added a function that executes the 2nd query for submenus...





in MenuListAction class i have added :



in execute method i hv added the following :



and have added hetters n setthers for submenuTitle in MenuList class :






and menujsp as:









now i am getting the submenus...but the problem is that i am getting all the submenuTitles under every menuTitle... is there a way that i can get the value ftom the JSP n pass it the query as an action...for a particular menuId n then i can execute the query for that menuId...select * from menu where menu_id in (select menu_id from applicationmenu where application_id="for that menuId")

and then com back to second iterator n display submenuTitle for that menuId on mouseover event
or is there any other way to achieve what i am trying....
12 years ago
this is what i want my menu to show:

menuTitle;- (Regsitration) (Renewal) (EMI) when i'll do mouse over on them they will show

(Direct regist) (Renew Registration) (ER1 From)
(Re registration) (Record of Renewal) (ER2 From)

i've done this successfully in single JSP in which evrything resides in JSP,following is that code of JSP:




now i want this to do be implemented in STRUTS2....


Following are my tables :


application table

application_id title short_title

(0000000001) (Registration Module) (Registration)
(0000000002) (Renewal Module) (Renewal)
(0000000003) (EMI Module) (EMI)



menu table:

[b](menu_id) (title) (short_title) (menu_typecharacter)

(0000000001) (Direct Candidate Registration) (Direct Regist) (H)
(0000000002) (Re registration) (Re registration ) (H )
0000000003 Renew Registration Renew Registration H
0000000004 Record of renewal Record of Renewal H
0000000005 ER1 Form ER1 Form H
0000000006 ER2 Form ER2 Form H



applicationmenu table:

application_menu_id application_id menu_id

0000000001 0000000001 0000000001
0000000002 0000000001 0000000002
0000000003 0000000002 0000000003
0000000004 0000000002 0000000004
0000000005 0000000003 0000000005
0000000006 0000000003 0000000006


1ST QUERY: select * from application where application_id in (select distinct application_id from applicationmenu order by application_id)
RESULT:
this goes in my ResultSet rs

application_id title short_title

0000000001 Registration Module Registration
0000000002 Renewal Module Renewal
0000000003 EMI Module EMI


2ND QUERY: "select * from menu where menu_id in (select menu_id from applicationmenu where application_id='"+rs.getString(1)+"')")


When rs.getString(1) will be 0000000001 then it will show the following result :

menu_id title short_title menu_typecharacter
0000000001 Direct Candidate Registration Direct Regist H
0000000002 Re registration Re registration H

Hence it will generate the sub-menu for menuId=0000000001

And so on for menuId=0000000002 and 0000000003


all this will be in another ResultSet...

this is what my project is all about...plzzzz if you can suggest me what should i do....
thanks a lot!!!


12 years ago
Hello Joe Ess ....you are right that i am iterating the submenus with same list of menuTitle..i did this just to check if my second iterator(the nested one) is working or not...
after that i will do the project that is given to me in which i have to add subMenuTitle in the list in DAO.java with the help of a new query...where i will add the subMenuTitle for the its corresponding menuId....
how will i do it i am aslo not sure about that as well!!!
12 years ago