I want to send lgnid to another jsp page where in the present page im assigning like the whole table to a string result.Now i want to access lgnid in another jsp page like string lgnid=request.getParameter("lgnid");...I'm unable to to get lgnid in another page.Its giving null.Can anybody help me?
First of all, Welcome to JavaRanch community......... .
After looking into your code I assume that you are a newbie in Server Side Programming.Surprisingly your code snippet contains the things,should not be there,making whole the phenomenon suispected and ambigous.
String result="<table border=0 >
I think the first line in itself is an annoying thing for a server side components(JSP,Servlet) developer.Take a look at "what have you done".You are assigning a HTML tag to a String variable,which is not possible at any cost,making things worse for you double-foldedly-
1.First of all whatever you are assigning to String result should be a legel java code.
2(a).Your java code should be in Java code tags(Scriptlets,Expressions,Declarations,Directives).like for your code snippet first line of your code should be in a scriptlet,like-
If you are taking a variable from request scope(previously submitted HTML page/JSP) and assigning it to a String(Assumption).
(b).Latest recommendation of JSP will not suggest you to use Scriptlets in your JSP. Putting java code in JSP is considered a bad practice now according to a standard web application architecture(MVC) JSPs are considered good only for showing view to end users,not performing any business logic(Java Beans are used for this purpose) and servlet Servlet is responsible for taking the contents of incomming http requests and process for further forwarding to appropriate view(a JSP).
Go through this link.
Link JSTL and EL are encouraged to use instead of Scriptlets in JSP,having several disdvantages-
1. you can't reuse scriptlets.
2. you can't make scriptlets abstract.
3. you can't make use of inheritance/composition.
4. if scriptlet throws an exception halfway, all you get is a blank page.
5. scriptlets are not unit-testable.
6. more time is needed to maintain mingled/cluttered/duplicated code logic
I would recommend you book "HeadFirst JSP and Servlet" to start with,Initially you can start with tutorial on Sun's site.
also UseCodeTags while posting your code.
also Indent your code.It makes others to easily understand your code and reply in a better way.
Nope.I cannot get the lgnid in the main.jsp.I have check with print statement also.Main prob is that lgnid is not coming from getReply.jsp to main.jsp.If i'm displaying lgnid in getreply.jsp with print statement i am able to display but its not coming to another page i.e main.jsp.