This question already has answers here:
Multiple submit buttons in the same form calling different Servlets
(6 answers)
Closed 6 years ago.
I am working on a web project. The login HTML page has 5 buttons like search, edit, create, delete, get. There is a text box where I give the string to search/edit/delete from the database. The create button when clicked will be redirected to a new page and a servlet handles the logic for that page. I have a servlet for login page which does the redirection based on button clicks. I have created servlets for the delete, search, edit functionality. However, I don't have separate html pages for the delete, search, get buttons. I used a request dispatcher servlet and am successfully able to enter to those corresponding servlets based on the clicks. But how should my web.xml be for the url mappings? I am using just HTML and Servlets. Also the final output should be displayed based on freemarker template engine. I am getting an error at this point. The freemarker is showing a Class File Error.
Any suggestions on how this should be called?
Disclaimer: I am not an expert at this, but I do know how PHP and Smarty works.
I would think in each respective servlet, you would specify what template you want to use.
request.getRequestDispatcher(TEMPLATE).forward(request, response);
where I earlier determined which .ftl template to use.
There is probably more to what I have done (I don't understand it all, yet) that I have failed to mention.
Related
I have implemented New UI SiteEdit in Tridion 2011 SP1. When I have created a page without components in it ,I am able to edit the page. If I am inserting the component I am not able to edit the page. Please help on this issue?
When changing a Page in New UI (Experience Manager or XPM), the page is checked-out. What you might be seeing for other users is expected behavior--other users should not be able to edit the page in the CME or within XPM.
Also, you should be restricted from editing content page for even the same user that has a different session (e.g. viewing the page from another browser).
When editing the page with the same user and session, you should be able to add multiple components. The page is checked out. Editing content on the page should be "editing components," rather than the page itself.
Let us know if you're seeing something else.
This can be a result of having an syntax error in your inline editing commands (i.e. the JSON syntax inside HTML comments). Normally you would use the OOTB building blocks that generate this for you, however, in some extreme scenarios, this syntax is written out by hand. I suspect that you may have the latter scenario. Verify your component and component field command syntax.
The overall goal is to perform a search on the following webpage http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx with a container value of CMAU1173561. I have tried two approaches, the php extension cURL and python's mechanized. The php approached involves a performing a POST submit using the input fields found on the page (NOTE: These are really ugly on the asp.net page). The returned page does not contain any of the search results. The second approaches involves using python's mechanize module. In this approach I load the page, select the form, then change the text field ctl00$ContentPlaceBody$TextSearch to the container value. When I load the response again no search results.
I am at a really dead end. Any help would be appreciate because as it stands my next step is to become a asp.net expertm which i perfer not to.
The source of that page is pretty scary (giant viewstate, tables all over the place, inline CSS, styles that look like they were copied from Word).
Regardless...an ASP.Net form still passes the same raw data to the server as any other form (though it is abstracted to the developer).
It's very possible that you are missing the cookies which go along with the request. If the search page (or any piece of the site) uses session state, the ASP.Net session cookie must be included in the request. You will be able to tell it from its name (contains "asp.net" and "session").
I assume that you have used a tool like Firebug or Chrome to view the complete outgoing request when the page is submitted. From my quick test, it looks like the request may be performed with a GET, not a POST. I submitted a form, looked at the request, and pasted the URL into a new browser window.
Example: http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx?ContNum=CMAU1173561&T=57201202648
This may be all you need to do.
We are using SDL Tridion 2009 SP1.
We have implemented a new functionality, an extension in our CMS which allowed us to lock a page.
If a page it is locked it cannot longer be published ( the information of a page that is locked is kept in a database which was created for this extension).
We want to add a new icon which will notify the user on the new status of the page.
Now there are 4 combination of icons ( no action , checked , published , checked and published )
Since I do not have a long experience with the CMS interface I want some help on finding a solution that have no impact on performance and
that it easy to implement in terms of not doing of lot of modification.
Below is my investigation regarding this:
I noticed that the way the icons are render in the cms is not a simple mechanism that can be easy updated.
Each time we click on an item in the left side of the CMS, in order to render the list from the right side a ajax call (with an xml request) is done to the WebGUIResponder.aspx. page.
The response we will get back is a xml that contain the attribute field Icon
<tcm:ListItems xmlns:tcm="http://www.tridion.com/ContentManager/5.0"
ID="tcm:yyy-zzzz-4" Managed="68" ItemType="4">
<tcm:Item ID="tcm:yyy-zzzzz-64" Type="64" Title="NotificationTest"
Modified="2011-05-09T09:42:27" FromPub="400 YYYY Website Master (EN-GB)"
IsNew="false" Icon="T64L0P1"/>
</tcm:ListItems>
Based on this field Icon attribute (Icon="T64L0P1) the image name starts to be processed.
T64 = means it is a page
L0 = is not checked
P1 = it is already published
For such a field the image name result will be = T64.16x16.List.Published.gif
I couldn't find a way to update this field through the page xml, is not an information that is kept in the xml but rather is build in the dll when the
xml request . (Somewhere based on other fields like published and something else this Icon field is calculated.)
So if it is not possible to modify this field the option we may have is:
In order to integrate our change in the CMS without modifying their .dll (this for compatibility with the new version of the SDL Trdion is not good to modify in the dlll)
and without changing too much the logic I was thinking to this approach.
We can make a new Ajax call to a a new page WebGUICheckPageLocked.aspx (need to be tested what will be the impact on the performance).
In the code behind of this page we can determine if the page is locked or not ( used our internal function that determine if the page is locked or not this functionality is already done).
In the page we will change the icon field to something T64L0P1E01 (adding some extra information which will allowed us to determine the new status of the page ).
We will also modify the In the GetPNGIconName javascript function we can then make an extra check taking in consideration the new information E01 ...)
Please if someone have some better idea on this, maybe it is something easy that can be done, maybe it is a way we can update the Icon field.
Kind Regards,
Cristina
I'll paste my answer from the forums here, so everyone can see (and maybe bring ideas on how to do it differently?)...
In 2011 I would use a Data Extender to change the icon.
Since this is 2009 you will need to use the less elegant predecessor: the GUI Responder Extension.
Essentially you need to manipulate the XML that is returned for the relevant requests (such as the GetList on a Folder).
I couldn't immediately find any documentation on this - which is not surprising as it is an older version. But it boils down to this:
Create a .NET assembly containing a class with the following method signature and attribute:
[ResponseMessageHandler]
public XmlDocument HandleMessage(XmlDocument messageXml, string userName, HttpContext httpContext, object tcmSession)
In that method, you can change the icon set in the XML based on your own logic.
In the extension configuration file, add a section to hook into the response for the lists you care about
(substitute "YourResponderExtension.dll" with the name of the assembly you added):
<ProcessResponse>
<!-- GetList -->
<ExecuteWhen>/tcmapi:Message/tcmapi:Response/tcmapi:Request/tcmapi:GetList</ExecuteWhen>
<!-- Handler for all of the above -->
<Execute>/bin/YourResponderExtension.dll</Execute>
</ProcessResponse>
Add more elements before the if applicable - and make the XPath query as specific as you can to avoid your extension being called unnecessarily. You might also need to check for more cases in the .NET code that you can't do with the XPath query.
ZIP up your extension and deploy it with TcmExtensionInstaller.exe.
From your text I'm assuming you've already worked out how to create and package an extension in 2009.
I hope that these smalls steps can get you started.
If you have any trouble or follow-up questions, just let me know and I'll see if I can answer them.
On a Drupal app, my goal is to display a page with a couple of CCK or taxonomy drop-down widgets, two Date Popup Calendar widgets and a "fake" submit button. The submit will use ajax to send the info to a PHP page that generates a BIRT report and returns the complete HTML back to the page, which I'll just inject into an empty div. I'd like to keep the controls on the page at all times and just use ajax to keep replacing the div containing my report as the user changes parameters and resubmits.
What's the best way to achieve this? I can handle a decent amount of PHP and JavaScript, but trying to leverage Drupal to create a page and display the controls is proving difficult to understand. Examples I've been reading are either too unrelated or too abstract to be helpful. Thanks!
No love from masses, but after a few more days of hammering on it, I've got BIRT 2.5 reports to play nicely in Drupal 6.16. You can read the whole story and see code samples here: I've completed integrating this with BIRT via a small custom module. You can read the full story with code samples here: http://nicholaiburton.com/blog/2010/creating-custom-reports-for-drupal
This is actually a follow up on my previous question (link)
I've created the HttpHandler and it works fine for now, I'll add flexibility by using the querystring and session to point the post I'm making in the right direction.
The next question is as follows.
Now that I have the old page iframed as it should be, there's still the trouble of handling the postbacks (or actions) these pages trigger.
Every button action (asp form post) refers to a page that is not there (it's on the other server from which I am importing functionality).
I've tried using a url mapping to the other server but I get an error that tells me the external link is not a valid virtual directory. Hence I discarded this option.
I there anyway to keep functionality going inside the iframe?
please do ask clarification if you need it.
I got a solution from a colleague.
before passing the response string to the Iframe from the handler I use a string.replace to adjust the urls in the old site. This way they point to the old site and everything works again :)