sanju sreedharan

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

Recent posts by sanju sreedharan

hello david

I had thought SQL injection is a pretty well-known issue, but it's off-topic for this forum. ???

david i didnt understand what you mean by this..can you please tell me clearly

thanks
sanju
16 years ago
hello david

thank you for the reply..can you please tell me a best way to store in a database..whether there is any drawbacks in the way i did

thanks
sanaj
16 years ago
my jsp page
---------------
<logic:equal name="User" property="notify_dept_interview_time" value="1" >

<logic:iterate id="selectionProcess" name="selectionProcess">


<%if (selF.getPlace_interview()==null){%>
<tr>
<th align=left class="type1opp"><bean:message key="sel.place_interview" /></th>
<td width="22%" class="type1"><html:textarea name="selectionProcess" property="place_interview" indexed="true" onkeypress="textareaChars(this, 250)" cols="40" styleClass="textarea"/></td>
<th align=left class="type1opp"><bean:message key="sel.date_interview" /></th>
<td width="22%" class="type1"><html:text property="date_interview" name="selectionProcess"readonly="true" indexed="true" styleClass="input_medium"></html:text><img src="../images/cal.gif" onclick="return showCalendar('selectionProcess[<%=cntLoop++%>].date_interview','%d/%m/%Y %H:%M', '12', true);" style="cursor:hand;" width="16" height="16"/></td>
<th align=left class="type1opp"><bean:message key="sel.userid" /></th>
<td width="22%" class="type1"> <bean:write name="selectionProcess" property="interview_schedule_userid" /></td>
</tr>
<tr>
<td colspan=3 align=middle class="type1"><a href="javascript:void()" onclick="javascript:return resumesearch(<bean:write name="selectionProcess" property="selection_prid" />)"> Candidates for Interview</a></td>
</tr>
<tr>

<%}else{%>
<th align=left class="type1opp"><bean:message key="sel.place_interview" /></th>
<td width="22%" class="type1"><bean:write name="selectionProcess" property="place_interview"/></td>
<th align=left class="type1opp"><bean:message key="sel.date_interview" /></th>
<td width="22%" class="type1"><bean:write name="selectionProcess" property="date_interview"/></td>
<th align=left class="type1opp"><bean:message key="sel.userid" /></th>
<td width="22%" class="type1"> <bean:write name="selectionProcess" property="interview_schedule_userid" /></td>
</tr>
<tr>
<td colspan=3 align=middle class="type1"><a href="javascript:void()" onclick="javascript:return resumesearch()"> Candidates for Interview</a></td>
</tr>

<%}%>
</logic:iterate>
</logic:equal>

<jsp:include page="bottom5.jsp" flush="true" />
<jsp:include page="bottom3.jsp" flush="true" />

my action class
______________




// used to add dynamically

if(submit!=null&&submit.equalsIgnoreCase("Add"))
{
Dml dml=new Dml();
selectionProcess=new ArrayList();
for(int i=0;;i++)
{
String place_interview="selectionProcess["+i+"].place_interview";
String date_interview="selectionProcess["+i+"].date_interview";

if(request.getParameter(place_interview)==null)break;

SelectionDetails details=new SelectionDetails();
details.setVacancy_refno(selForm.getVacancy_refno());
details.setRecycle_no(selForm.getRecycle_no());
details.setPlace_interview(request.getParameter(place_interview));
details.setDate_interview(request.getParameter(date_interview));
selectionProcess.add(details);
}

SelectionDetails sd=new SelectionDetails();
sd.setPlace_interview("");
sd.setDate_interview("");
selectionProcess.add(sd);
dml.populateSelectionForm(selForm,selForm.getVacancy_refno(),selForm.getRecycle_no());

divs=dmlu.getDivision(selForm.getDivision());
depts=dmlu.getDepartment(selForm.getDept(),selForm.getDivision());
sections=dmlu.getSection(selForm.getDept(), selForm.getDivision(), selForm.getSection());
langs=dmlu.getLanguage_only_one(selForm.getLanguage());
grades=dmlu.getGrade_onlyone(selForm.getGrade());
ageranges=dmlu.getAgerange(selForm.getAge_range());
nationality=dmlu.getNationality(Integer.parseInt(selForm.getNation()));
}

// for saving

public SelectionForm approve(SelectionForm selForm,HttpServletRequest request,User user)
{
try
{
Dml dml=new Dml();
if(selForm.getInterview_schedule_userid()==null||selForm.getInterview_schedule_userid().equals(""))
{
selectionProcess=new ArrayList();
for(int i=0;;i++)
{
String place_interview="selectionProcess["+i+"].place_interview";
String date_interview="selectionProcess["+i+"].date_interview";

if(request.getParameter(place_interview)==null)break;

SelectionDetails details=new SelectionDetails();
details.setVacancy_refno(selForm.getVacancy_refno());
System.out.println("VACANCY_REFNO=================="+selForm.getVacancy_refno());
details.setRecycle_no(selForm.getRecycle_no());
System.out.println("RECYCLE_nO=================="+selForm.getRecycle_no());
details.setPlace_interview(request.getParameter(place_interview));
System.out.println("PLACE_INTERVIEW=================="+selForm.getPlace_interview());
details.setDate_interview(request.getParameter(date_interview));
System.out.println("DATE_INTERVIEW=================="+selForm.getDate_interview());
details.setInterview_schedule_userid(user.getUserid());
selectionProcess.add(details);
selForm=dml.selectionList(details.getVacancy_refno(),details.getRecycle_no(),details.getPlace_interview(),details.getDate_interview(),details.getInterview_schedule_userid(),details.getSelection_prid(),selForm);
}
}
______________________________________________________________________________



function to store in the database

__________________________________________________________________________________________

public SelectionForm selectionList(String vacancy_refno,String recycle_no,String place_interview,
String date_interview, String interview_schedule_userid,String selection_prid,SelectionForm selForm)
{
Connection dbConnection = null;
PreparedStatement psmt1 = null;
ResultSet rs1=null;
try
{
OracleServerAccess dbAccess = new OracleServerAccess();
dbConnection = dbAccess.openConnection();
String sq1="insert into ts_selection_details(VACANCY_REFNO,RECYCLE_NO,PLACE_INTERVIEW,DATE_INTERVIEW,SELECTION_PRID,DATE_INTERVIEW_INPUT_DATE,"+
"INTERVIEW_SCHEDULE_USERID) values ('"+vacancy_refno+"','"+recycle_no+"'," +
"'"+place_interview+"'," +
"to_date('"+date_interview+"','dd/mm/yyyy HH24:MI:SS')," +
"SEQ_RECID.NEXTVAL,to_date(sysdate,'dd/mm/yyyy HH24:MI:SS'),"+
"'"+interview_schedule_userid+"')";
logger.info(sq1);
psmt1 =dbConnection.prepareStatement(sq1);
rs1=psmt1.executeQuery();
if(rs1.next())
sq1="select " +
" DATE_INTERVIEW_INPUT_DATE,PLACE_INTERVIEW,DATE_INTERVIEW,interview_schedule_userid from ts_selection_details where " +
" vacancy_refno='"+selForm.getVacancy_refno()+"' and recycle_no='"+selForm.getRecycle_no()+"'";
logger.info(sq1);
psmt1=dbConnection.prepareCall(sq1);
psmt1.executeUpdate();
}
catch(Exception e)
{
logger.info(e.getMessage());
e.printStackTrace();
}
finally
{
try
{
if(rs1!=null)rs1.close();
if(psmt1!=null)psmt1.close();
if(dbConnection!=null)dbConnection.close();
}
catch(Exception e){}
}
return selForm;
}


16 years ago
hello david can you forward me your email id i will send the coding through mail

sanaj
16 years ago
hello everyone

i am having one proble can anyone help me???

i have two button ADD and Submit.

when i press add the three afield will open...one is place_interview,date_interview and interview_schedule_userid

when i press save the data i am entering should save and it should not be able to be editable again......can anyone tell me how to do that.i will send the jsp file

when i press add this should be displayed

<%int cntLoop=0; %>
<table border=0 class="type1" >
<logic:equal name="User" property="notify_dept_interview_time" value="1" >
<logic:iterate id="selectionProcess" name="selectionProcess">
<%if (selF.getPlace_interview()!=null){%>
<tr>
<th class="type1opp"><bean:message key="sel.place_interview" /></th>
<td class="type1"><html:textarea name="selectionProcess" property="place_interview" indexed="true" onkeypress="textareaChars(this, 250)" cols="40" styleClass="textarea"/></td>
<th class="type1opp"><bean:message key="sel.date_interview" /></th>
<td class="type1"><html:text property="date_interview" name="selectionProcess"readonly="true" indexed="true" styleClass="input_medium"></html:text></td>
<th class="type1opp"><bean:message key="sel.userid" /></th>
<td class="type1"> <bean:write name="selectionProcess" property="interview_schedule_userid" /></td>
</tr>
<tr>
<td class="type1">)"> Candidates for Interview</td>
</tr>
<tr>

And when i press save this should be displayed

<%}else{%>
<th class="type1opp"><bean:message key="sel.place_interview" /></th>
<td class="type1"><bean:write name="selectionProcess" property="place_interview"/></td>
<th class="type1opp"><bean:message key="sel.date_interview" /></th>
<td class="type1"><bean:write name="selectionProcess" property="date_interview"/></td>
<th class="type1opp"><bean:message key="sel.userid" /></th>
<td class="type1"> <bean:write name="selectionProcess" property="interview_schedule_userid" /></td>
</tr>
<tr>
<td class="type1"> Candidates for Interview</td>
</tr>
<%}%>
</logic:iterate>
</logic:equal>

i will also post my action class if needed...can anyone help me out

thanks
sanju
16 years ago
thanks for the reply can you tell me with coding

sanju
16 years ago
Can anyone tell me how to do validation of date.suppose if i give yesterday day or any previous date.it should give me error message.how to do in struts?

thanks in advance

sanju
16 years ago
actually i have a field called enter the place and after filling that field for example
Enter the place:blablabla
and after that when i press save.it should get save and should not be able to edit that field again.
in my case it getting saved but it can be editable again.how can i make it no editable again.

th align=left class="type1opp"><bean:message key="sel.place_interview" /></th>

<td width="22%" class="type1"><html:textarea name="selectionProcess" property="place_interview" indexed="true" styleClass="textarea"/></td>

thanks
sanju
16 years ago
it is something like this

function resumesearch(){

javascript:window.open('ResumeSimpleSearch.do?vacancy_refno=<bean:write name="mainactionform" property="vacancy_refno"/>&&recycle_no=<bean:write name="mainactionform" property="recycle_no"/>&&selection_prid_no=<bean:write name="mainactionform" property="selection_prid"/>','index','directories=no,menubar=no,statusbar=yes,width=1000,height=500');return false;
return true;
}
thanks david

Atlast i solved it last week..this site is very useful.the author of the site is really appreciated

sanju
16 years ago
hello everyone

actually i am dynamically adding my html page where there is three input field and one link.after filling all the three input field and going to the link and filling that and after all is finished i press add and all the three field and link will dynamically add so that i can add the next request.

my problem is i am able to do it in all the three input field.but getting issue in a href link.the value i entered first is keep on repeating whenever i press add.instead i want an empty one.can anyone help me
this is the link
<td> a href="javascript:void()" onKlick="javascript:return resumesearch()"> Candidates for Interview</a></td>

thanks sanju
please show me your coding..

sanju
16 years ago
hai david

thank you for your suggestion.now my beanutils.populate error is ok.now i am facing another problem.when i pass the data it is not storing in my database instead its giving it as null.when i remove the indexed="true" its fine.can you tell me what will be the issue

sanju
16 years ago
can you tell me with the help of code how to do it?because i am not getting idea how to do it???

thanks sanju
16 years ago
david i will tell my whole coding so that you can check it and please tell me where i am wrong

i want to add dynamically the three attributes they are
1)date_interview,
2)place_interview
3)interview_schedule_userid

