http-request-parameters

@ManagedProperty with request parameter not set in a @Named bean

て烟熏妆下的殇ゞ 提交于 2019-11-30 05:15:00
问题 I've a CDI managed bean wherein I'd like to set request parameters as managed properties: import javax.inject.Named; import javax.enterprise.context.RequestScoped; @Named @RequestScoped public class ActivationBean implements Serializable { @ManagedProperty(value="#{param.key}") private String key; @ManagedProperty(value="#{param.id}") private Long id; // Getters+setters The URL is domain/activate.jsf?key=98664defdb2a4f46a527043c451c3fcd&id=5 , however the properties are never set and remain

How to read complex JSON object from jQuery in Servlet request.getParameter

ぐ巨炮叔叔 提交于 2019-11-29 16:23:11
I am creating and sending a JSON Object with jQuery, but I cannot figure out how to parse it properly in my Ajax servlet using the org.json.simple library. My jQuery code is as follows : var JSONRooms = {"rooms":[]}; $('div#rooms span.group-item').each(function(index) { var $substr = $(this).text().split('('); var $name = $substr[0]; var $capacity = $substr[1].split(')')[0]; JSONRooms.rooms.push({"name":$name,"capacity":$capacity}); }); $.ajax({ type: "POST", url: "ParseSecondWizardAsync", data: JSONRooms, success: function() { alert("entered success function"); window.location = "ctt-wizard-3

How to disable jftfdi jffi query params in JSF

最后都变了- 提交于 2019-11-28 11:27:37
I tried the last version of JavaServer Faces 2.2 (Mojarra 2.2.4) and noticed changing my query string in this unwanted way: page.jsf?jftfdi=&jffi= instead of page.jsf I've found that it is the new JSF 2.2 feature. But these query params(jftfdi, jffi) spoil me SEO-friendly urls. How can I disable it? This is a bug in Mojarra. They should not have been appended when there's no means of any flow navigation configuration ( by the new @FlowScoped annotation and <j:flow-xxx> tags ). Basically, the OutcomeTargetRenderer class who's responsible for HTML output generation of the <h:link> and <h:button>

How to read complex JSON object from jQuery in Servlet request.getParameter

 ̄綄美尐妖づ 提交于 2019-11-28 10:57:01
问题 I am creating and sending a JSON Object with jQuery, but I cannot figure out how to parse it properly in my Ajax servlet using the org.json.simple library. My jQuery code is as follows : var JSONRooms = {"rooms":[]}; $('div#rooms span.group-item').each(function(index) { var $substr = $(this).text().split('('); var $name = $substr[0]; var $capacity = $substr[1].split(')')[0]; JSONRooms.rooms.push({"name":$name,"capacity":$capacity}); }); $.ajax({ type: "POST", url: "ParseSecondWizardAsync",

How to disable jftfdi jffi query params in JSF

拟墨画扇 提交于 2019-11-27 06:20:57
问题 I tried the last version of JavaServer Faces 2.2 (Mojarra 2.2.4) and noticed changing my query string in this unwanted way: page.jsf?jftfdi=&jffi= instead of page.jsf I've found that it is the new JSF 2.2 feature. But these query params(jftfdi, jffi) spoil me SEO-friendly urls. How can I disable it? 回答1: This is a bug in Mojarra. They should not have been appended when there's no means of any flow navigation configuration (by the new @FlowScoped annotation and <j:flow-xxx> tags). Basically,

Spring MVC - Why not able to use @RequestBody and @RequestParam together

☆樱花仙子☆ 提交于 2019-11-26 23:59:15
Using HTTP dev client with Post request and Content-Type application/x-www-form-urlencoded 1) Only @RequestBody Request - localhost:8080/SpringMVC/welcome In Body - name=abc Code- @RequestMapping(method = RequestMethod.POST) public String printWelcome(@RequestBody String body, Model model) { model.addAttribute("message", body); return "hello"; } // Gives body as 'name=abc' as expected 2) Only @RequestParam Request - localhost:8080/SpringMVC/welcome In Body - name=abc Code- @RequestMapping(method = RequestMethod.POST) public String printWelcome(@RequestParam String name, Model model) { model

How to programmatically send POST request to JSF page without using HTML form?

◇◆丶佛笑我妖孽 提交于 2019-11-26 19:09:22
I have very simple JSF bean like shown below: import org.jboss.seam.annotations.Name; @Name(Sample.NAME) public class Sample { public static final String NAME="df"; private String text = "text-test"; public void sampleM(){ System.out.println("Test: "+text); } public String getText() { return text; } public void setText(String text) { this.text = text; } } And JSF form connected with this component: <h:form id="sampleForm"> <h:commandButton id="sampleButton" action="#{df.sampleM()}" value="ok" /> </h:form> Now, I would like to programmatically send POST request to this form. According to my

What is difference between @RequestBody and @RequestParam?

非 Y 不嫁゛ 提交于 2019-11-26 18:24:11
I have gone through the Spring documentation to know about @RequestBody , and they have given the following explanation: The @RequestBody method parameter annotation indicates that a method parameter should be bound to the value of the HTTP request body. For example: @RequestMapping(value = "/something", method = RequestMethod.PUT) public void handle(@RequestBody String body, Writer writer) throws IOException { writer.write(body); } You convert the request body to the method argument by using an HttpMessageConverter . HttpMessageConverter is responsible for converting from the HTTP request

Set request character encoding of JSF input submitted values to UTF-8

孤街浪徒 提交于 2019-11-26 16:47:54
问题 I have the same problem as Set request character encoding of JSF input submitted values to UTF-8 in GlassFish, the submitted values arrive as Mojibake. However, the answer is targeted at GlassFish and I'm using JBoss AS 7. I've already specified the JDBC connection URL to use UTF-8: jdbc:mysql://localhost:3306/mydb?useUnicode=yes&characterEncoding=UTF-8 And in top of my JSF page: <?xml version='1.0' encoding='UTF-8' ?> How can I solve the same problem in JBoss AS 7? Or better, in a more

Depedency inject request parameter with CDI and JSF2

半世苍凉 提交于 2019-11-26 09:55:48
问题 When using CDI and JSF2 How can a HTTP request parameter be injected into a bean? 回答1: HINT: before reading any further have a look at http://showcase.omnifaces.org/cdi/Param. Do it yourself is probably obsolete seeing how omnifaces is a de facto standard today. I would probably not have written this if omnifaces had this at the time CDI does not solve specialized problems like injecting a request parameter. That's supposed to be solved by extensions. This is already provided by solder. http: