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 7878093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:33:44+00:00 2026-06-03T03:33:44+00:00

So I have been wandering around the web for some time looking for this

  • 0

So I have been wandering around the web for some time looking for this answer. Is there no way of having text fields in java scriptlets for a JSP? I know that in C# you can have

@Html.TextField();

And that will create a text field for you to use as C# code.

Why I would like this, is that I am grabbing a session and checking to see if the user attribute has a user name stored. If it does I don’t want it to display the username textbox. Although from what I can tell I can’t do that with java scriptlets.

<%if(session.getAttribute("user") == null) %>
Username: <input type="text" name="name"><br/>

Is there something that I am missing?

  • 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-06-03T03:33:45+00:00Added an answer on June 3, 2026 at 3:33 am

    This will work, but it’s better to use JavaServer Pages Standard Tag Library and Expression language
    instead of scriptlets. It tend to complicate maintenance for JSP-pages.

    You can set a scoped variable on the JSP page. In this manner:

    <c:set var="myVariable" scope="page" value="expression"/>
    

    Your situation can be easily solved with the help of JSTL with EL:

    <c:if test="${sessionScope.user eq null}">
       <c:out value="Username: ${myVariable}" />
    </c:if>
    

    If you have a more complex logic then it makes sense to create a custom tags.

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

Sidebar

Related Questions

So I have been looking around for some time now on a way to
I have been looking around for some way to convert a function or class
I have been tinkering around with ServiceStack to expose some web services and have
I have been looking around here and There , and I have become curious.
Have been searching around and can't find the answer to this. I'm just wondering
I have been searching around and cant find an answer... not sure if there
I've been looking around on SO and have been seeing a lot of questions
Possible Duplicate: C# Get control by name I have been looking around for an
I been having this idea spooking around in my head for 2 weeks now.
I have been looking around the Tank auth code to see how things are

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.