i have created a bean class named SelectionDetails.java
-------------------------------------------------------
package com.dewa.hr.edge.requisition;

import java.util.ArrayList;
import java.io. Serializable;

public class SelectionDetails implements Serializable {

private String place_interview="";
private String date_interview="";
private String interview_schedule_userid="";
public void reset(){

place_interview="";
date_interview="";
interview_schedule_userid="";
}
public String getPlace_interview()
{
return place_interview;
}
public void setPlace_interview(String place_interview)
{
this.place_interview = place_interview;
}

public String getDate_interview()
{
return date_interview;
}

public void setDate_interview(String date_interview)
{
this.date_interview = date_interview;
}

public String getInterview_schedule_userid()
{
return interview_schedule_userid;
}
public void setInterview_schedule_userid(String interview_schedule_userid) {
this.interview_schedule_userid = interview_schedule_userid;
}}
___________________________________________________________________________

this is my form class named SelectionForm.java(i created an array list to store the attribute)
--------------------------------------------------------------------------
private ArrayList selectionProcess=new ArrayList();

public ArrayList getSelectionProcess() {
return selectionProcess;
}

public void setSelectionProcess(ArrayList selectionProcess) {
this.selectionProcess = selectionProcess;
}
____________________________________________________________________________

This is my Action class i just edited and sending..in case if anyone want to see my whole action class please tell me
--------------------------------------------------------------------------

