Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7596539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:56:26+00:00 2026-05-30T21:56:26+00:00

I am trying to use a session that I have made in JSP in

  • 0

I am trying to use a session that I have made in JSP in a sql statement. But having difficulties.

I captured it already and this is the SQL statement I made, but doesnt work.

String mysql="select * from table1 where cottCode="<%= session.getAttribute( "theName" ) %>"";

Any help appreciated, thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:56:27+00:00Added an answer on May 30, 2026 at 9:56 pm

    I think here you are trying to do things like this:

    <%
        String name = session.getAttribute( "theName" );
        String mysql = "select * from table1 where cottCode=" + name;
        // then connecting MySql server using driver in JSP to execute the SQL query
    %>
    

    This kind of code is called JSP Scriptlet.

    However, expressions like :

    <%= session.getAttribute( "theName" ) %>
    

    are called JSP Expressions.They are used to “insert the value of a scripting language expression, converted into a string, into the data stream returned to the client. ” Like this:

    <html>
        <body>
            <p>hi, my name is <%= session.getAttribute( "theName" ) %>
            </p>
        </body>
    </html>
    

    So I don’t think you can use the expression in the middle of scriptlet. Here is the tutorial on related topics, hope it’ll help:
    The Java EE 5 Tutorial

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use PHP session without using cookies. I have enabled session.use_trans_sid
I know there are frameworks that exist, but I am trying to use wsgi
so i have made several attempts at this, but decided i needed some advice
I have been trying to use the new validators that are now included with
I am trying to use session data on multiple subdomains: www.example.com my.example.com test.example.com whateversub.example.com
I am trying use gem tire to search in my application. I have tables
Hi I'm trying use a datepicker on a field I have. I'm trying to
I'm trying to use session variables to limit the access to a page. I
I'm trying to use Apache::Session::Memcached in an HTML::Mason project where I'm using MasonX::Request::WithApacheSession to
This is my first time trying to use the XMLRPC::Client library to interact with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.