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

  • Home
  • SEARCH
  • 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 6075543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:30:23+00:00 2026-05-23T10:30:23+00:00

I added this line to change the response header in JSP <c:set target=${pageContext.response} property=Access-Control-Allow-Origin

  • 0

I added this line to change the response header in JSP <c:set target="${pageContext.response}" property="Access-Control-Allow-Origin" value="*"/>.. I am getting error like this..

    HTTP ERROR 500

Problem accessing /. Reason:

    Invalid property in &lt;set&gt;:  "Access-Control-Allow-Origin"

Caused by:

javax.servlet.jsp.JspTagException: Invalid property in &lt;set&gt;:  "Access-Control-Allow-Origin"
    at org.apache.taglibs.standard.tag.common.core.SetSupport.doEndTag(SetSupport.java:202)
    at org.apache.jsp.WEB_002dINF.pages.search_jsp._jspx_meth_c_set_2(org.apache.jsp.WEB_002dINF.pages.search_jsp:397)
    at org.apache.jsp.WEB_002dINF.pages.search_jsp._jspService(org.apache.jsp.WEB_002dINF.pages.search_jsp:112)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:109)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:389)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:486)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:380)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
    at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)
    at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)
    at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)
    at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:381)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:67)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:122)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:110)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:915)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

And this is the below jsp code where I added that line.

<!doctype html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="search" uri="/kit" %>
<%@ taglib prefix="solr" uri="/kit/solr" %>
<%@ taglib prefix="workflow" uri="/kit/workflow" %>
<%@ taglib prefix="security" uri="/kit/security" %>
<%@ taglib prefix="widget" tagdir="/WEB-INF/tags/widgets" %>
<%@ taglib prefix="visualization" tagdir="/WEB-INF/tags/visualizations" %>
<%@ taglib prefix="client" tagdir="/WEB-INF/tags/client" %>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<search:twigkit mode="PRODUCTION">
    <solr:platform host="http://stg.xyz.com:8800/lucene/master/" 
        defaultQuery="*:*" defaultFacets="docType,imType,pLine,originator,technology"/>
    <search:query var="query" parameters="*" 
        fields="*" />
    <search:response var="response" platform="${platform}" query="${query}">
        <workflow:processor name="kit.linguistics.processors" title="title" summary="text" />   
    </search:response>
</search:twigkit>

<c:set var="res" value="http://stg.xyz.com:8800/dps/"/>
<c:set var="dpsURL" value="http://stg.xyz.com:8800/dps"/>
<c:set target="${pageContext.response}" property="Access-Control-Allow-Origin" value="*"/>

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <title>Search :: ${query.value.display}</title>
    <client:head/>
    <script src="${res}dpsjsclient/dps.min.js" type="text/javascript"></script>
    <link rel="stylesheet" href="${res}dpsjsclient/dps-main.css" type="text/css" />

</head>
  • 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-23T10:30:23+00:00Added an answer on May 23, 2026 at 10:30 am

    The HttpServletResponse indeed doesn’t have a setAccess-Control-Allow-Origin() method. Even when it has one, setting/changing the headers while you’re basically inside the response body is also not always guaranteed to work (JSP is basically part of the response body!). You’ll only risk seeing IllegalStateException: response already committed in the server logs.

    You want to set the response headers far before the response is committed. The best place is using a filter. Create a class which implements Filter and do the job in the doFilter() method.

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
        HttpServletResponse response = (HttpServletResponse) res;
        response.setHeader("Access-Control-Allow-Origin", "*");
        chain.doFilter(req, res);
    }
    

    Map this filter on the desired URL-pattern.

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

Sidebar

Related Questions

I have created a reddot cms component, in which I added this line Also,
I just added this to my web.xml on my JBOSS server. But it had
EDIT I added this note to explain why I keep this question here. I
I have added this rule in my web.config to redirect non www URLs to
I use DATEDIFF function to filter records added this week only: DATEDIFF(week, DateCreated, GETDATE())
In my CMS I've added this code <div><?php include(my_contact_form.php) ?></div> which updates to a
I created a new content type for a wiki page library. I added this
I created a partial view, abc in my Views/Home added this to my controller
I have a few custom UITableViewCells - http://img11.imageshack.us/i/customfacilitiescell.png/ which are added to this UIViewController
I added the legend this way: leg = fig.legend((l0,l1,l2,l3,l4,l5,l6), ('0 Cl : r2, slope,

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.