Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

t sathya narayana

Ranch Hand
+ Follow
since Jan 23, 2014
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 t sathya narayana

I'm implementing custom pagination in S2 with ajax submission. It's working fine. But one issue is there. The navigation is not working (enable and disable arrows) properly. Remaining everything will went fine means based on page size i can get records, sorting is working and while I clicks on arrows pagination is also working.

Only res.jsp response is coming as response every time througth ajax call while I clicks on arrows (I'm written code like that only). In index.jsp I included pagination.jsp file but in res.jsp it's not included. So the code which I written in pagination.JSP is not refreshed. previous values will appear every time. How to I change this. If you want any other code I'll paste here. Some of the code is here.

In index.jsp

<s:iterator value="#attr.users" var="user" status="rowstatus">
<s:if test="#rowstatus.even == true">
<tr class="ac_odd">
</s:if>
<s:else>
<tr>
</s:else>
<td><s:property value="id" /></td>
<td><s:property value="name" /></td>
<td><s:property value="role" /></td>
</tr>
</s:iterator>
</table>

</div>
<%@ include file="pagination.jsp" %>
<s:hidden name="pagenumber" id="pagenumber" value="%{#request.pagination.page_number}"/>
<s:form method="post" action="downloadXLSFileAction">
<s:hidden name="query" value="%{#request.pagination.query}"/>
<s:submit value="Download" />
</s:form>

In struts.xml

<action name="user-list" method="userPagination" class="com.pagination.UserAction">
<interceptor-ref name="defaultStack"/>
<result name="success">index.jsp</result>
</action>
<action name="ulist" method="iPagination" class="com.pagination.UserAction">
<result>res.jsp</result>
</action>

In pagination.jsp (to enable and diable arrows)

<td>
<s:if test="%{#request.pagination.page_number>1}">
<a href="#" onclick="fnPagination(4,<s:property value='#request.pagination.total_pages'/>);">
<img src="imgs/left_end.gif" alt="Go to first page" width="15" height="19"/>
</a>
</s:if>
<s:else>
<img src="imgs/left_end_gray.gif" alt="Go to first page" width="15" height="19"/>
</s:else>
</td>
...................................
<td>
<input name="pagination.page_number" id="page_number" class="pagination-textbox" <s:if test="%{(#request.pagination.page_number<1)&&(#request.pagination.total_pages==#request.pagination.page_number)}"> readonly="readonly" </s:if>
style="width: 20px;" maxlen="1" value="<s:property value='#request.pagination.page_number'/>" type="text" onclick="fnPagination(7,<s:property value='#request.pagination.total_pages'/>);"/></td>
............................
<td class="pagination-linkoff" style="" nowrap="nowrap">
<s:select onchange="fnPagination(5,0);" list="#{'5':'5','10':'10','50':'50','100':'100','0':'All'}" theme="simple" name="pagination.page_size" id="page_size" value="#request.pagination.page_size"/>
</td>

In js file

function fnPagination(type,param){//alert("aa");
var oPage_number = document.getElementById("page_number");
var page_number = parseInt(oPage_number.value);
switch (type)
{
case 1://Next
oPage_number.value = (page_number+1);
break;
..........
document.getElementById("result").innerHTML = "";

if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("result").innerHTML = xmlhttp.responseText;
}
}

if(type==6)
xmlhttp.open("GET","ulist.action?pagesize="+document.getElementById("page_size").value+"&pagenumber="+document.getElementById("page_number").value+"&sortColumn="+document.getElementById("sortColumn").value+"&sortOrder="+document.getElementById("sortOrder").value,true);
else
xmlhttp.open("GET","ulist.action?pagesize="+document.getElementById("page_size").value+"&pagenumber="+document.getElementById("page_number").value+"&sortColumn="+document.getElementById("sortColumn").value+"&sortOrder="+document.getElementById("sortOrder").value,true);
xmlhttp.send();

In res.jsp

<s:iterator value="#attr.users" var="user" status="rowstatus">
<s:if test="#rowstatus.even == true">
<tr class="ac_odd">
</s:if>
<s:else>
<tr>
</s:else>
<td><s:property value="id" /></td>
<td><s:property value="name" /></td>
<td><s:property value="role" /></td>
</tr>
</s:iterator>
<s:hidden name="pagenumber" id="pagenumber" value="%{#request.pagination.page_number}"/>
<s:form method="post" action="downloadXLSFileAction">
<s:hidden name="query" value="%{#request.pagination.query}"/>
<s:submit value="Download" />
</s:form>
6 years ago
Hi,

If a user selects a option then on change event will be invoked. Upon that event dynamically here I'm creating divs and will be added to main div (#radiobuttons id). If a user selects another option previous divs should be removed and new divs should be added to main div (#radiobuttons).

in html,


in js,




but here the problem is remove function is removing all the divs including newly added divs also.
while i creating image gallery dynamically it's n't working. here i'm adding all the images from a directory to a table dynamically. its not completed now.

Here, i want to create image gallery dynamically and i'm new to jquery. see the partial code below.

The issue is image gallery is not working. while i clicking on a image it is going to displayed in another page.

in html,



in js,



working code demo demo.dsheiko.com/blogslideshow

Joe Ess wrote:

t sathya narayana wrote: I installed apache and servlets in WHM cpanel. Tomcat server is also running



Do you have Apache configured to pass servlet and JSP requests to Tomcat? Apache will not process JSP's on its own.



I have installed apache in EasyApache and Servlets in WHM cpanel. I didn't know anything next what to do. I deployed war file cpanel. Is there any other configuration settings to run jsps in cpanel. Can you guide me.
7 years ago

Joe Ess wrote:cpanel is a web server management tool. Since it is commonly used to manage LAMP deployments, I suspect you are attempting to deploy a JEE application on a server that does not support JEE. You will have to give us some more information.



we can deploy stuts app with help of WHM cpanel. I installed apache and servlets in WHM cpanel. Tomcat server is also running. Then after I deployed my app in cpanel. but it is going to show display only jsp code. see this link.

http://tat.ieee-projects10.com/
7 years ago
My problem is that jsp files are not running in cpanel. I have installed apache and servlets in whm cpanel. Even though the jsp files are not running. they are showing complete in that page or it displays only the html code.

http://tat.ieee-projects10.com/
7 years ago
Dynavalidatorform is not working. even i am not getting any error also. when ever i click on register button it does not displays any validation error messages.

my code in h.jsp page

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="html" uri="WEB-INF/struts-html.tld" %>
<br>
<div style="color:red">
<html:errors/>
</div><br>
<html:form action="/register" focus="fname">

<html:text property="fname" value="" /><br>

<html:text property="lname" value=""/><br>
<html:text property="uname" value=""/><br>
<html:password property="password" value="" /><br>
<html:text property="email" value=""/><br>
<html:text property="mobile" value=""/><br>
<html:text property="qualification" value="" /><br>
<html:text property="doj" value=""/><br>
<html:textarea property="address" value="" /><br>
<html:submit value="Register" />
<html:reset value="Cancel" />
</html:form>
form bean configuration in struts configuration file

<form-bean name="registerform" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="fname" type="java.lang.String" />
<form-property name="lname" type="java.lang.String" />
<form-property name="uname" type="java.lang.String" />
<form-property name="password" type="java.lang.String" />
<form-property name="email" type="java.lang.String" />
<form-property name="mobile" type="java.lang.String" />
<form-property name="qualification" type="java.lang.String" />
<form-property name="doj" type="java.lang.String" />
<form-property name="address" type="java.lang.String" />
</form-bean>
action class configuration in struts configuration file

<action input="/h.jsp" name="registerform" path="/register" type="com.mycompany.myapp.struts.RegisterAction" validate="true">
<forward name="success" path="/h.jsp"/>
<forward name="failure" path="/index.jsp"/>
</action>
in validation.xml file

<form name="registerform">
<field
property="fname"
depends="required">
<arg0 key="error.registerform.fname"/>
</field>
...........
</form>
in this code the action class extends Action class
7 years ago
but in gmail its not like that, means no need to close a browser after user has sign out. when i'm clicking back button after sign out its going to index page no need of closing a browser. i want like this. how to do this.
7 years ago
ln gmail after has sign out the control goes to home page. if the user trying to come back means by clicking the back button it displays index page. same thing now im trying but im unable to prevent that. then only we can give security to end users. whenever i clicking on back button it is going to users page. otherwise other persons can see the user details after going back.
7 years ago
whenever user clicks on back button it is going back to previous page means users home page. i need to prevent that one. whenever user clicks on back button it should not display the users home page. I need to do this.
7 years ago
I'm new to struts. I unable to prevent back button in struts 1.x. Here is my code.

in struts-config.xml my code

<!-- logout link-->
<action path="/logout" type="com.myapp.struts.Logout_Action">
<forward name="success" path="/index.jsp"/>
<forward name="failure" path="/index.jsp"/>
whenever user click on sign out, control goes to index page. ok. but whenever user clicks on back button it is going back to previous page. here is my session code.

// check session attribute
HttpSession mySession = request.getSession();
if (mySession.getAttribute("user_id") == null || mySession.getAttribute("user_id").equals(""))
{
//response.sendRedirect("index.jsp");
return mapping.findForward(FAILURE);
}

else
{

response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0);
mySession.removeAttribute("user_id");
mySession.invalidate();

return mapping.findForward(SUCCESS);
}
whenever user refreshes the page after going back then only it is going to index page. in the above code the action class is extends Action.
7 years ago
Empty JSP is landing. My code at client side is

