aspose file tools*
The moose likes Servlets and the fly likes Pass Parameter Via Anchor Tag in Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Pass Parameter Via Anchor Tag in Servlets " Watch "Pass Parameter Via Anchor Tag in Servlets " New topic
Author

Pass Parameter Via Anchor Tag in Servlets

Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
I want to pass the selected data by the user via parameter, but i am not able to get the coding right.

For example,
If the user selects ID 101, then 101 should be sent via parameter to a designated page.

The servlet code written by me is as follows:



The parameter being passed by writing the above code is: EID=rs.getString(1).
I dont want that. I want the String passed by ResultSet to be passed.

Please help.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1558
This looks too complicated, because your database, your view and your control-logic all are in one place. Why not have JSP separately and send/receive data via session/request objects.


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Aniketh Narayanan
Greenhorn

Joined: Jan 05, 2013
Posts: 12
Akhilesh Trivedi wrote:This looks too complicated, because your database, your view and your control-logic all are in one place. Why not have JSP separately and send/receive data via session/request objects.


Even if a JSP is separately created, how will i write the code to display the database in a tabular column.
And how will i retrieve the CLICKED value in parameter ?

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1558
JSPs strength is in scriptlets. Or even better you can use tag-libraries, to start with servlets/jsp you may use this book.

Aniketh Narayanan wrote: Even if a JSP is separately created, how will i write the code to display the database in a tabular column.


Come up with whatever you are doing and I am sure you will get help from this forum.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1558
http://www.roseindia.net/jsp/forloopjsp.shtml
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Akhilesh Trivedi wrote:JSPs strength is in scriptlets.

No, it is not! Scriptlets have been obsolete for over 10 years. They should not be used in modern JSP.

JSTL and EL are the moderne work-horses of JSP.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1558
Bear Bibeault wrote:JSTL and EL are the moderne work-horses of JSP.


What is JSTL?
Darlan Moraes
Greenhorn

Joined: Jan 08, 2013
Posts: 7
Is a library that you could add to your project.
This library is very useful for working with JPSs.
For example, on your Servlet, you could have:



... forward to a JSP...

Then in your JSP:



http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Akhilesh Trivedi wrote:
Bear Bibeault wrote:JSTL and EL are the moderne work-horses of JSP.


What is JSTL?


JSTL
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1558
That is what i had said earlier...

Akhilesh Trivedi wrote:JSPs strength is in scriptlets. Or even better you can use tag-libraries...


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Akhilesh Trivedi wrote:That is what i had said earlier...

Akhilesh Trivedi wrote:JSPs strength is in scriptlets. Or even better you can use tag-libraries...



There is no "strength" in scriptlets. They are obsolete and should not be used.
nalla srinivas
Greenhorn

Joined: Jan 10, 2013
Posts: 9
please remove \(slash) before url. i think i will work
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

nalla srinivas wrote:please remove \(slash) before url. i think i will work

There is no \ in the URL -- that's an escape character in the Java string literal.
Hikari Shidou
Ranch Hand

Joined: Jan 22, 2013
Posts: 88
Aniketh Narayanan wrote:



rs.getString(1) is inside a string, therefore it's not processed as Java code. You must move it out of the string...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pass Parameter Via Anchor Tag in Servlets