aspose file tools*
The moose likes JSP and the fly likes what wrong with my code ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "what wrong with my code ?" Watch "what wrong with my code ?" New topic
Author

what wrong with my code ?

somu sundar
Greenhorn

Joined: Sep 11, 2012
Posts: 8
Hi all....
<script type="text/javascript">
var queryString = "?";

function appendToUrl(link,number){
queryString +="&type=page&status="+userlist.status.value+"&numberview="+userlist.numberview.value+"&link="+number;
alert(queryString);
location.href=link+queryString;
}
</script>
<form>
<a href='javascript:appendToUrl("http://host:8080/JspServlet/NewAdmin.do",1)'>clickme</a>
</form>

i have tried to call my script while click the alink... but when i tried in eclipse default browser working properly ... but not in other browser like ie,mozila....
can any one help me to solve this problem......
thanks in advance....
Ashwini Kashyap
Ranch Hand

Joined: Aug 30, 2012
Posts: 90
Hi Somu,

The problem is occuring due to formation of wrong query string.
Its getting appended like :
?&type=page&status="+userlist.status.value+"&numberview="+userlist.numberview.value+"&link="+number;
which is incorrect.

It should be like: ?type=page&status="+userlist.status.value+"&numberview="+userlist.numberview.value+"&link="+number;

Hope this helps.

Thanks and Regards,
Ashwini Kashyap | akashyap@infocepts.com | www.infocepts.com
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you are requesting to host at port 8080. is that *localhost*?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Welcome to JavaRanch somu sundar
somu sundar
Greenhorn

Joined: Sep 11, 2012
Posts: 8
thanks.... now its working ... :)
somu sundar
Greenhorn

Joined: Sep 11, 2012
Posts: 8
Seetharaman Venkatasamy wrote:Welcome to JavaRanch somu sundar
thank u...
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you are welcome
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: what wrong with my code ?