Webcam.snap( function(data_uri) {
dat=data_uri;//.replace("data:image/jpeg;base64,","");
document.location.href = 'display.jsp?img='+encodeURIComponent(dat);
.....
}

At server side means in display.jsp the code is like

<%
String st=request.getParameter("img");
out.println("value="+st);
System.out.println("value="+st);
java.awt.image.BufferedImage image = null;
byte[] imageByte;
sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder();
imageByte = decoder.decodeBuffer(st);
java.io.ByteArrayInputStream bis = new java.io.ByteArrayInputStream(imageByte);
image = javax.imageio.ImageIO.read(bis);
bis.close();
if(image!= null)
javax.imageio.ImageIO.write(image, "jpg", new java.io.File("d://1.jpg"));

%>
In display.jsp I need to save captured image. The URI look like

var uri ="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQo...";

and also I'm getting exception in server

Sep 24, 2014 12:45:39 AM org.apache.coyote.http11.AbstractHttp11Processor proces
s
INFO: Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG
level.
7 years ago
JSP
how to detect code theft of java script programs in java. is there any open source s/w. my requirement is http://ieee-projects10.com/heap-graph-based-software-theft-detection/
8 years ago
how to detect code theft of java script programs in java. is there any open source s/w. my requirement is http://ieee-projects10.com/heap-graph-based-software-theft-detection/
8 years ago

Ulf Dittmer wrote:That's quite a task! So what do you have so far, and where are you stuck making progress?


first of all i dn't know how to start and which concept here i need to use.
8 years ago