package com.dewa.hr.edge.requisition;
public class SelectionAction extends Action {
ArrayList selectionProcess=new ArrayList();
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
String target = F_SUCCESS;

if ( form != null )
{
try{
SelectionForm selForm = (SelectionForm)form;
String id=request.getParameter("id");
String submit=request.getParameter("submit_button");
--------------------------------------------------
selectionProcess=selForm.getSelectionProcess();
SelectionDetails sd=new SelectionDetails();
sd.setPlace_interview("");
sd.setDate_interview("");
sd.setInterview_comments_userid("");
selectionProcess.add(sd);
-------------------------------------------------
if((submit!=null&&submit.equalsIgnoreCase("Approve"){langs=new ArrayList();
grades=new ArrayList();
ageranges=new ArrayList();
nationality=new ArrayList();
selForm=this.approve(selForm,request,user);
}else

if(alert!=null&&alert.equalsIgnoreCase("yes")){
langs=new ArrayList();
grades=new ArrayList();
ageranges=new ArrayList();
nationality=new ArrayList();
target="alert";
}else
{
langs=new ArrayList();
grades=new ArrayList();
ageranges=new ArrayList();
nationality=new ArrayList();
langs=dmlu.getAllLanguages();
grades=dmlu.getAllGrades();
ageranges=dmlu.getAllAgerange();
nationality=dmlu.getAllNationality();
}
request.setAttribute("selectionProcess",selectionProcess);
}catch(Exception e){
e.printStackTrace();
}
}
return mapping.findForward(target);
}
____________________________________________________________________________

This is my jsp page.
---------------------------------------------------------------------------

<table width="100%" border=0 class="type1" cellspacing="2" cellpadding="5">
<td width="22%" class="type1"/><a href="javascript:" onklick="addElement()" id="theValue">create</a>

<div id="myDiv">

<table width="100%" border=0 class="type1" cellspacing="2" cellpadding="5">
<logic:iterate id="selectionProcess" name="selectionProcess" indexId="elementIndex">

<logic:equal name="User" property="notify_dept_interview_time" value="1" >

<tr>
<td width="15%" align=right class="type1">Place_interview</td>
<td width="22%" class="type1"> <html:textarea indexed="true" property="place_interview" name="selectionProcess"

<td width="15%" align=right class="type1"> Date/Time : </td>
<td width="22%" class="type1"><html:text indexed="true" property="date_interview" name="selectionProcess" styleClass="input_medium"/>

<td width="15%" align=right class="type1">Userid </td>
<td width="22%" class="type1"> <html:text indexed="true" property="interview_schedule_userid" name="selectionProcess" readonly="true" styleClass="input_medium"/></td>
</tr>
</logic:equal>
</logic:iterate>
</table>
</div>
____________________________________________________________________________
someone please tell me i am really stuck over here.

thanks in advance
sanju
16 years ago