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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:30:41+00:00 2026-06-11T23:30:41+00:00

I have a static import of my Utility class: <%@ page import=static com.groupgti.webclient.util.MappingUtils.* %>

  • 0

I have a static import of my Utility class:

<%@ page import="static com.groupgti.webclient.util.MappingUtils.*" %>

I have some constants in this class:

public static final String HTM = ".htm";

public static final String SECURE_REQUEST_MAPPING = "/secure/";

public static final String CANDIDATE_DETAILS_DATA_FORM_MAPPING = "assessments/candidate-details-data";

I have a Spring MVC form:

<form:form cssClass="springForm"
        action="${pageContext.servletContext.contextPath}<%=SECURE_REQUEST_MAPPING + CANDIDATE_DETAILS_DATA_FORM_MAPPING + HTM%>"
        commandName="assessments/candidate-details-request">
</form:form>

Why when I am using like this:

<a href="${pageContext.servletContext.contextPath}<%=SECURE_REQUEST_MAPPING + CANDIDATE_DETAILS_DATA_FORM_MAPPING + HTM%>">
   some text
</a>

Value of href attribute is generated correctly, and in spring form action attribute the HTML code is like this: /webclient<%=SECURE_REQUEST_MAPPING + CANDIDATE_DETAILS_DATA_FORM_MAPPING + HTM%>. The values of those constants are not shown. Why is that and what should I do to make it work?

  • 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-11T23:30:42+00:00Added an answer on June 11, 2026 at 11:30 pm

    JSP allows you to use scriptlet expressions (<%= ... %>) in attributes of custom tags (such as <form:form>), but it must be the only content of the attribute. Therefore you cannot mix <%= ... %> expression with EL expressions or plain text in attributes of custom tags.

    However, you can use any content in attributes of regular HTML tags, because these tags have no special meaning for JSP, that’s why it works with <a>.

    One possible solution is to put a result of scriptlet expression into request attribute and use it in EL expression:

    <c:set var = "url" 
        value = "<%=SECURE_REQUEST_MAPPING + CANDIDATE_DETAILS_DATA_FORM_MAPPING + HTM%>" />
    <form:form action="${pageContext.servletContext.contextPath}${url}" ...>
        ...
    </form:form>
    

    Alternatively, you may choose to use scriptlets without EL, for example, by defining a method that appends context path in your MappingUtils:

    ... <%= url(...) %> ...
    

    Note that for historical reasons (EL expressions were designed to replace scriptlets) JSP doesn’t provide elegant ways to mix EL and scriptlets, therefore this kind of problems is pretty much expected.

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

Sidebar

Related Questions

I have a program like this - import weka.core.stemmers.SnowballStemmer; public class TestProject{ public static
In my application I have written my own Logging utility using Java.Util.Logging import java.io.IOException;
I have this static declaration of m_pData=1099656 in a class . In main NSLog(@Testing:%d,m_pData);
Possible Duplicate: Retain precision with Doubles in java import static java.lang.System.out; public class q2{
if you have a class with a static import to java.lang.Integer and my class
I have static combo box in html with some default value already selected and
Is it possible or makes sense to have static dynamic variables on a class,
I intended to create a class which only have static members and static functions.
I have a static class that I use as my Data Utils for my
I have a utility method (= a static one) that I call a lot,

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.